home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / Runimage / Cbuilder4 / Source / Vcl / WININET.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-01-26  |  103.2 KB  |  2,189 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Borland Delphi Run-time Library                 }
  5. {       Win32 internet API interface unit               }
  6. {                                                       }
  7. {       Copyright (c) 1996,98 Inprise Corporation       }
  8. {                                                       }
  9. {*******************************************************}
  10.  
  11. unit WinInet;
  12.  
  13. {$WEAKPACKAGEUNIT}
  14.  
  15. interface
  16.  
  17. uses Windows;
  18.  
  19. { Contains manifests, functions, types and prototypes for 
  20.   Microsoft Windows Internet Extensions }
  21.  
  22.  
  23. { internet types }
  24.  
  25. type
  26.   HINTERNET = Pointer; 
  27.   PHINTERNET = ^HINTERNET; 
  28.  
  29.   INTERNET_PORT = Word; 
  30.   PINTERNET_PORT = ^INTERNET_PORT; 
  31.  
  32.  
  33. { Internet APIs }
  34.  
  35.  
  36. { manifests }
  37.  
  38.  
  39. const
  40.   INTERNET_INVALID_PORT_NUMBER = 0;                 { use the protocol-specific default }
  41.  
  42.   INTERNET_DEFAULT_FTP_PORT = 21;                   { default for FTP servers }
  43.   INTERNET_DEFAULT_GOPHER_PORT = 70;                {    "     "  gopher " }
  44.   INTERNET_DEFAULT_HTTP_PORT = 80;                  {    "     "  HTTP   " }
  45.   INTERNET_DEFAULT_HTTPS_PORT = 443;                {    "     "  HTTPS  " }
  46.   INTERNET_DEFAULT_SOCKS_PORT = 1080;               { default for SOCKS firewall servers.}
  47.  
  48.   MAX_CACHE_ENTRY_INFO_SIZE = 4096;
  49.  
  50.  
  51. { maximum field lengths (arbitrary) }
  52.  
  53.   INTERNET_MAX_HOST_NAME_LENGTH = 256;
  54.   INTERNET_MAX_USER_NAME_LENGTH = 128;
  55.   INTERNET_MAX_PASSWORD_LENGTH = 128;
  56.   INTERNET_MAX_PORT_NUMBER_LENGTH = 5;              { INTERNET_PORT is unsigned short }
  57.   INTERNET_MAX_PORT_NUMBER_VALUE = 65535;           { maximum unsigned short value }
  58.   INTERNET_MAX_PATH_LENGTH = 2048;
  59.   INTERNET_MAX_SCHEME_LENGTH = 32;                   { longest protocol name length }
  60.   INTERNET_MAX_PROTOCOL_NAME = 'gopher';            { longest protocol name }
  61.   INTERNET_MAX_URL_LENGTH = ((SizeOf(INTERNET_MAX_PROTOCOL_NAME) - 1)
  62.                             + SizeOf('://')
  63.                             + INTERNET_MAX_PATH_LENGTH);
  64.  
  65.  
  66. { values returned by InternetQueryOption with INTERNET_OPTION_KEEP_CONNECTION: }
  67.  
  68.   INTERNET_KEEP_ALIVE_UNKNOWN = -1;
  69.   INTERNET_KEEP_ALIVE_ENABLED = 1;
  70.   INTERNET_KEEP_ALIVE_DISABLED = 0;
  71.  
  72. { flags returned by InternetQueryOption with INTERNET_OPTION_REQUEST_FLAGS }
  73.  
  74.   INTERNET_REQFLAG_FROM_CACHE   = $00000001;
  75.   INTERNET_REQFLAG_ASYNC        = $00000002;
  76.   INTERNET_REQFLAG_VIA_PROXY    = $00000004;  { request was made via a proxy }
  77.   INTERNET_REQFLAG_NO_HEADERS   = $00000008;  { orginal response contained no headers }
  78.   INTERNET_REQFLAG_PASSIVE      = $00000010;  { FTP: passive-mode connection }
  79.   INTERNET_REQFLAG_CACHE_WRITE_DISABLED = $00000040;  { HTTPS: this request not cacheable }
  80.  
  81. { flags common to open functions (not InternetOpen): }
  82.  
  83.   INTERNET_FLAG_RELOAD = $80000000;                 { retrieve the original item }
  84.  
  85. { flags for InternetOpenUrl: }
  86.  
  87.   INTERNET_FLAG_RAW_DATA = $40000000;               { receive the item as raw data }
  88.   INTERNET_FLAG_EXISTING_CONNECT = $20000000;       { do not create new connection object }
  89.  
  90. { flags for InternetOpen: }
  91.  
  92.   INTERNET_FLAG_ASYNC = $10000000;                  { this request is asynchronous (where supported) }
  93.  
  94. { protocol-specific flags: }
  95.  
  96.   INTERNET_FLAG_PASSIVE = $08000000;                { used for FTP connections }
  97.  
  98. { additional cache flags }
  99.  
  100.   INTERNET_FLAG_NO_CACHE_WRITE        = $04000000;  { don't write this item to the cache }
  101.   INTERNET_FLAG_DONT_CACHE            = INTERNET_FLAG_NO_CACHE_WRITE;
  102.   INTERNET_FLAG_MAKE_PERSISTENT       = $02000000;  { make this item persistent in cache }
  103.   INTERNET_FLAG_FROM_CACHE            = $01000000;  { use offline semantics }
  104.   INTERNET_FLAG_OFFLINE               = $01000000;  { use offline semantics }
  105.  
  106. { additional flags }
  107.  
  108.   INTERNET_FLAG_SECURE                = $00800000;  { use PCT/SSL if applicable (HTTP) }
  109.   INTERNET_FLAG_KEEP_CONNECTION       = $00400000;  { use keep-alive semantics }
  110.   INTERNET_FLAG_NO_AUTO_REDIRECT      = $00200000;  { don't handle redirections automatically }
  111.   INTERNET_FLAG_READ_PREFETCH         = $00100000;  { do background read prefetch }
  112.   INTERNET_FLAG_NO_COOKIES            = $00080000;  { no automatic cookie handling }
  113.   INTERNET_FLAG_NO_AUTH               = $00040000;  { no automatic authentication handling }
  114.   INTERNET_FLAG_CACHE_IF_NET_FAIL     = $00010000;  { return cache file if net request fails }
  115.  
  116. { Security Ignore Flags, Allow HttpOpenRequest to overide
  117.   Secure Channel (SSL/PCT) failures of the following types. }
  118.  
  119.   INTERNET_FLAG_IGNORE_CERT_CN_INVALID        = $00001000; { bad common name in X509 Cert. }
  120.   INTERNET_FLAG_IGNORE_CERT_DATE_INVALID      = $00002000; { expired X509 Cert. }
  121.   INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS      = $00004000; { ex: http:// to https:// }
  122.   INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP       = $00008000; { ex: https:// to http:// }
  123.  
  124. //
  125. // more caching flags
  126. //
  127.  
  128.   INTERNET_FLAG_RESYNCHRONIZE     = $00000800;  // asking wininet to update an item if it is newer
  129.   INTERNET_FLAG_HYPERLINK         = $00000400;  // asking wininet to do hyperlinking semantic which works right for scripts
  130.   INTERNET_FLAG_NO_UI             = $00000200;  // no cookie popup
  131.   INTERNET_FLAG_PRAGMA_NOCACHE    = $00000100;  // asking wininet to add "pragma: no-cache"
  132.   INTERNET_FLAG_CACHE_ASYNC       = $00000080;  // ok to perform lazy cache-write
  133.   INTERNET_FLAG_FORMS_SUBMIT      = $00000040;  // this is a forms submit
  134.   INTERNET_FLAG_NEED_FILE         = $00000010;  // need a file for this request
  135.  
  136. { FTP }
  137.  
  138. { manifests }
  139. const
  140. { flags for FTP }
  141.   FTP_TRANSFER_TYPE_UNKNOWN   = 00000000;
  142.   FTP_TRANSFER_TYPE_ASCII     = 00000001;
  143.   FTP_TRANSFER_TYPE_BINARY    = 00000002;
  144.  
  145.   FTP_TRANSFER_TYPE_MASK      = FTP_TRANSFER_TYPE_ASCII or
  146.                                 FTP_TRANSFER_TYPE_BINARY;
  147.  
  148.  
  149.   INTERNET_FLAG_TRANSFER_ASCII        = FTP_TRANSFER_TYPE_ASCII;
  150.   INTERNET_FLAG_TRANSFER_BINARY       = FTP_TRANSFER_TYPE_BINARY;
  151.  
  152. { flags field masks }
  153.  
  154.   SECURITY_INTERNET_MASK      = INTERNET_FLAG_IGNORE_CERT_CN_INVALID or
  155.                                 INTERNET_FLAG_IGNORE_CERT_DATE_INVALID or
  156.                                 INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS or
  157.                                 INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP;
  158.  
  159.   SECURITY_SET_MASK           = SECURITY_INTERNET_MASK;
  160.  
  161.   INTERNET_FLAGS_MASK         = INTERNET_FLAG_RELOAD              or
  162.                                 INTERNET_FLAG_RAW_DATA            or
  163.                                 INTERNET_FLAG_EXISTING_CONNECT    or
  164.                                 INTERNET_FLAG_ASYNC               or
  165.                                 INTERNET_FLAG_PASSIVE             or
  166.                                 INTERNET_FLAG_NO_CACHE_WRITE      or
  167.                                 INTERNET_FLAG_MAKE_PERSISTENT     or
  168.                                 INTERNET_FLAG_FROM_CACHE          or
  169.                                 INTERNET_FLAG_SECURE              or
  170.                                 INTERNET_FLAG_KEEP_CONNECTION     or
  171.                                 INTERNET_FLAG_NO_AUTO_REDIRECT    or
  172.                                 INTERNET_FLAG_READ_PREFETCH       or
  173.                                 INTERNET_FLAG_NO_COOKIES          or
  174.                                 INTERNET_FLAG_NO_AUTH             or
  175.                                 INTERNET_FLAG_CACHE_IF_NET_FAIL   or
  176.                                 SECURITY_INTERNET_MASK            or
  177.                                 INTERNET_FLAG_RESYNCHRONIZE       or
  178.                                 INTERNET_FLAG_HYPERLINK           or
  179.                                 INTERNET_FLAG_NO_UI               or
  180.                                 INTERNET_FLAG_PRAGMA_NOCACHE      or
  181.                                 INTERNET_FLAG_CACHE_ASYNC         or
  182.                                 INTERNET_FLAG_FORMS_SUBMIT        or
  183.                                 INTERNET_FLAG_NEED_FILE           or
  184.                                 INTERNET_FLAG_TRANSFER_BINARY     or
  185.                                 INTERNET_FLAG_TRANSFER_ASCII;
  186.  
  187.   INTERNET_ERROR_MASK_INSERT_CDROM = $1;
  188.  
  189.   INTERNET_OPTIONS_MASK       =  not INTERNET_FLAGS_MASK;
  190.  
  191. //
  192. // common per-API flags (new APIs)
  193. //
  194.  
  195.   WININET_API_FLAG_ASYNC          = $00000001;  // force async operation
  196.   WININET_API_FLAG_SYNC           = $00000004;  // force sync operation
  197.   WININET_API_FLAG_USE_CONTEXT    = $00000008;  // use value supplied in dwContext (even if 0)
  198.  
  199. { INTERNET_NO_CALLBACK - if this value is presented as the dwContext parameter }
  200. { then no call-backs will be made for that API }
  201.  
  202.   INTERNET_NO_CALLBACK = 0;
  203.  
  204. { structures/types }
  205.  
  206. type
  207.   PInternetScheme = ^TInternetScheme;
  208.   TInternetScheme = Integer;
  209. const
  210.   INTERNET_SCHEME_PARTIAL = -2;
  211.   INTERNET_SCHEME_UNKNOWN = -1;
  212.   INTERNET_SCHEME_DEFAULT = 0;
  213.   INTERNET_SCHEME_FTP = 1;
  214.   INTERNET_SCHEME_GOPHER = 2;
  215.   INTERNET_SCHEME_HTTP = 3;
  216.   INTERNET_SCHEME_HTTPS = 4;
  217.   INTERNET_SCHEME_FILE = 5;
  218.   INTERNET_SCHEME_NEWS = 6;
  219.   INTERNET_SCHEME_MAILTO = 7;
  220.   INTERNET_SCHEME_FIRST = INTERNET_SCHEME_FTP;
  221.   INTERNET_SCHEME_LAST = INTERNET_SCHEME_MAILTO;
  222.  
  223. { TInternetAsyncResult - this structure is returned to the application via }
  224. { the callback with INTERNET_STATUS_REQUEST_COMPLETE. It is not sufficient to }
  225. { just return the result of the async operation. If the API failed then the }
  226. { app cannot call GetLastError because the thread context will be incorrect. }
  227. { Both the value returned by the async API and any resultant error code are }
  228. { made available. The app need not check dwError if dwResult indicates that }
  229. { the API succeeded (in this case dwError will be ERROR_SUCCESS) }
  230.  
  231. type
  232.   PInternetAsyncResult = ^TInternetAsyncResult;
  233.   TInternetAsyncResult = record
  234.     dwResult: DWORD; { the HINTERNET, DWORD or BOOL return code from an async API }
  235.     dwError: DWORD; { dwError - the error code if the API failed }
  236.   end;
  237.  
  238.   PInternetPrefetchStatus = ^TInternetPrefetchStatus;
  239.   TInternetPrefetchStatus = record
  240.     dwStatus: DWORD;  { dwStatus - status of download. See INTERNET_PREFETCH_ flags }
  241.     dwSize: DWORD;    { dwSize - size of file downloaded so far }
  242.   end;
  243.  
  244.  
  245. const
  246. { INTERNET_PREFETCH_STATUS - dwStatus values }
  247.   INTERNET_PREFETCH_PROGRESS      = 0;
  248.   INTERNET_PREFETCH_COMPLETE      = 1;
  249.   INTERNET_PREFETCH_ABORTED       = 2;
  250.  
  251.  
  252.  
  253. type
  254. { TInternetProxyInfo - structure supplied with INTERNET_OPTION_PROXY to get/ }
  255. { set proxy information on a InternetOpen handle }
  256.   PInternetProxyInfo = ^TInternetProxyInfo;
  257.   TInternetProxyInfo = record
  258.     dwAccessType: DWORD;       { dwAccessType - INTERNET_OPEN_TYPE_DIRECT, INTERNET_OPEN_TYPE_PROXY, or }
  259.     lpszProxy: LPCSTR;        { lpszProxy - proxy server list }
  260.     lpszProxyBypass: LPCSTR;  { lpszProxyBypass - proxy bypass list }
  261.   end;
  262.  
  263.  
  264. { INTERNET_VERSION_INFO - version information returned via }
  265. { InternetQueryOption(..., INTERNET_OPTION_VERSION, ...) }
  266.  
  267.   PInternetVersionInfo = ^TInternetVersionInfo;
  268.   TInternetVersionInfo = record
  269.     dwMajorVersion: DWORD;
  270.     dwMinorVersion: DWORD;
  271.   end;
  272.  
  273. { HTTP_VERSION_INFO - query or set global HTTP version (1.0 or 1.1) }
  274.   PHttpVersionInfo = ^THttpVersionInfo;
  275.   THttpVersionInfo = record
  276.     dwMajorVersion: DWORD;
  277.     dwMinorVersion: DWORD;
  278.   end;
  279.  
  280. { INTERNET_CONNECTED_INFO - information used to set the global connected state }
  281.  
  282.   PInternetConnectedInfo = ^TInternetConnectedInfo;
  283.   TInternetConnectedInfo = record
  284.       dwConnectedState: DWORD;     {dwConnectedState - new connected/disconnected state.}
  285.       dwFlags: DWORD;              {dwFlags - flags controlling connected->disconnected (or disconnected-> }
  286.                                    {connected) transition. See below}
  287.   end;
  288.  
  289. { flags for INTERNET_CONNECTED_INFO dwFlags }
  290.  
  291. { ISO_FORCE_DISCONNECTED - if set when putting Wininet into disconnected mode, }
  292. { all outstanding requests will be aborted with a cancelled error }
  293.  
  294. const
  295.   ISO_FORCE_DISCONNECTED  = $00000001;
  296.  
  297.  
  298.  
  299. { URL_COMPONENTS - the constituent parts of an URL. Used in InternetCrackUrl }
  300. { and InternetCreateUrl }
  301.  
  302. { For InternetCrackUrl, if a pointer field and its corresponding length field }
  303. { are both 0 then that component is not returned; If the pointer field is NULL }
  304. { but the length field is not zero, then both the pointer and length fields are }
  305. { returned; if both pointer and corresponding length fields are non-zero then }
  306. { the pointer field points to a buffer where the component is copied. The }
  307. { component may be un-escaped, depending on dwFlags }
  308.  
  309. { For InternetCreateUrl, the pointer fields should be nil if the component }
  310. { is not required. If the corresponding length field is zero then the pointer }
  311. { field is the address of a zero-terminated string. If the length field is not }
  312. { zero then it is the string length of the corresponding pointer field }
  313.  
  314. type
  315.   PURLComponents = ^TURLComponents;
  316.   TURLComponents = record
  317.     dwStructSize: DWORD;        { size of this structure. Used in version check }
  318.     lpszScheme: LPSTR;         { pointer to scheme name }
  319.     dwSchemeLength: DWORD;      { length of scheme name }
  320.     nScheme: TInternetScheme;    { enumerated scheme type (if known) }
  321.     lpszHostName: LPSTR;       { pointer to host name }
  322.     dwHostNameLength: DWORD;    { length of host name }
  323.     nPort: INTERNET_PORT;       { converted port number }
  324.     lpszUserName: LPSTR;       { pointer to user name }
  325.     dwUserNameLength: DWORD;    { length of user name }
  326.     lpszPassword: LPSTR;       { pointer to password }
  327.     dwPasswordLength: DWORD;    { length of password }
  328.     lpszUrlPath: LPSTR;        { pointer to URL-path }
  329.     dwUrlPathLength: DWORD;     { length of URL-path }
  330.     lpszExtraInfo: LPSTR;      { pointer to extra information (e.g. ?foo or #foo) }
  331.     dwExtraInfoLength: DWORD;   { length of extra information }
  332.   end;
  333.  
  334. { TInternetCertificateInfo lpBuffer - contains the certificate returned from
  335.   the server }
  336.  
  337.   PInternetCertificateInfo = ^TInternetCertificateInfo;
  338.   TInternetCertificateInfo = record
  339.     ftExpiry: TFileTime;             { ftExpiry - date the certificate expires. }
  340.     ftStart: TFileTime;              { ftStart - date the certificate becomes valid. }
  341.     lpszSubjectInfo: LPSTR;        { lpszSubjectInfo - the name of organization, site, and server }
  342.                                     {   the cert. was issued for. }
  343.     lpszIssuerInfo: LPSTR;         { lpszIssuerInfo - the name of orgainzation, site, and server }
  344.                                     {   the cert was issues by. }
  345.     lpszProtocolName: LPSTR;       { lpszProtocolName - the name of the protocol used to provide the secure }
  346.                                     {   connection. }
  347.     lpszSignatureAlgName: LPSTR;   { lpszSignatureAlgName - the name of the algorithm used for signing }
  348.                                     {  the certificate. }
  349.     lpszEncryptionAlgName: LPSTR;  { lpszEncryptionAlgName - the name of the algorithm used for }
  350.                                     {  doing encryption over the secure channel (SSL/PCT) connection. }
  351.     dwKeySize: DWORD;               { dwKeySize - size of the key. }
  352.   end;
  353.  
  354. { INTERNET_BUFFERS - combines headers and data. May be chained for e.g. file }
  355. { upload or scatter/gather operations. For chunked read/write, lpcszHeader }
  356. { contains the chunked-ext }
  357.   PInternetBuffers = ^TInternetBuffers;
  358.   TInternetBuffers = record
  359.     dwStructSize: DWORD;      { used for API versioning. Set to sizeof(INTERNET_BUFFERS) }
  360.     Next: PInternetBuffers;   { chain of buffers }
  361.     lpcszHeader: LPSTR;       { pointer to headers (may be NULL) }
  362.     dwHeadersLength: DWORD;   { length of headers if not NULL }
  363.     dwHeadersTotal: DWORD;    { size of headers if not enough buffer }
  364.     lpvBuffer: Pointer;       { pointer to data buffer (may be NULL) }
  365.     dwBufferLength: DWORD;    { length of data buffer if not NULL }
  366.     dwBufferTotal: DWORD;     { total size of chunk, or content-length if not chunked }
  367.     dwOffsetLow: DWORD;       { used for read-ranges (only used in HttpSendRequest2) }
  368.     dwOffsetHigh: DWORD;
  369.   end;
  370.  
  371. { prototypes }
  372.  
  373. function InternetTimeFromSystemTime(const pst: TSystemTime;
  374.   dwRFC: DWORD; lpszTime: LPSTR; cbTime: DWORD): BOOL; stdcall;
  375.  
  376. const
  377. { constants for InternetTimeFromSystemTime }
  378.   INTERNET_RFC1123_FORMAT         = 0;
  379.   INTERNET_RFC1123_BUFSIZE        = 30;
  380.  
  381. function InternetCrackUrlA(lpszUrl: PAnsiChar; dwUrlLength, dwFlags: DWORD;
  382.   var lpUrlComponents: TURLComponents): BOOL; stdcall;
  383. function InternetCrackUrlW(lpszUrl: PWideChar; dwUrlLength, dwFlags: DWORD;
  384.   var lpUrlComponents: TURLComponents): BOOL; stdcall;
  385. function InternetCrackUrl(lpszUrl: PChar; dwUrlLength, dwFlags: DWORD;
  386.   var lpUrlComponents: TURLComponents): BOOL; stdcall;
  387.  
  388. function InternetCreateUrlA(var lpUrlComponents: TURLComponents;
  389.   dwFlags: DWORD; lpszUrl: PAnsiChar; var dwUrlLength: DWORD): BOOL; stdcall;
  390. function InternetCreateUrlW(var lpUrlComponents: TURLComponents;
  391.   dwFlags: DWORD; lpszUrl: PWideChar; var dwUrlLength: DWORD): BOOL; stdcall;
  392. function InternetCreateUrl(var lpUrlComponents: TURLComponents;
  393.   dwFlags: DWORD; lpszUrl: PChar; var dwUrlLength: DWORD): BOOL; stdcall;
  394.  
  395. function InternetCanonicalizeUrlA(lpszUrl: PAnsiChar;
  396.   lpszBuffer: PAnsiChar; var lpdwBufferLength: DWORD;
  397.   dwFlags: DWORD): BOOL; stdcall;
  398. function InternetCanonicalizeUrlW(lpszUrl: PWideChar;
  399.   lpszBuffer: PWideChar; var lpdwBufferLength: DWORD;
  400.   dwFlags: DWORD): BOOL; stdcall;
  401. function InternetCanonicalizeUrl(lpszUrl: PChar;
  402.   lpszBuffer: PChar; var lpdwBufferLength: DWORD;
  403.   dwFlags: DWORD): BOOL; stdcall;
  404.  
  405. function InternetCombineUrlA(lpszBaseUrl, lpszRelativeUrl: PAnsiChar;
  406.   lpszBuffer: PAnsiChar; var lpdwBufferLength: DWORD;
  407.   dwFlags: DWORD): BOOL; stdcall;
  408. function InternetCombineUrlW(lpszBaseUrl, lpszRelativeUrl: PWideChar;
  409.   lpszBuffer: PWideChar; var lpdwBufferLength: DWORD;
  410.   dwFlags: DWORD): BOOL; stdcall;
  411. function InternetCombineUrl(lpszBaseUrl, lpszRelativeUrl: PChar;
  412.   lpszBuffer: PChar; var lpdwBufferLength: DWORD;
  413.   dwFlags: DWORD): BOOL; stdcall;
  414.  
  415. const
  416. { flags for InternetCrackUrl and InternetCreateUrl }
  417.  
  418.   ICU_ESCAPE          = $80000000;  { (un)escape URL characters }
  419.   ICU_USERNAME        = $40000000;  { use internal username & password }
  420.  
  421.  
  422. { flags for InternetCanonicalizeUrl and InternetCombineUrl }
  423.  
  424.   ICU_NO_ENCODE       = $20000000;  { Don't convert unsafe characters to escape sequence }
  425.   ICU_DECODE          = $10000000;  { Convert escape sequences to characters }
  426.   ICU_NO_META         = $08000000;  { Don't convert .. etc. meta path sequences }
  427.   ICU_ENCODE_SPACES_ONLY     = $04000000;  { Encode spaces only }
  428.   ICU_BROWSER_MODE    = $02000000;  { Special encode/decode rules for browser }
  429.  
  430.  
  431. function InternetOpenA(lpszAgent: PAnsiChar; dwAccessType: DWORD; 
  432.   lpszProxy, lpszProxyBypass: PAnsiChar; dwFlags: DWORD): HINTERNET; stdcall;
  433. function InternetOpenW(lpszAgent: PWideChar; dwAccessType: DWORD; 
  434.   lpszProxy, lpszProxyBypass: PWideChar; dwFlags: DWORD): HINTERNET; stdcall;
  435. function InternetOpen(lpszAgent: PChar; dwAccessType: DWORD; 
  436.   lpszProxy, lpszProxyBypass: PChar; dwFlags: DWORD): HINTERNET; stdcall;
  437.  
  438. { access types for InternetOpen }
  439. const
  440.   INTERNET_OPEN_TYPE_PRECONFIG        = 0;  { use registry configuration }
  441.   INTERNET_OPEN_TYPE_DIRECT           = 1;  { direct to net }
  442.   INTERNET_OPEN_TYPE_PROXY            = 3;  { via named proxy }
  443.   INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY  = 4;   { prevent using java/script/INS }
  444.  
  445. { old names for access types }
  446.  
  447.   PRE_CONFIG_INTERNET_ACCESS      = INTERNET_OPEN_TYPE_PRECONFIG;
  448.   LOCAL_INTERNET_ACCESS           = INTERNET_OPEN_TYPE_DIRECT;
  449.   GATEWAY_INTERNET_ACCESS         = 2;  { Internet via gateway }
  450.   CERN_PROXY_INTERNET_ACCESS      = INTERNET_OPEN_TYPE_PROXY;
  451.  
  452.  
  453. function InternetCloseHandle(hInet: HINTERNET): BOOL; stdcall;
  454.  
  455. function InternetConnectA(hInet: HINTERNET; lpszServerName: PAnsiChar;
  456.   nServerPort: INTERNET_PORT; lpszUsername: PAnsiChar; lpszPassword: PAnsiChar; 
  457.   dwService: DWORD; dwFlags: DWORD; dwContext: DWORD): HINTERNET; stdcall;
  458. function InternetConnectW(hInet: HINTERNET; lpszServerName: PWideChar;
  459.   nServerPort: INTERNET_PORT; lpszUsername: PWideChar; lpszPassword: PWideChar; 
  460.   dwService: DWORD; dwFlags: DWORD; dwContext: DWORD): HINTERNET; stdcall;
  461. function InternetConnect(hInet: HINTERNET; lpszServerName: PChar;
  462.   nServerPort: INTERNET_PORT; lpszUsername: PChar; lpszPassword: PChar; 
  463.   dwService: DWORD; dwFlags: DWORD; dwContext: DWORD): HINTERNET; stdcall;
  464.  
  465.  
  466. { service types for InternetConnect }
  467. const
  468.   INTERNET_SERVICE_URL = 0;
  469.   INTERNET_SERVICE_FTP = 1;
  470.   INTERNET_SERVICE_GOPHER = 2; 
  471.   INTERNET_SERVICE_HTTP = 3; 
  472.  
  473.  
  474. function InternetOpenUrlA(hInet: HINTERNET; lpszUrl: PAnsiChar;
  475.   lpszHeaders: PAnsiChar; dwHeadersLength: DWORD; dwFlags: DWORD;
  476.   dwContext: DWORD): HINTERNET; stdcall;
  477. function InternetOpenUrlW(hInet: HINTERNET; lpszUrl: PWideChar;
  478.   lpszHeaders: PWideChar; dwHeadersLength: DWORD; dwFlags: DWORD;
  479.   dwContext: DWORD): HINTERNET; stdcall;
  480. function InternetOpenUrl(hInet: HINTERNET; lpszUrl: PChar;
  481.   lpszHeaders: PChar; dwHeadersLength: DWORD; dwFlags: DWORD;
  482.   dwContext: DWORD): HINTERNET; stdcall;
  483.  
  484. function InternetReadFile(hFile: HINTERNET; lpBuffer: Pointer;
  485.   dwNumberOfBytesToRead: DWORD; var lpdwNumberOfBytesRead: DWORD): BOOL; stdcall;
  486.  
  487. function InternetReadFileExA(hFile: HINTERNET;  lpBuffersOut: Pointer;
  488.   dwFlags: DWORD; dwContext: DWORD): BOOL; stdcall;
  489. function InternetReadFileExW(hFile: HINTERNET;  lpBuffersOut: Pointer;
  490.   dwFlags: DWORD; dwContext: DWORD): BOOL; stdcall;
  491. function InternetReadFileEx(hFile: HINTERNET;  lpBuffersOut: Pointer;
  492.   dwFlags: DWORD; dwContext: DWORD): BOOL; stdcall;
  493.  
  494. { flags for InternetReadFileEx() }
  495. const
  496.   IRF_ASYNC       = WININET_API_FLAG_ASYNC;
  497.   IRF_SYNC        = WININET_API_FLAG_SYNC;
  498.   IRF_USE_CONTEXT = WININET_API_FLAG_USE_CONTEXT;
  499.   IRF_NO_WAIT     = $00000008;
  500.  
  501.  
  502. function InternetSetFilePointer(hFile: HINTERNET;
  503.   lDistanceToMove: Longint; pReserved: Pointer;
  504.   dwMoveMethod, dwContext: DWORD): DWORD; stdcall;
  505.  
  506. function InternetWriteFile(hFile: HINTERNET; lpBuffer: Pointer;
  507.   dwNumberOfBytesToWrite: DWORD;
  508.   var lpdwNumberOfBytesWritten: DWORD): BOOL; stdcall;
  509.  
  510. function InternetQueryDataAvailable(hFile: HINTERNET; var lpdwNumberOfBytesAvailable: DWORD;
  511.   dwFlags, dwContext: DWORD): BOOL; stdcall;
  512.  
  513. function InternetFindNextFileA(hFind: HINTERNET; lpvFindData: Pointer): BOOL; stdcall;
  514. function InternetFindNextFileW(hFind: HINTERNET; lpvFindData: Pointer): BOOL; stdcall;
  515. function InternetFindNextFile(hFind: HINTERNET; lpvFindData: Pointer): BOOL; stdcall;
  516.  
  517. function InternetQueryOptionA(hInet: HINTERNET; dwOption: DWORD;
  518.   lpBuffer: Pointer; var lpdwBufferLength: DWORD): BOOL; stdcall;
  519. function InternetQueryOptionW(hInet: HINTERNET; dwOption: DWORD;
  520.   lpBuffer: Pointer; var lpdwBufferLength: DWORD): BOOL; stdcall;
  521. function InternetQueryOption(hInet: HINTERNET; dwOption: DWORD;
  522.   lpBuffer: Pointer; var lpdwBufferLength: DWORD): BOOL; stdcall;
  523.  
  524. function InternetSetOptionA(hInet: HINTERNET; dwOption: DWORD;
  525.   lpBuffer: Pointer; dwBufferLength: DWORD): BOOL; stdcall;
  526. function InternetSetOptionW(hInet: HINTERNET; dwOption: DWORD;
  527.   lpBuffer: Pointer; dwBufferLength: DWORD): BOOL; stdcall;
  528. function InternetSetOption(hInet: HINTERNET; dwOption: DWORD;
  529.   lpBuffer: Pointer; dwBufferLength: DWORD): BOOL; stdcall;
  530.  
  531. function InternetSetOptionExA(hInet: HINTERNET; dwOption: DWORD;
  532.   lpBuffer: Pointer; dwBufferLength, dwFlags: DWORD): BOOL; stdcall;
  533. function InternetSetOptionExW(hInet: HINTERNET; dwOption: DWORD;
  534.   lpBuffer: Pointer; dwBufferLength, dwFlags: DWORD): BOOL; stdcall;
  535. function InternetSetOptionEx(hInet: HINTERNET; dwOption: DWORD;
  536.   lpBuffer: Pointer; dwBufferLength, dwFlags: DWORD): BOOL; stdcall;
  537.  
  538. function InternetLockRequestFile(hInternet: HINTERNET;
  539.   lphLockRequestInfo: PHandle): BOOL; stdcall;
  540.  
  541. function InternetUnlockRequestFile(hLockRequestInfo: THANDLE): BOOL; stdcall;
  542.  
  543. { flags for InternetSetOptionEx() }
  544. const
  545.   ISO_GLOBAL      = $00000001;  { modify option globally }
  546.   ISO_REGISTRY    = $00000002;  { write option to registry (where applicable) }
  547.   ISO_VALID_FLAGS = ISO_GLOBAL or ISO_REGISTRY;
  548.  
  549.  
  550.  
  551. { options manifests for Internet(Query or Set)Option }
  552. const
  553.   INTERNET_OPTION_CALLBACK = 1;
  554.   INTERNET_OPTION_CONNECT_TIMEOUT = 2;
  555.   INTERNET_OPTION_CONNECT_RETRIES = 3;
  556.   INTERNET_OPTION_CONNECT_BACKOFF = 4;
  557.   INTERNET_OPTION_SEND_TIMEOUT = 5;
  558.   INTERNET_OPTION_CONTROL_SEND_TIMEOUT       = INTERNET_OPTION_SEND_TIMEOUT;
  559.   INTERNET_OPTION_RECEIVE_TIMEOUT = 6;
  560.   INTERNET_OPTION_CONTROL_RECEIVE_TIMEOUT    = INTERNET_OPTION_RECEIVE_TIMEOUT;
  561.   INTERNET_OPTION_DATA_SEND_TIMEOUT = 7;
  562.   INTERNET_OPTION_DATA_RECEIVE_TIMEOUT = 8;
  563.   INTERNET_OPTION_HANDLE_TYPE = 9;
  564.  
  565.   INTERNET_OPTION_READ_BUFFER_SIZE = 12;
  566.   INTERNET_OPTION_WRITE_BUFFER_SIZE = 13;
  567.  
  568.   INTERNET_OPTION_ASYNC_ID = 15;
  569.   INTERNET_OPTION_ASYNC_PRIORITY = 16;
  570.  
  571.   INTERNET_OPTION_PARENT_HANDLE               = 21;
  572.   INTERNET_OPTION_KEEP_CONNECTION             = 22;
  573.   INTERNET_OPTION_REQUEST_FLAGS               = 23;
  574.   INTERNET_OPTION_EXTENDED_ERROR              = 24;
  575.  
  576.   INTERNET_OPTION_OFFLINE_MODE                = 26;
  577.   INTERNET_OPTION_CACHE_STREAM_HANDLE         = 27;
  578.   INTERNET_OPTION_USERNAME                    = 28;
  579.   INTERNET_OPTION_PASSWORD                    = 29;
  580.   INTERNET_OPTION_ASYNC                       = 30;
  581.   INTERNET_OPTION_SECURITY_FLAGS              = 31;
  582.   INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT = 32;
  583.   INTERNET_OPTION_DATAFILE_NAME               = 33;
  584.   INTERNET_OPTION_URL                         = 34;
  585.   INTERNET_OPTION_SECURITY_CERTIFICATE        = 35;
  586.   INTERNET_OPTION_SECURITY_KEY_BITNESS        = 36;
  587.   INTERNET_OPTION_REFRESH                     = 37;
  588.   INTERNET_OPTION_PROXY                       = 38;
  589.   INTERNET_OPTION_SETTINGS_CHANGED            = 39;
  590.   INTERNET_OPTION_VERSION                     = 40;
  591.   INTERNET_OPTION_USER_AGENT                  = 41;
  592.   INTERNET_OPTION_END_BROWSER_SESSION         = 42;
  593.   INTERNET_OPTION_PROXY_USERNAME              = 43;
  594.   INTERNET_OPTION_PROXY_PASSWORD              = 44;
  595.   INTERNET_OPTION_CONTEXT_VALUE               = 45;
  596.   INTERNET_OPTION_CONNECT_LIMIT               = 46;
  597.   INTERNET_OPTION_SECURITY_SELECT_CLIENT_CERT = 47;
  598.   INTERNET_OPTION_POLICY                      = 48;
  599.   INTERNET_OPTION_DISCONNECTED_TIMEOUT        = 49;
  600.   INTERNET_OPTION_CONNECTED_STATE             = 50;
  601.   INTERNET_OPTION_IDLE_STATE                  = 51;
  602.   INTERNET_OPTION_OFFLINE_SEMANTICS           = 52;
  603.   INTERNET_OPTION_SECONDARY_CACHE_KEY         = 53;
  604.   INTERNET_OPTION_CALLBACK_FILTER             = 54;
  605.   INTERNET_OPTION_CONNECT_TIME                = 55;
  606.   INTERNET_OPTION_SEND_THROUGHPUT             = 56;
  607.   INTERNET_OPTION_RECEIVE_THROUGHPUT          = 57;
  608.   INTERNET_OPTION_REQUEST_PRIORITY            = 58;
  609.   INTERNET_OPTION_HTTP_VERSION                = 59;
  610.   INTERNET_OPTION_RESET_URLCACHE_SESSION      = 60;
  611.   INTERNET_OPTION_ERROR_MASK                  = 62;
  612.  
  613.   INTERNET_FIRST_OPTION                      = INTERNET_OPTION_CALLBACK;
  614.   INTERNET_LAST_OPTION                       = INTERNET_OPTION_PROXY;
  615.  
  616. { values for INTERNET_OPTION_PRIORITY }
  617.  
  618.   INTERNET_PRIORITY_FOREGROUND = 1000;
  619.  
  620. { handle types }
  621.  
  622.   INTERNET_HANDLE_TYPE_INTERNET = 1;
  623.   INTERNET_HANDLE_TYPE_CONNECT_FTP = 2;
  624.   INTERNET_HANDLE_TYPE_CONNECT_GOPHER = 3;
  625.   INTERNET_HANDLE_TYPE_CONNECT_HTTP = 4;
  626.   INTERNET_HANDLE_TYPE_FTP_FIND = 5;
  627.   INTERNET_HANDLE_TYPE_FTP_FIND_HTML = 6;
  628.   INTERNET_HANDLE_TYPE_FTP_FILE = 7;
  629.   INTERNET_HANDLE_TYPE_FTP_FILE_HTML = 8;
  630.   INTERNET_HANDLE_TYPE_GOPHER_FIND = 9;
  631.   INTERNET_HANDLE_TYPE_GOPHER_FIND_HTML = 10;
  632.   INTERNET_HANDLE_TYPE_GOPHER_FILE = 11;
  633.   INTERNET_HANDLE_TYPE_GOPHER_FILE_HTML = 12;
  634.   INTERNET_HANDLE_TYPE_HTTP_REQUEST = 13;
  635.  
  636. { values for INTERNET_OPTION_SECURITY_FLAGS }
  637.  
  638.   SECURITY_FLAG_SECURE                        = $00000001; { can query only }
  639.   SECURITY_FLAG_SSL                           = $00000002;
  640.   SECURITY_FLAG_SSL3                          = $00000004;
  641.   SECURITY_FLAG_PCT                           = $00000008;
  642.   SECURITY_FLAG_PCT4                          = $00000010;
  643.   SECURITY_FLAG_IETFSSL4                      = $00000020;
  644.  
  645.   SECURITY_FLAG_STRENGTH_WEAK                 = $10000000;
  646.   SECURITY_FLAG_STRENGTH_MEDIUM               = $40000000;
  647.   SECURITY_FLAG_STRENGTH_STRONG               = $20000000;
  648.  
  649.   SECURITY_FLAG_40BIT                         = SECURITY_FLAG_STRENGTH_WEAK;
  650.   SECURITY_FLAG_128BIT                        = SECURITY_FLAG_STRENGTH_STRONG;
  651.   SECURITY_FLAG_56BIT                         = SECURITY_FLAG_STRENGTH_MEDIUM;
  652.   SECURITY_FLAG_UNKNOWNBIT                    = $80000000;
  653.   SECURITY_FLAG_NORMALBITNESS                 = SECURITY_FLAG_40BIT;
  654.  
  655.   SECURITY_FLAG_IGNORE_REVOCATION             = 00000080;
  656.   SECURITY_FLAG_IGNORE_UNKNOWN_CA             = 00000100;
  657.   SECURITY_FLAG_IGNORE_WRONG_USAGE            = 00000200;
  658.  
  659.   SECURITY_FLAG_IGNORE_CERT_CN_INVALID        = INTERNET_FLAG_IGNORE_CERT_CN_INVALID;
  660.   SECURITY_FLAG_IGNORE_CERT_DATE_INVALID      = INTERNET_FLAG_IGNORE_CERT_DATE_INVALID;
  661.  
  662.   SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTPS      = INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS;
  663.   SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTP       = INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP;
  664.  
  665. function InternetGetLastResponseInfoA(var lpdwError: DWORD; lpszBuffer: PAnsiChar;
  666.   var lpdwBufferLength: DWORD): BOOL; stdcall;
  667. function InternetGetLastResponseInfoW(var lpdwError: DWORD; lpszBuffer: PWideChar;
  668.   var lpdwBufferLength: DWORD): BOOL; stdcall;
  669. function InternetGetLastResponseInfo(var lpdwError: DWORD; lpszBuffer: PChar;
  670.   var lpdwBufferLength: DWORD): BOOL; stdcall;
  671.  
  672. { callback function for InternetSetStatusCallback }
  673. type
  674.   TFNInternetStatusCallback = TFarProc;
  675.   PFNInternetStatusCallback = ^TFNInternetStatusCallback;
  676.  
  677.  
  678. function InternetSetStatusCallback(hInet: HINTERNET;
  679.   lpfnInternetCallback: PFNInternetStatusCallback): PFNInternetStatusCallback; stdcall;
  680.  
  681.  
  682. { status manifests for Internet status callback }
  683. const
  684.   INTERNET_STATUS_RESOLVING_NAME              = 10;
  685.   INTERNET_STATUS_NAME_RESOLVED               = 11;
  686.   INTERNET_STATUS_CONNECTING_TO_SERVER        = 20;
  687.   INTERNET_STATUS_CONNECTED_TO_SERVER         = 21;
  688.   INTERNET_STATUS_SENDING_REQUEST             = 30;
  689.   INTERNET_STATUS_REQUEST_SENT                = 31;
  690.   INTERNET_STATUS_RECEIVING_RESPONSE          = 40;
  691.   INTERNET_STATUS_RESPONSE_RECEIVED           = 41;
  692.   INTERNET_STATUS_CTL_RESPONSE_RECEIVED       = 42; 
  693.   INTERNET_STATUS_PREFETCH                    = 43; 
  694.   INTERNET_STATUS_CLOSING_CONNECTION          = 50; 
  695.   INTERNET_STATUS_CONNECTION_CLOSED           = 51; 
  696.   INTERNET_STATUS_HANDLE_CREATED              = 60;
  697.   INTERNET_STATUS_HANDLE_CLOSING              = 70;
  698.   INTERNET_STATUS_REQUEST_COMPLETE            = 100;
  699.   INTERNET_STATUS_REDIRECT                    = 110;
  700.   INTERNET_STATUS_INTERMEDIATE_RESPONSE       = 120;
  701.   INTERNET_STATUS_STATE_CHANGE                = 200;
  702.  
  703. { the following can be indicated in a state change notification: }
  704.   INTERNET_STATE_CONNECTED                    = 00000001;  { connected state (mutually exclusive with disconnected) }
  705.   INTERNET_STATE_DISCONNECTED                 = 00000002;  { disconnected from network }
  706.   INTERNET_STATE_DISCONNECTED_BY_USER         = 00000010;  { disconnected by user request }
  707.   INTERNET_STATE_IDLE                         = 00000100;  { no network requests being made (by Wininet) }
  708.   INTERNET_STATE_BUSY                         = 00000200;  { network requests being made (by Wininet) }
  709.  
  710. { if the following value is returned by InternetSetStatusCallback, then }
  711. { probably an invalid (non-code) address was supplied for the callback }
  712.  
  713.   INTERNET_INVALID_STATUS_CALLBACK = (-1);
  714.  
  715.  
  716. { prototypes }
  717.  
  718. function FtpFindFirstFileA(hConnect: HINTERNET; lpszSearchFile: PAnsiChar;
  719.   var lpFindFileData: TWin32FindDataA; dwFlags: DWORD;
  720.   dwContext: DWORD): HINTERNET; stdcall;
  721. function FtpFindFirstFileW(hConnect: HINTERNET; lpszSearchFile: PWideChar;
  722.   var lpFindFileData: TWin32FindDataW; dwFlags: DWORD;
  723.   dwContext: DWORD): HINTERNET; stdcall;
  724. function FtpFindFirstFile(hConnect: HINTERNET; lpszSearchFile: PChar;
  725.   var lpFindFileData: TWin32FindData; dwFlags: DWORD;
  726.   dwContext: DWORD): HINTERNET; stdcall;
  727.  
  728. function FtpGetFileA(hConnect: HINTERNET; lpszRemoteFile: PAnsiChar;
  729.   lpszNewFile: PAnsiChar; fFailIfExists: BOOL; dwFlagsAndAttributes: DWORD;
  730.   dwFlags: DWORD; dwContext: DWORD): BOOL stdcall;
  731. function FtpGetFileW(hConnect: HINTERNET; lpszRemoteFile: PWideChar;
  732.   lpszNewFile: PWideChar; fFailIfExists: BOOL; dwFlagsAndAttributes: DWORD;
  733.   dwFlags: DWORD; dwContext: DWORD): BOOL stdcall;
  734. function FtpGetFile(hConnect: HINTERNET; lpszRemoteFile: PChar;
  735.   lpszNewFile: PChar; fFailIfExists: BOOL; dwFlagsAndAttributes: DWORD;
  736.   dwFlags: DWORD; dwContext: DWORD): BOOL stdcall;
  737.  
  738. function FtpPutFileA(hConnect: HINTERNET; lpszLocalFile: PAnsiChar;
  739.   lpszNewRemoteFile: PAnsiChar; dwFlags: DWORD; dwContext: DWORD): BOOL; stdcall;
  740. function FtpPutFileW(hConnect: HINTERNET; lpszLocalFile: PWideChar;
  741.   lpszNewRemoteFile: PWideChar; dwFlags: DWORD; dwContext: DWORD): BOOL; stdcall;
  742. function FtpPutFile(hConnect: HINTERNET; lpszLocalFile: PChar;
  743.   lpszNewRemoteFile: PChar; dwFlags: DWORD; dwContext: DWORD): BOOL; stdcall;
  744.  
  745. function FtpDeleteFileA(hConnect: HINTERNET; lpszFileName: PAnsiChar): BOOL; stdcall;
  746. function FtpDeleteFileW(hConnect: HINTERNET; lpszFileName: PWideChar): BOOL; stdcall;
  747. function FtpDeleteFile(hConnect: HINTERNET; lpszFileName: PChar): BOOL; stdcall;
  748.  
  749. function FtpRenameFileA(hConnect: HINTERNET; lpszExisting: PAnsiChar;
  750.   lpszNew: PAnsiChar): BOOL; stdcall;
  751. function FtpRenameFileW(hConnect: HINTERNET; lpszExisting: PWideChar;
  752.   lpszNew: PWideChar): BOOL; stdcall;
  753. function FtpRenameFile(hConnect: HINTERNET; lpszExisting: PChar;
  754.   lpszNew: PChar): BOOL; stdcall;
  755.  
  756. function FtpOpenFileA(hConnect: HINTERNET; lpszFileName: PAnsiChar;
  757.   dwAccess: DWORD; dwFlags: DWORD; dwContext: DWORD): HINTERNET; stdcall;
  758. function FtpOpenFileW(hConnect: HINTERNET; lpszFileName: PWideChar;
  759.   dwAccess: DWORD; dwFlags: DWORD; dwContext: DWORD): HINTERNET; stdcall;
  760. function FtpOpenFile(hConnect: HINTERNET; lpszFileName: PChar;
  761.   dwAccess: DWORD; dwFlags: DWORD; dwContext: DWORD): HINTERNET; stdcall;
  762.  
  763. function FtpCreateDirectoryA(hConnect: HINTERNET; lpszDirectory: PAnsiChar): BOOL; stdcall;
  764. function FtpCreateDirectoryW(hConnect: HINTERNET; lpszDirectory: PWideChar): BOOL; stdcall;
  765. function FtpCreateDirectory(hConnect: HINTERNET; lpszDirectory: PChar): BOOL; stdcall;
  766.  
  767. function FtpRemoveDirectoryA(hConnect: HINTERNET; lpszDirectory: PAnsiChar): BOOL; stdcall;
  768. function FtpRemoveDirectoryW(hConnect: HINTERNET; lpszDirectory: PWideChar): BOOL; stdcall;
  769. function FtpRemoveDirectory(hConnect: HINTERNET; lpszDirectory: PChar): BOOL; stdcall;
  770.  
  771. function FtpSetCurrentDirectoryA(hConnect: HINTERNET; lpszDirectory: PAnsiChar): BOOL; stdcall;
  772. function FtpSetCurrentDirectoryW(hConnect: HINTERNET; lpszDirectory: PWideChar): BOOL; stdcall;
  773. function FtpSetCurrentDirectory(hConnect: HINTERNET; lpszDirectory: PChar): BOOL; stdcall;
  774.  
  775. function FtpGetCurrentDirectoryA(hConnect: HINTERNET;
  776.   lpszCurrentDirectory: PAnsiChar; var lpdwCurrentDirectory: DWORD): BOOL; stdcall;
  777. function FtpGetCurrentDirectoryW(hConnect: HINTERNET;
  778.   lpszCurrentDirectory: PWideChar; var lpdwCurrentDirectory: DWORD): BOOL; stdcall;
  779. function FtpGetCurrentDirectory(hConnect: HINTERNET;
  780.   lpszCurrentDirectory: PChar; var lpdwCurrentDirectory: DWORD): BOOL; stdcall;
  781.  
  782. function FtpCommandA(hConnect: HINTERNET; fExpectResponse: BOOL;
  783.   dwFlags: DWORD; lpszCommand: PAnsiChar; dwContext: DWORD): BOOL; stdcall;
  784. function FtpCommandW(hConnect: HINTERNET; fExpectResponse: BOOL;
  785.   dwFlags: DWORD; lpszCommand: PWideChar; dwContext: DWORD): BOOL; stdcall;
  786. function FtpCommand(hConnect: HINTERNET; fExpectResponse: BOOL;
  787.   dwFlags: DWORD; lpszCommand: PChar; dwContext: DWORD): BOOL; stdcall;
  788.  
  789.  
  790. { Gopher }
  791.  
  792. { manifests }
  793.  
  794. { string field lengths (in characters, not bytes) }
  795. const
  796.   MAX_GOPHER_DISPLAY_TEXT   = 128;
  797.   MAX_GOPHER_SELECTOR_TEXT  = 256;
  798.   MAX_GOPHER_HOST_NAME      = INTERNET_MAX_HOST_NAME_LENGTH;
  799.   MAX_GOPHER_LOCATOR_LENGTH = 1
  800.                               + MAX_GOPHER_DISPLAY_TEXT
  801.                               + 1
  802.                               + MAX_GOPHER_SELECTOR_TEXT
  803.                               + 1
  804.                               + MAX_GOPHER_HOST_NAME
  805.                               + 1
  806.                               + INTERNET_MAX_PORT_NUMBER_LENGTH
  807.                               + 1
  808.                               + 1
  809.                               + 2;
  810.  
  811.  
  812. { structures/types }
  813.  
  814. { GOPHER_FIND_DATA - returns the results of a GopherFindFirstFile/ }
  815. { InternetFindNextFile request }
  816.  
  817.  
  818. type
  819.   PGopherFindDataA = ^TGopherFindDataA;
  820.   PGopherFindDataW = ^TGopherFindDataW;
  821.   PGopherFindData = PGopherFindDataA;
  822.   TGopherFindDataA = record
  823.     DisplayString: packed array[0..MAX_GOPHER_DISPLAY_TEXT-1] of AnsiChar;
  824.     GopherType: DWORD;  { GopherType - if known }
  825.     SizeLow: DWORD;
  826.     SizeHigh: DWORD;
  827.     LastModificationTime: TFileTime;
  828.     Locator: packed array[0..MAX_GOPHER_LOCATOR_LENGTH-1] of AnsiChar;
  829.   end;
  830.   TGopherFindDataW = record
  831.     DisplayString: packed array[0..MAX_GOPHER_DISPLAY_TEXT-1] of WideChar;
  832.     GopherType: DWORD;  { GopherType - if known }
  833.     SizeLow: DWORD;
  834.     SizeHigh: DWORD;
  835.     LastModificationTime: TFileTime;
  836.     Locator: packed array[0..MAX_GOPHER_LOCATOR_LENGTH-1] of WideChar;
  837.   end;
  838.   TGopherFindData = TGopherFindDataA;
  839.  
  840.  
  841. { manifests for GopherType }
  842. const
  843.   GOPHER_TYPE_TEXT_FILE = $00000001;
  844.   GOPHER_TYPE_DIRECTORY = $00000002;
  845.   GOPHER_TYPE_CSO = $00000004;
  846.   GOPHER_TYPE_ERROR = $00000008;
  847.   GOPHER_TYPE_MAC_BINHEX = $00000010;
  848.   GOPHER_TYPE_DOS_ARCHIVE = $00000020;
  849.   GOPHER_TYPE_UNIX_UUENCODED = $00000040;
  850.   GOPHER_TYPE_INDEX_SERVER = $00000080;
  851.   GOPHER_TYPE_TELNET = $00000100;
  852.   GOPHER_TYPE_BINARY = $00000200;
  853.   GOPHER_TYPE_REDUNDANT = $00000400;
  854.   GOPHER_TYPE_TN3270 = $00000800;
  855.   GOPHER_TYPE_GIF = $00001000;
  856.   GOPHER_TYPE_IMAGE = $00002000;
  857.   GOPHER_TYPE_BITMAP = $00004000;
  858.   GOPHER_TYPE_MOVIE = $00008000;
  859.   GOPHER_TYPE_SOUND = $00010000;
  860.   GOPHER_TYPE_HTML = $00020000;
  861.   GOPHER_TYPE_PDF = $00040000;
  862.   GOPHER_TYPE_CALENDAR = $00080000;
  863.   GOPHER_TYPE_INLINE = $00100000;
  864.   GOPHER_TYPE_UNKNOWN = $20000000;
  865.   GOPHER_TYPE_ASK = $40000000;
  866.   GOPHER_TYPE_GOPHER_PLUS = $80000000;
  867.  
  868.  
  869. { Gopher Type functions }
  870.  
  871. function IS_GOPHER_FILE(GopherType: DWORD): BOOL;
  872. function IS_GOPHER_DIRECTORY(GopherType: DWORD): BOOL;
  873. function IS_GOPHER_PHONE_SERVER(GopherType: DWORD): BOOL;
  874. function IS_GOPHER_ERROR(GopherType: DWORD): BOOL;
  875. function IS_GOPHER_INDEX_SERVER(GopherType: DWORD): BOOL;
  876. function IS_GOPHER_TELNET_SESSION(GopherType: DWORD): BOOL;
  877. function IS_GOPHER_BACKUP_SERVER(GopherType: DWORD): BOOL;
  878. function IS_GOPHER_TN3270_SESSION(GopherType: DWORD): BOOL;
  879. function IS_GOPHER_ASK(GopherType: DWORD): BOOL;
  880. function IS_GOPHER_PLUS(GopherType: DWORD): BOOL;
  881. function IS_GOPHER_TYPE_KNOWN(GopherType: DWORD): BOOL;
  882.  
  883.  
  884. { GOPHER_TYPE_FILE_MASK - use this to determine if a locator identifies a }
  885. { (known) file type }
  886. const
  887.   GOPHER_TYPE_FILE_MASK = GOPHER_TYPE_TEXT_FILE
  888.                           or GOPHER_TYPE_MAC_BINHEX
  889.                           or GOPHER_TYPE_DOS_ARCHIVE
  890.                           or GOPHER_TYPE_UNIX_UUENCODED
  891.                           or GOPHER_TYPE_BINARY
  892.                           or GOPHER_TYPE_GIF
  893.                           or GOPHER_TYPE_IMAGE
  894.                           or GOPHER_TYPE_BITMAP
  895.                           or GOPHER_TYPE_MOVIE
  896.                           or GOPHER_TYPE_SOUND
  897.                           or GOPHER_TYPE_HTML
  898.                           or GOPHER_TYPE_PDF
  899.                           or GOPHER_TYPE_CALENDAR
  900.                           or GOPHER_TYPE_INLINE;
  901.  
  902.  
  903. { structured gopher attributes (as defined in gopher+ protocol document) }
  904. type
  905.   PGopherAdminAttributeType = ^TGopherAdminAttributeType;
  906.   TGopherAdminAttributeType = record
  907.     Comment: LPCSTR;
  908.     EmailAddress: LPCSTR;
  909.   end;
  910.  
  911.   PGopherModDateAttributeType = ^TGopherModDateAttributeType;
  912.   TGopherModDateAttributeType = record
  913.     DateAndTime: TFileTime;
  914.   end;
  915.  
  916.   PGopherTtlAttributeType = ^TGopherTtlAttributeType;
  917.   TGopherTtlAttributeType = record
  918.     Ttl: DWORD;
  919.   end;
  920.  
  921.   PGopherScoreAttributeType = ^TGopherScoreAttributeType;
  922.   TGopherScoreAttributeType = record
  923.     Score: Integer;
  924.   end;
  925.  
  926.   PGopherScoreRangeAttributeType = ^TGopherScoreRangeAttributeType;
  927.   TGopherScoreRangeAttributeType = record
  928.     LowerBound: Integer;
  929.     UpperBound: Integer;
  930.   end;
  931.  
  932.   PGopherSiteAttributeType = ^TGopherSiteAttributeType;
  933.   TGopherSiteAttributeType = record
  934.     Site: LPCSTR;
  935.   end;
  936.  
  937.   PGopherOrganizationAttributeType = ^TGopherOrganizationAttributeType;
  938.   TGopherOrganizationAttributeType = record
  939.     Organization: LPCSTR;
  940.   end;
  941.  
  942.   PGopherLocationAttributeType = ^TGopherLocationAttributeType;
  943.   TGopherLocationAttributeType = record
  944.     Location: LPCSTR;
  945.   end;
  946.  
  947.   PGopherGeographicalLocationAttributeType = ^TGopherGeographicalLocationAttributeType;
  948.   TGopherGeographicalLocationAttributeType = record
  949.     DegreesNorth: Integer;
  950.     MinutesNorth: Integer;
  951.     SecondsNorth: Integer;
  952.     DegreesEast: Integer;
  953.     MinutesEast: Integer;
  954.     SecondsEast: Integer;
  955.   end;
  956.  
  957.   PGopherTimezoneAttributeType = ^TGopherTimezoneAttributeType;
  958.   TGopherTimezoneAttributeType = record
  959.     Zone: Integer;
  960.   end;
  961.  
  962.   PGopherProviderAttributeType = ^TGopherProviderAttributeType;
  963.   TGopherProviderAttributeType = record
  964.     Provider: LPCSTR;
  965.   end;
  966.  
  967.   PGopherVersionAttributeType = ^TGopherVersionAttributeType;
  968.   TGopherVersionAttributeType = record
  969.     Version: LPCSTR;
  970.   end;
  971.  
  972.   PGopherAbstractAttributeType = ^TGopherAbstractAttributeType;
  973.   TGopherAbstractAttributeType = record
  974.     ShortAbstract: LPCSTR;
  975.     AbstractFile: LPCSTR;
  976.   end;
  977.  
  978.   PGopherViewAttributeType = ^TGopherViewAttributeType;
  979.   TGopherViewAttributeType = record
  980.     ContentType: LPCSTR;
  981.     Language: LPCSTR;
  982.     Size: DWORD;
  983.   end;
  984.  
  985.   PGopherVeronicaAttributeType = ^TGopherVeronicaAttributeType;
  986.   TGopherVeronicaAttributeType = record
  987.     TreeWalk: BOOL;
  988.   end;
  989.  
  990.   PGopherAskAttributeType = ^TGopherAskAttributeType;
  991.   TGopherAskAttributeType = record
  992.     QuestionType: LPCSTR;
  993.     QuestionText: LPCSTR;
  994.   end;
  995.  
  996.  
  997. { GOPHER_UNKNOWN_ATTRIBUTE_TYPE - this is returned if we retrieve an attribute }
  998. { that is not specified in the current gopher/gopher+ documentation. It is up }
  999. { to the application to parse the information }
  1000.  
  1001.   PGopherUnknownAttributeType = ^TGopherUnknownAttributeType;
  1002.   TGopherUnknownAttributeType = record
  1003.     Text: LPCSTR;
  1004.   end;
  1005.  
  1006.  
  1007. { GOPHER_ATTRIBUTE_TYPE - returned in the user's buffer when an enumerated }
  1008. { GopherGetAttribute call is made }
  1009.  
  1010.   PGopherAttributeType = ^TGopherAttributeType;
  1011.   TGopherAttributeType = record
  1012.     CategoryId: DWORD;  { e.g. GOPHER_CATEGORY_ID_ADMIN }
  1013.     AttributeId: DWORD; { e.g. GOPHER_ATTRIBUTE_ID_ADMIN }
  1014.     case Integer of
  1015.       0: (Admin: TGopherAdminAttributeType);
  1016.       1: (ModDate: TGopherModDateAttributeType);
  1017.       2: (Ttl: TGopherTtlAttributeType);
  1018.       3: (Score: TGopherScoreAttributeType);
  1019.       4: (ScoreRange: TGopherScoreRangeAttributeType);
  1020.       5: (Site: TGopherSiteAttributeType);
  1021.       6: (Organization: TGopherOrganizationAttributeType);
  1022.       7: (Location: TGopherLocationAttributeType);
  1023.       8: (GeographicalLocation: TGopherGeographicalLocationAttributeType);
  1024.       9: (TimeZone: TGopherTimezoneAttributeType);
  1025.       10: (Provider: TGopherProviderAttributeType);
  1026.       11: (Version: TGopherVersionAttributeType);
  1027.       12: (AbstractType: TGopherAbstractAttributeType);
  1028.       13: (View: TGopherViewAttributeType);
  1029.       14: (Veronica: TGopherVeronicaAttributeType);
  1030.       15: (Ask: TGopherAskAttributeType);
  1031.       16: (Unknown: TGopherUnknownAttributeType);
  1032.     end;
  1033.  
  1034. const
  1035.   MAX_GOPHER_CATEGORY_NAME = 128;           { arbitrary }
  1036.   MAX_GOPHER_ATTRIBUTE_NAME = 128;          {     " }
  1037.   MIN_GOPHER_ATTRIBUTE_LENGTH = 256;        {     " }
  1038.  
  1039.  
  1040. { known gopher attribute categories. See below for ordinals }
  1041.  
  1042.   GOPHER_INFO_CATEGORY           = '+INFO';
  1043.   GOPHER_ADMIN_CATEGORY          = '+ADMIN';
  1044.   GOPHER_VIEWS_CATEGORY          = '+VIEWS';
  1045.   GOPHER_ABSTRACT_CATEGORY       = '+ABSTRACT';
  1046.   GOPHER_VERONICA_CATEGORY       = '+VERONICA';
  1047.  
  1048.  
  1049. { known gopher attributes. These are the attribute names as defined in the }
  1050. { gopher+ protocol document }
  1051.  
  1052.   GOPHER_ADMIN_ATTRIBUTE         = 'Admin';
  1053.   GOPHER_MOD_DATE_ATTRIBUTE      = 'Mod-Date';
  1054.   GOPHER_TTL_ATTRIBUTE           = 'TTL';
  1055.   GOPHER_SCORE_ATTRIBUTE         = 'Score';
  1056.   GOPHER_RANGE_ATTRIBUTE         = 'Score-range';
  1057.   GOPHER_SITE_ATTRIBUTE          = 'Site';
  1058.   GOPHER_ORG_ATTRIBUTE           = 'Org';
  1059.   GOPHER_LOCATION_ATTRIBUTE      = 'Loc';
  1060.   GOPHER_GEOG_ATTRIBUTE          = 'Geog';
  1061.   GOPHER_TIMEZONE_ATTRIBUTE      = 'TZ';
  1062.   GOPHER_PROVIDER_ATTRIBUTE      = 'Provider';
  1063.   GOPHER_VERSION_ATTRIBUTE       = 'Version';
  1064.   GOPHER_ABSTRACT_ATTRIBUTE      = 'Abstract';
  1065.   GOPHER_VIEW_ATTRIBUTE          = 'View';
  1066.   GOPHER_TREEWALK_ATTRIBUTE      = 'treewalk';
  1067.  
  1068.  
  1069. { identifiers for attribute strings }
  1070.  
  1071.   GOPHER_ATTRIBUTE_ID_BASE = $abcccc00;
  1072.   GOPHER_CATEGORY_ID_ALL = GOPHER_ATTRIBUTE_ID_BASE + 1;
  1073.   GOPHER_CATEGORY_ID_INFO = GOPHER_ATTRIBUTE_ID_BASE + 2;
  1074.   GOPHER_CATEGORY_ID_ADMIN = GOPHER_ATTRIBUTE_ID_BASE + 3;
  1075.   GOPHER_CATEGORY_ID_VIEWS = GOPHER_ATTRIBUTE_ID_BASE + 4;
  1076.   GOPHER_CATEGORY_ID_ABSTRACT = GOPHER_ATTRIBUTE_ID_BASE + 5;
  1077.   GOPHER_CATEGORY_ID_VERONICA = GOPHER_ATTRIBUTE_ID_BASE + 6;
  1078.   GOPHER_CATEGORY_ID_ASK = GOPHER_ATTRIBUTE_ID_BASE + 7;
  1079.   GOPHER_CATEGORY_ID_UNKNOWN = GOPHER_ATTRIBUTE_ID_BASE + 8;
  1080.   GOPHER_ATTRIBUTE_ID_ALL = GOPHER_ATTRIBUTE_ID_BASE + 9;
  1081.   GOPHER_ATTRIBUTE_ID_ADMIN = GOPHER_ATTRIBUTE_ID_BASE + 10;
  1082.   GOPHER_ATTRIBUTE_ID_MOD_DATE = GOPHER_ATTRIBUTE_ID_BASE + 11;
  1083.   GOPHER_ATTRIBUTE_ID_TTL = GOPHER_ATTRIBUTE_ID_BASE + 12;
  1084.   GOPHER_ATTRIBUTE_ID_SCORE = GOPHER_ATTRIBUTE_ID_BASE + 13;
  1085.   GOPHER_ATTRIBUTE_ID_RANGE = GOPHER_ATTRIBUTE_ID_BASE + 14;
  1086.   GOPHER_ATTRIBUTE_ID_SITE = GOPHER_ATTRIBUTE_ID_BASE + 15;
  1087.   GOPHER_ATTRIBUTE_ID_ORG = GOPHER_ATTRIBUTE_ID_BASE + 16;
  1088.   GOPHER_ATTRIBUTE_ID_LOCATION = GOPHER_ATTRIBUTE_ID_BASE + 17;
  1089.   GOPHER_ATTRIBUTE_ID_GEOG = GOPHER_ATTRIBUTE_ID_BASE + 18;
  1090.   GOPHER_ATTRIBUTE_ID_TIMEZONE = GOPHER_ATTRIBUTE_ID_BASE + 19;
  1091.   GOPHER_ATTRIBUTE_ID_PROVIDER = GOPHER_ATTRIBUTE_ID_BASE + 20;
  1092.   GOPHER_ATTRIBUTE_ID_VERSION = GOPHER_ATTRIBUTE_ID_BASE + 21;
  1093.   GOPHER_ATTRIBUTE_ID_ABSTRACT = GOPHER_ATTRIBUTE_ID_BASE + 22;
  1094.   GOPHER_ATTRIBUTE_ID_VIEW = GOPHER_ATTRIBUTE_ID_BASE + 23;
  1095.   GOPHER_ATTRIBUTE_ID_TREEWALK = GOPHER_ATTRIBUTE_ID_BASE + 24;
  1096.   GOPHER_ATTRIBUTE_ID_UNKNOWN = GOPHER_ATTRIBUTE_ID_BASE + 25;
  1097.  
  1098.  
  1099. { prototypes }
  1100.  
  1101. function GopherCreateLocatorA(lpszHost: PAnsiChar; nServerPort: INTERNET_PORT;
  1102.   lpszDisplayString: PAnsiChar; lpszSelectorString: PAnsiChar; dwGopherType: DWORD;
  1103.   lpszLocator: PAnsiChar; var lpdwBufferLength: DWORD): BOOL; stdcall;
  1104. function GopherCreateLocatorW(lpszHost: PWideChar; nServerPort: INTERNET_PORT;
  1105.   lpszDisplayString: PWideChar; lpszSelectorString: PWideChar; dwGopherType: DWORD;
  1106.   lpszLocator: PWideChar; var lpdwBufferLength: DWORD): BOOL; stdcall;
  1107. function GopherCreateLocator(lpszHost: PChar; nServerPort: INTERNET_PORT;
  1108.   lpszDisplayString: PChar; lpszSelectorString: PChar; dwGopherType: DWORD;
  1109.   lpszLocator: PChar; var lpdwBufferLength: DWORD): BOOL; stdcall;
  1110.  
  1111. function GopherGetLocatorTypeA(lpszLocator: PAnsiChar;
  1112.   var lpdwGopherType: DWORD): BOOL; stdcall;
  1113. function GopherGetLocatorTypeW(lpszLocator: PWideChar;
  1114.   var lpdwGopherType: DWORD): BOOL; stdcall;
  1115. function GopherGetLocatorType(lpszLocator: PChar;
  1116.   var lpdwGopherType: DWORD): BOOL; stdcall;
  1117.  
  1118. function GopherFindFirstFileA(hConnect: HINTERNET; lpszLocator: PAnsiChar;
  1119.   lpszSearchString: PAnsiChar; var lpFindData: TGopherFindDataA; dwFlags: DWORD;
  1120.   dwContext: DWORD): HINTERNET; stdcall;
  1121. function GopherFindFirstFileW(hConnect: HINTERNET; lpszLocator: PWideChar;
  1122.   lpszSearchString: PWideChar; var lpFindData: TGopherFindDataW; dwFlags: DWORD;
  1123.   dwContext: DWORD): HINTERNET; stdcall;
  1124. function GopherFindFirstFile(hConnect: HINTERNET; lpszLocator: PChar;
  1125.   lpszSearchString: PChar; var lpFindData: TGopherFindData; dwFlags: DWORD;
  1126.   dwContext: DWORD): HINTERNET; stdcall;
  1127.  
  1128. function GopherOpenFileA(hConnect: HINTERNET; lpszLocator: PAnsiChar;
  1129.   lpszView: PAnsiChar; dwFlags: DWORD; dwContext: DWORD): HINTERNET; stdcall;
  1130. function GopherOpenFileW(hConnect: HINTERNET; lpszLocator: PWideChar;
  1131.   lpszView: PWideChar; dwFlags: DWORD; dwContext: DWORD): HINTERNET; stdcall;
  1132. function GopherOpenFile(hConnect: HINTERNET; lpszLocator: PChar;
  1133.   lpszView: PChar; dwFlags: DWORD; dwContext: DWORD): HINTERNET; stdcall;
  1134.  
  1135. type
  1136.   TFNGopherAttributeEnumerator = TFarProc;
  1137.   PFNGopherAttributeEnumerator = ^TFNGopherAttributeEnumerator;
  1138.  
  1139. function GopherGetAttributeA(hConnect: HINTERNET; lpszLocator: PAnsiChar;
  1140.   lpszAttributeName: PAnsiChar; lpBuffer: Pointer; dwBufferLength: DWORD;
  1141.   var lpdwCharactersReturned: DWORD; lpfnEnumerator: PFNGopherAttributeEnumerator;
  1142.   dwContext: DWORD): BOOL; stdcall;
  1143. function GopherGetAttributeW(hConnect: HINTERNET; lpszLocator: PWideChar;
  1144.   lpszAttributeName: PWideChar; lpBuffer: Pointer; dwBufferLength: DWORD;
  1145.   var lpdwCharactersReturned: DWORD; lpfnEnumerator: PFNGopherAttributeEnumerator;
  1146.   dwContext: DWORD): BOOL; stdcall;
  1147. function GopherGetAttribute(hConnect: HINTERNET; lpszLocator: PChar;
  1148.   lpszAttributeName: PChar; lpBuffer: Pointer; dwBufferLength: DWORD;
  1149.   var lpdwCharactersReturned: DWORD; lpfnEnumerator: PFNGopherAttributeEnumerator;
  1150.   dwContext: DWORD): BOOL; stdcall;
  1151.  
  1152. { HTTP }
  1153.  
  1154. { manifests }
  1155.  
  1156. const
  1157. { the default major/minor HTTP version numbers }
  1158.  
  1159.   HTTP_MAJOR_VERSION = 1;
  1160.   HTTP_MINOR_VERSION = 0;
  1161.   HTTP_VERSION       = 'HTTP/1.0';
  1162.  
  1163.  
  1164. { HttpQueryInfo info levels. Generally, there is one info level }
  1165. { for each potential RFC822/HTTP/MIME header that an HTTP server }
  1166. { may send as part of a request response. }
  1167.  
  1168. { The HTTP_QUERY_RAW_HEADERS info level is provided for clients }
  1169. { that choose to perform their own header parsing. }
  1170.  
  1171.   HTTP_QUERY_MIME_VERSION                     = 0;
  1172.   HTTP_QUERY_CONTENT_TYPE                     = 1;
  1173.   HTTP_QUERY_CONTENT_TRANSFER_ENCODING        = 2;
  1174.   HTTP_QUERY_CONTENT_ID                       = 3;
  1175.   HTTP_QUERY_CONTENT_DESCRIPTION              = 4;
  1176.   HTTP_QUERY_CONTENT_LENGTH                   = 5;
  1177.   HTTP_QUERY_CONTENT_LANGUAGE                 = 6;
  1178.   HTTP_QUERY_ALLOW                            = 7;
  1179.   HTTP_QUERY_PUBLIC                           = 8;
  1180.   HTTP_QUERY_DATE                             = 9;
  1181.   HTTP_QUERY_EXPIRES                          = 10;
  1182.   HTTP_QUERY_LAST_MODIFIED                    = 11;
  1183.   HTTP_QUERY_MESSAGE_ID                       = 12;
  1184.   HTTP_QUERY_URI                              = 13;
  1185.   HTTP_QUERY_DERIVED_FROM                     = 14;
  1186.   HTTP_QUERY_COST                             = 15;
  1187.   HTTP_QUERY_LINK                             = 16;
  1188.   HTTP_QUERY_PRAGMA                           = 17;
  1189.   HTTP_QUERY_VERSION                          = 18; { special: part of status line }
  1190.   HTTP_QUERY_STATUS_CODE                      = 19; { special: part of status line }
  1191.   HTTP_QUERY_STATUS_TEXT                      = 20; { special: part of status line }
  1192.   HTTP_QUERY_RAW_HEADERS                      = 21; { special: all headers as ASCIIZ }
  1193.   HTTP_QUERY_RAW_HEADERS_CRLF                 = 22; { special: all headers }
  1194.   HTTP_QUERY_CONNECTION                       = 23;
  1195.   HTTP_QUERY_ACCEPT                           = 24;
  1196.   HTTP_QUERY_ACCEPT_CHARSET                   = 25;
  1197.   HTTP_QUERY_ACCEPT_ENCODING                  = 26;
  1198.   HTTP_QUERY_ACCEPT_LANGUAGE                  = 27;
  1199.   HTTP_QUERY_AUTHORIZATION                    = 28;
  1200.   HTTP_QUERY_CONTENT_ENCODING                 = 29;
  1201.   HTTP_QUERY_FORWARDED                        = 30;
  1202.   HTTP_QUERY_FROM                             = 31;
  1203.   HTTP_QUERY_IF_MODIFIED_SINCE                = 32;
  1204.   HTTP_QUERY_LOCATION                         = 33;
  1205.   HTTP_QUERY_ORIG_URI                         = 34;
  1206.   HTTP_QUERY_REFERER                          = 35;
  1207.   HTTP_QUERY_RETRY_AFTER                      = 36;
  1208.   HTTP_QUERY_SERVER                           = 37;
  1209.   HTTP_QUERY_TITLE                            = 38;
  1210.   HTTP_QUERY_USER_AGENT                       = 39;
  1211.   HTTP_QUERY_WWW_AUTHENTICATE                 = 40;
  1212.   HTTP_QUERY_PROXY_AUTHENTICATE               = 41;
  1213.   HTTP_QUERY_ACCEPT_RANGES                    = 42;
  1214.   HTTP_QUERY_SET_COOKIE                       = 43;
  1215.   HTTP_QUERY_COOKIE                           = 44;
  1216.   HTTP_QUERY_REQUEST_METHOD                   = 45;  { special: GET/POST etc. }
  1217.   HTTP_QUERY_REFRESH                          = 46;
  1218.   HTTP_QUERY_CONTENT_DISPOSITION              = 47;
  1219.  
  1220. { HTTP 1.1 defined headers }
  1221.  
  1222.   HTTP_QUERY_AGE                              = 48;
  1223.   HTTP_QUERY_CACHE_CONTROL                    = 49;
  1224.   HTTP_QUERY_CONTENT_BASE                     = 50;
  1225.   HTTP_QUERY_CONTENT_LOCATION                 = 51;
  1226.   HTTP_QUERY_CONTENT_MD5                      = 52;
  1227.   HTTP_QUERY_CONTENT_RANGE                    = 53;
  1228.   HTTP_QUERY_ETAG                             = 54;
  1229.   HTTP_QUERY_HOST                             = 55;
  1230.   HTTP_QUERY_IF_MATCH                         = 56;
  1231.   HTTP_QUERY_IF_NONE_MATCH                    = 57;
  1232.   HTTP_QUERY_IF_RANGE                         = 58;
  1233.   HTTP_QUERY_IF_UNMODIFIED_SINCE              = 59;
  1234.   HTTP_QUERY_MAX_FORWARDS                     = 60;
  1235.   HTTP_QUERY_PROXY_AUTHORIZATION              = 61;
  1236.   HTTP_QUERY_RANGE                            = 62;
  1237.   HTTP_QUERY_TRANSFER_ENCODING                = 63;
  1238.   HTTP_QUERY_UPGRADE                          = 64;
  1239.   HTTP_QUERY_VARY                             = 65;
  1240.   HTTP_QUERY_VIA                              = 66;
  1241.   HTTP_QUERY_WARNING                          = 67;
  1242.  
  1243.   HTTP_QUERY_MAX                              = 67;
  1244.  
  1245.  
  1246. { HTTP_QUERY_CUSTOM - if this special value is supplied as the dwInfoLevel }
  1247. { parameter of HttpQueryInfo then the lpBuffer parameter contains the name }
  1248. { of the header we are to query }
  1249.   HTTP_QUERY_CUSTOM                           = 65535;
  1250.  
  1251. { HTTP_QUERY_FLAG_REQUEST_HEADERS - if this bit is set in the dwInfoLevel }
  1252. { parameter of HttpQueryInfo then the request headers will be queried for the }
  1253. { request information }
  1254.   HTTP_QUERY_FLAG_REQUEST_HEADERS             = $80000000;
  1255.  
  1256. { HTTP_QUERY_FLAG_SYSTEMTIME - if this bit is set in the dwInfoLevel parameter }
  1257. { of HttpQueryInfo AND the header being queried contains date information, }
  1258. { e.g. the "Expires:" header then lpBuffer will contain a SYSTEMTIME structure }
  1259. { containing the date and time information converted from the header string }
  1260.   HTTP_QUERY_FLAG_SYSTEMTIME                  = $40000000;
  1261.  
  1262. { HTTP_QUERY_FLAG_NUMBER - if this bit is set in the dwInfoLevel parameter of }
  1263. { HttpQueryInfo, then the value of the header will be converted to a number }
  1264. { before being returned to the caller, if applicable }
  1265.   HTTP_QUERY_FLAG_NUMBER                      = $20000000; 
  1266.  
  1267. { HTTP_QUERY_FLAG_COALESCE - combine the values from several headers of the }
  1268. { same name into the output buffer }
  1269.   HTTP_QUERY_FLAG_COALESCE                    = $10000000; 
  1270.  
  1271.   HTTP_QUERY_MODIFIER_FLAGS_MASK              = HTTP_QUERY_FLAG_REQUEST_HEADERS or
  1272.                                                 HTTP_QUERY_FLAG_SYSTEMTIME or
  1273.                                                 HTTP_QUERY_FLAG_NUMBER or
  1274.                                                 HTTP_QUERY_FLAG_COALESCE; 
  1275.  
  1276.   HTTP_QUERY_HEADER_MASK                      = not HTTP_QUERY_MODIFIER_FLAGS_MASK; 
  1277.  
  1278.   
  1279. {  HTTP Response Status Codes: }
  1280.   HTTP_STATUS_CONTINUE            = 100;    { OK to continue with request }
  1281.   HTTP_STATUS_SWITCH_PROTOCOLS    = 101;    { server has switched protocols in upgrade header }
  1282.  
  1283.   HTTP_STATUS_OK                  = 200;    { request completed }
  1284.   HTTP_STATUS_CREATED             = 201;    { object created, reason = new URI }
  1285.   HTTP_STATUS_ACCEPTED            = 202;    { async completion (TBS) }
  1286.   HTTP_STATUS_PARTIAL             = 203;    { partial completion }
  1287.   HTTP_STATUS_NO_CONTENT          = 204;    { no info to return }
  1288.   HTTP_STATUS_RESET_CONTENT       = 205;    { request completed, but clear form }
  1289.   HTTP_STATUS_PARTIAL_CONTENT     = 206;    { partial GET furfilled }
  1290.  
  1291.   HTTP_STATUS_AMBIGUOUS           = 300;    { server couldn't decide what to return }
  1292.   HTTP_STATUS_MOVED               = 301;    { object permanently moved }
  1293.   HTTP_STATUS_REDIRECT            = 302;    { object temporarily moved }
  1294.   HTTP_STATUS_REDIRECT_METHOD     = 303;    { redirection w/ new access method }
  1295.   HTTP_STATUS_NOT_MODIFIED        = 304;    { if-modified-since was not modified }
  1296.   HTTP_STATUS_USE_PROXY           = 305;    { redirection to proxy, location header specifies proxy to use }
  1297.   HTTP_STATUS_REDIRECT_KEEP_VERB  = 307;    { HTTP/1.1: keep same verb }
  1298.  
  1299.   HTTP_STATUS_BAD_REQUEST         = 400;    { invalid syntax }
  1300.   HTTP_STATUS_DENIED              = 401;    { access denied }
  1301.   HTTP_STATUS_PAYMENT_REQ         = 402;    { payment required }
  1302.   HTTP_STATUS_FORBIDDEN           = 403;    { request forbidden }
  1303.   HTTP_STATUS_NOT_FOUND           = 404;    { object not found }
  1304.   HTTP_STATUS_BAD_METHOD          = 405;    { method is not allowed }
  1305.   HTTP_STATUS_NONE_ACCEPTABLE     = 406;    { no response acceptable to client found }
  1306.   HTTP_STATUS_PROXY_AUTH_REQ      = 407;    { proxy authentication required }
  1307.   HTTP_STATUS_REQUEST_TIMEOUT     = 408;    { server timed out waiting for request }
  1308.   HTTP_STATUS_CONFLICT            = 409;    { user should resubmit with more info }
  1309.   HTTP_STATUS_GONE                = 410;    { the resource is no longer available }
  1310.   HTTP_STATUS_AUTH_REFUSED        = 411;    { couldn't authorize client }
  1311.   HTTP_STATUS_PRECOND_FAILED      = 412;    { precondition given in request failed }
  1312.   HTTP_STATUS_REQUEST_TOO_LARGE   = 413;    { request entity was too large }
  1313.   HTTP_STATUS_URI_TOO_LONG        = 414;    { request URI too long }
  1314.   HTTP_STATUS_UNSUPPORTED_MEDIA   = 415;    { unsupported media type }
  1315.  
  1316.   HTTP_STATUS_SERVER_ERROR        = 500;    { internal server error }
  1317.   HTTP_STATUS_NOT_SUPPORTED       = 501;    { required not supported }
  1318.   HTTP_STATUS_BAD_GATEWAY         = 502;    { error response received from gateway }
  1319.   HTTP_STATUS_SERVICE_UNAVAIL     = 503;    { temporarily overloaded }
  1320.   HTTP_STATUS_GATEWAY_TIMEOUT     = 504;    { timed out waiting for gateway }
  1321.   HTTP_STATUS_VERSION_NOT_SUP     = 505;    { HTTP version not supported }
  1322.  
  1323.   HTTP_STATUS_FIRST               = HTTP_STATUS_CONTINUE;
  1324.   HTTP_STATUS_LAST                = HTTP_STATUS_VERSION_NOT_SUP;
  1325.  
  1326.  
  1327. { prototypes }
  1328.  
  1329. function HttpOpenRequestA(hConnect: HINTERNET; lpszVerb: PAnsiChar;
  1330.   lpszObjectName: PAnsiChar; lpszVersion: PAnsiChar; lpszReferrer: PAnsiChar;
  1331.   lplpszAcceptTypes: PAnsiChar; dwFlags: DWORD;
  1332.   dwContext: DWORD): HINTERNET; stdcall;
  1333. function HttpOpenRequestW(hConnect: HINTERNET; lpszVerb: PWideChar;
  1334.   lpszObjectName: PWideChar; lpszVersion: PWideChar; lpszReferrer: PWideChar;
  1335.   lplpszAcceptTypes: PWideChar; dwFlags: DWORD;
  1336.   dwContext: DWORD): HINTERNET; stdcall;
  1337. function HttpOpenRequest(hConnect: HINTERNET; lpszVerb: PChar;
  1338.   lpszObjectName: PChar; lpszVersion: PChar; lpszReferrer: PChar;
  1339.   lplpszAcceptTypes: PChar; dwFlags: DWORD;
  1340.   dwContext: DWORD): HINTERNET; stdcall;
  1341.  
  1342. function HttpAddRequestHeadersA(hRequest: HINTERNET; lpszHeaders: PAnsiChar;
  1343.   dwHeadersLength: DWORD; dwModifiers: DWORD): BOOL; stdcall;
  1344. function HttpAddRequestHeadersW(hRequest: HINTERNET; lpszHeaders: PWideChar;
  1345.   dwHeadersLength: DWORD; dwModifiers: DWORD): BOOL; stdcall;
  1346. function HttpAddRequestHeaders(hRequest: HINTERNET; lpszHeaders: PChar;
  1347.   dwHeadersLength: DWORD; dwModifiers: DWORD): BOOL; stdcall;
  1348.  
  1349. const
  1350. { values for dwModifiers parameter of HttpAddRequestHeaders }
  1351.  
  1352.   HTTP_ADDREQ_INDEX_MASK          = $0000FFFF;
  1353.   HTTP_ADDREQ_FLAGS_MASK          = $FFFF0000;
  1354.  
  1355. { HTTP_ADDREQ_FLAG_ADD_IF_NEW - the header will only be added if it doesn't }
  1356. { already exist }
  1357.  
  1358.   HTTP_ADDREQ_FLAG_ADD_IF_NEW     = $10000000;
  1359.  
  1360. { HTTP_ADDREQ_FLAG_ADD - if HTTP_ADDREQ_FLAG_REPLACE is set but the header is }
  1361. { not found then if this flag is set, the header is added anyway, so long as }
  1362. { there is a valid header-value }
  1363.  
  1364.   HTTP_ADDREQ_FLAG_ADD            = $20000000;
  1365.  
  1366. { HTTP_ADDREQ_FLAG_COALESCE - coalesce headers with same name. e.g. }
  1367. { "Accept: text/*" and "Accept: audio/*" with this flag results in a single }
  1368. { header: "Accept: text/*, audio/*" }
  1369.  
  1370.   HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA           = $40000000; 
  1371.   HTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON       = $01000000; 
  1372.   HTTP_ADDREQ_FLAG_COALESCE                      = HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA; 
  1373.  
  1374. { HTTP_ADDREQ_FLAG_REPLACE - replaces the specified header. Only one header can }
  1375. { be supplied in the buffer. If the header to be replaced is not the first }
  1376. { in a list of headers with the same name, then the relative index should be }
  1377. { supplied in the low 8 bits of the dwModifiers parameter. If the header-value }
  1378. { part is missing, then the header is removed }
  1379.  
  1380.   HTTP_ADDREQ_FLAG_REPLACE        = $80000000; 
  1381.  
  1382.   
  1383. function HttpSendRequestA(hRequest: HINTERNET; lpszHeaders: PAnsiChar; 
  1384.   dwHeadersLength: DWORD; lpOptional: Pointer; 
  1385.   dwOptionalLength: DWORD): BOOL; stdcall;
  1386. function HttpSendRequestW(hRequest: HINTERNET; lpszHeaders: PWideChar; 
  1387.   dwHeadersLength: DWORD; lpOptional: Pointer; 
  1388.   dwOptionalLength: DWORD): BOOL; stdcall;
  1389. function HttpSendRequest(hRequest: HINTERNET; lpszHeaders: PChar; 
  1390.   dwHeadersLength: DWORD; lpOptional: Pointer; 
  1391.   dwOptionalLength: DWORD): BOOL; stdcall;
  1392.  
  1393. function HttpSendRequestExA(hRequest: HINTERNET; lpBuffersIn: PInternetBuffers;
  1394.     lpBuffersOut: PInternetBuffers;
  1395.     dwFlags: DWORD; dwContext: DWORD): BOOL; stdcall;
  1396. function HttpSendRequestExW(hRequest: HINTERNET; lpBuffersIn: PInternetBuffers;
  1397.     lpBuffersOut: PInternetBuffers;
  1398.     dwFlags: DWORD; dwContext: DWORD): BOOL; stdcall;
  1399. function HttpSendRequestEx(hRequest: HINTERNET; lpBuffersIn: PInternetBuffers;
  1400.     lpBuffersOut: PInternetBuffers;
  1401.     dwFlags: DWORD; dwContext: DWORD): BOOL; stdcall;
  1402.  
  1403. { flags for HttpSendRequestEx(), HttpEndRequest() }
  1404. const
  1405.   HSR_ASYNC       = WININET_API_FLAG_ASYNC;          { force async }
  1406.   HSR_SYNC        = WININET_API_FLAG_SYNC;           { force sync }
  1407.   HSR_USE_CONTEXT = WININET_API_FLAG_USE_CONTEXT;    { use dwContext value }
  1408.   HSR_INITIATE    = $00000008;                       { iterative operation (completed by HttpEndRequest) }
  1409.   HSR_DOWNLOAD    = $00000010;                       { download to file }
  1410.   HSR_CHUNKED     = $00000020;                       { operation is send of chunked data }
  1411.  
  1412. function HttpEndRequestA(hRequest: HINTERNET;
  1413.   lpBuffersOut: PInternetBuffers; dwFlags: DWORD;
  1414.   dwContext: DWORD): BOOL; stdcall;
  1415. function HttpEndRequestW(hRequest: HINTERNET;
  1416.   lpBuffersOut: PInternetBuffers; dwFlags: DWORD;
  1417.   dwContext: DWORD): BOOL; stdcall;
  1418. function HttpEndRequest(hRequest: HINTERNET;
  1419.   lpBuffersOut: PInternetBuffers; dwFlags: DWORD;
  1420.   dwContext: DWORD): BOOL; stdcall;
  1421.  
  1422. function HttpQueryInfoA(hRequest: HINTERNET; dwInfoLevel: DWORD;
  1423.   lpvBuffer: Pointer; var lpdwBufferLength: DWORD;
  1424.   var lpdwReserved: DWORD): BOOL; stdcall;
  1425. function HttpQueryInfoW(hRequest: HINTERNET; dwInfoLevel: DWORD;
  1426.   lpvBuffer: Pointer; var lpdwBufferLength: DWORD;
  1427.   var lpdwReserved: DWORD): BOOL; stdcall;
  1428. function HttpQueryInfo(hRequest: HINTERNET; dwInfoLevel: DWORD;
  1429.   lpvBuffer: Pointer; var lpdwBufferLength: DWORD;
  1430.   var lpdwReserved: DWORD): BOOL; stdcall;
  1431.  
  1432. { Cookie APIs }
  1433.  
  1434. function InternetSetCookieA(lpszUrl, lpszCookieName,
  1435.   lpszCookieData: PAnsiChar): BOOL; stdcall;
  1436. function InternetSetCookieW(lpszUrl, lpszCookieName,
  1437.   lpszCookieData: PWideChar): BOOL; stdcall;
  1438. function InternetSetCookie(lpszUrl, lpszCookieName,
  1439.   lpszCookieData: PChar): BOOL; stdcall;
  1440.  
  1441. function InternetGetCookieA(lpszUrl, lpszCookieName,
  1442.   lpszCookieData: PAnsiChar; var lpdwSize: DWORD): BOOL; stdcall;
  1443. function InternetGetCookieW(lpszUrl, lpszCookieName,
  1444.   lpszCookieData: PWideChar; var lpdwSize: DWORD): BOOL; stdcall;
  1445. function InternetGetCookie(lpszUrl, lpszCookieName,
  1446.   lpszCookieData: PChar; var lpdwSize: DWORD): BOOL; stdcall;
  1447.  
  1448. function InternetAttemptConnect(dwReserved: DWORD): DWORD; stdcall;
  1449.  
  1450.  
  1451. function InternetCheckConnectionA(lpszUrl: PAnsiChar; dwFlags: DWORD;
  1452.     dwReserved: DWORD): BOOL; stdcall;
  1453. function InternetCheckConnectionW(lpszUrl: PAnsiChar; dwFlags: DWORD;
  1454.     dwReserved: DWORD): BOOL; stdcall;
  1455. function InternetCheckConnection(lpszUrl: PAnsiChar; dwFlags: DWORD;
  1456.     dwReserved: DWORD): BOOL; stdcall;
  1457.  
  1458.  
  1459. { Internet UI }
  1460.  
  1461. { InternetErrorDlg - Provides UI for certain Errors. }
  1462. const
  1463.   FLAGS_ERROR_UI_FILTER_FOR_ERRORS            = $01;
  1464.   FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS         = $02;
  1465.   FLAGS_ERROR_UI_FLAGS_GENERATE_DATA          = $04;
  1466.   FLAGS_ERROR_UI_FLAGS_NO_UI                  = $08;
  1467.   FLAGS_ERROR_UI_SERIALIZE_DIALOGS            = $10;
  1468.  
  1469. function InternetAuthNotifyCallback(
  1470.     dwContext: DWORD;     { as passed to InternetErrorDlg }
  1471.     dwReturn: DWORD;      { error code: success, resend, or cancel }
  1472.     lpReserved: Pointer   { reserved: will be set to null }
  1473. ): DWORD; stdcall;
  1474.  
  1475. type
  1476.   PFN_AUTH_NOTIFY = function(dwContext:DWORD; dwReturn:DWORD;
  1477.     lpReserved:Pointer): DWORD;
  1478.  
  1479. function InternetErrorDlg(hWnd: HWND; hRequest: HINTERNET;
  1480.   dwError, dwFlags: DWORD; var lppvData: Pointer): DWORD; stdcall;
  1481.  
  1482. function InternetConfirmZoneCrossing(hWnd: HWND;
  1483.   szUrlPrev, szUrlNew: LPSTR; bPost: BOOL): DWORD; stdcall;
  1484.  
  1485.  
  1486. const
  1487.  
  1488. { Internet API error returns }
  1489.  
  1490.   INTERNET_ERROR_BASE                         = 12000;
  1491.  
  1492.   ERROR_INTERNET_OUT_OF_HANDLES               = INTERNET_ERROR_BASE + 1;
  1493.   ERROR_INTERNET_TIMEOUT                      = INTERNET_ERROR_BASE + 2;
  1494.   ERROR_INTERNET_EXTENDED_ERROR               = INTERNET_ERROR_BASE + 3;
  1495.   ERROR_INTERNET_INTERNAL_ERROR               = INTERNET_ERROR_BASE + 4;
  1496.   ERROR_INTERNET_INVALID_URL                  = INTERNET_ERROR_BASE + 5;
  1497.   ERROR_INTERNET_UNRECOGNIZED_SCHEME          = INTERNET_ERROR_BASE + 6;
  1498.   ERROR_INTERNET_NAME_NOT_RESOLVED            = INTERNET_ERROR_BASE + 7;
  1499.   ERROR_INTERNET_PROTOCOL_NOT_FOUND           = INTERNET_ERROR_BASE + 8;
  1500.   ERROR_INTERNET_INVALID_OPTION               = INTERNET_ERROR_BASE + 9;
  1501.   ERROR_INTERNET_BAD_OPTION_LENGTH            = INTERNET_ERROR_BASE + 10;
  1502.   ERROR_INTERNET_OPTION_NOT_SETTABLE          = INTERNET_ERROR_BASE + 11;
  1503.   ERROR_INTERNET_SHUTDOWN                     = INTERNET_ERROR_BASE + 12;
  1504.   ERROR_INTERNET_INCORRECT_USER_NAME          = INTERNET_ERROR_BASE + 13;
  1505.   ERROR_INTERNET_INCORRECT_PASSWORD           = INTERNET_ERROR_BASE + 14;
  1506.   ERROR_INTERNET_LOGIN_FAILURE                = INTERNET_ERROR_BASE + 15;
  1507.   ERROR_INTERNET_INVALID_OPERATION            = INTERNET_ERROR_BASE + 16;
  1508.   ERROR_INTERNET_OPERATION_CANCELLED          = INTERNET_ERROR_BASE + 17;
  1509.   ERROR_INTERNET_INCORRECT_HANDLE_TYPE        = INTERNET_ERROR_BASE + 18;
  1510.   ERROR_INTERNET_INCORRECT_HANDLE_STATE       = INTERNET_ERROR_BASE + 19;
  1511.   ERROR_INTERNET_NOT_PROXY_REQUEST            = INTERNET_ERROR_BASE + 20;
  1512.   ERROR_INTERNET_REGISTRY_VALUE_NOT_FOUND     = INTERNET_ERROR_BASE + 21;
  1513.   ERROR_INTERNET_BAD_REGISTRY_PARAMETER       = INTERNET_ERROR_BASE + 22;
  1514.   ERROR_INTERNET_NO_DIRECT_ACCESS             = INTERNET_ERROR_BASE + 23;
  1515.   ERROR_INTERNET_NO_CONTEXT                   = INTERNET_ERROR_BASE + 24;
  1516.   ERROR_INTERNET_NO_CALLBACK                  = INTERNET_ERROR_BASE + 25;
  1517.   ERROR_INTERNET_REQUEST_PENDING              = INTERNET_ERROR_BASE + 26;
  1518.   ERROR_INTERNET_INCORRECT_FORMAT             = INTERNET_ERROR_BASE + 27;
  1519.   ERROR_INTERNET_ITEM_NOT_FOUND               = INTERNET_ERROR_BASE + 28;
  1520.   ERROR_INTERNET_CANNOT_CONNECT               = INTERNET_ERROR_BASE + 29;
  1521.   ERROR_INTERNET_CONNECTION_ABORTED           = INTERNET_ERROR_BASE + 30;
  1522.   ERROR_INTERNET_CONNECTION_RESET             = INTERNET_ERROR_BASE + 31;
  1523.   ERROR_INTERNET_FORCE_RETRY                  = INTERNET_ERROR_BASE + 32;
  1524.   ERROR_INTERNET_INVALID_PROXY_REQUEST        = INTERNET_ERROR_BASE + 33;
  1525.  
  1526.   ERROR_INTERNET_HANDLE_EXISTS                = INTERNET_ERROR_BASE + 36;
  1527.   ERROR_INTERNET_SEC_CERT_DATE_INVALID        = INTERNET_ERROR_BASE + 37;
  1528.   ERROR_INTERNET_SEC_CERT_CN_INVALID          = INTERNET_ERROR_BASE + 38;
  1529.   ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR       = INTERNET_ERROR_BASE + 39;
  1530.   ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR       = INTERNET_ERROR_BASE + 40;
  1531.   ERROR_INTERNET_MIXED_SECURITY               = INTERNET_ERROR_BASE + 41;
  1532.   ERROR_INTERNET_CHG_POST_IS_NON_SECURE       = INTERNET_ERROR_BASE + 42;
  1533.   ERROR_INTERNET_POST_IS_NON_SECURE           = INTERNET_ERROR_BASE + 43;
  1534.   ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED      = INTERNET_ERROR_BASE + 44;
  1535.   ERROR_INTERNET_INVALID_CA                   = INTERNET_ERROR_BASE + 45;
  1536.   ERROR_INTERNET_CLIENT_AUTH_NOT_SETUP        = INTERNET_ERROR_BASE + 46;
  1537.   ERROR_INTERNET_ASYNC_THREAD_FAILED          = INTERNET_ERROR_BASE + 47;
  1538.   ERROR_INTERNET_REDIRECT_SCHEME_CHANGE       = INTERNET_ERROR_BASE + 48;
  1539.   ERROR_INTERNET_DIALOG_PENDING               = INTERNET_ERROR_BASE + 49;
  1540.   ERROR_INTERNET_RETRY_DIALOG                 = INTERNET_ERROR_BASE + 50;
  1541.   ERROR_INTERNET_HTTPS_HTTP_SUBMIT_REDIR      = INTERNET_ERROR_BASE + 52;
  1542.   ERROR_INTERNET_INSERT_CDROM                 = INTERNET_ERROR_BASE + 53;
  1543.  
  1544. { FTP API errors }
  1545.  
  1546.   ERROR_FTP_TRANSFER_IN_PROGRESS              = INTERNET_ERROR_BASE + 110;
  1547.   ERROR_FTP_DROPPED                           = INTERNET_ERROR_BASE + 111;
  1548.   ERROR_FTP_NO_PASSIVE_MODE                   = INTERNET_ERROR_BASE + 112;
  1549.  
  1550.  
  1551. { gopher API errors }
  1552.  
  1553.   ERROR_GOPHER_PROTOCOL_ERROR                 = INTERNET_ERROR_BASE + 130;
  1554.   ERROR_GOPHER_NOT_FILE                       = INTERNET_ERROR_BASE + 131;
  1555.   ERROR_GOPHER_DATA_ERROR                     = INTERNET_ERROR_BASE + 132;
  1556.   ERROR_GOPHER_END_OF_DATA                    = INTERNET_ERROR_BASE + 133;
  1557.   ERROR_GOPHER_INVALID_LOCATOR                = INTERNET_ERROR_BASE + 134;
  1558.   ERROR_GOPHER_INCORRECT_LOCATOR_TYPE         = INTERNET_ERROR_BASE + 135;
  1559.   ERROR_GOPHER_NOT_GOPHER_PLUS                = INTERNET_ERROR_BASE + 136;
  1560.   ERROR_GOPHER_ATTRIBUTE_NOT_FOUND            = INTERNET_ERROR_BASE + 137;
  1561.   ERROR_GOPHER_UNKNOWN_LOCATOR                = INTERNET_ERROR_BASE + 138;
  1562.  
  1563. { HTTP API errors }
  1564.  
  1565.   ERROR_HTTP_HEADER_NOT_FOUND                 = INTERNET_ERROR_BASE + 150;
  1566.   ERROR_HTTP_DOWNLEVEL_SERVER                 = INTERNET_ERROR_BASE + 151;
  1567.   ERROR_HTTP_INVALID_SERVER_RESPONSE          = INTERNET_ERROR_BASE + 152;
  1568.   ERROR_HTTP_INVALID_HEADER                   = INTERNET_ERROR_BASE + 153;
  1569.   ERROR_HTTP_INVALID_QUERY_REQUEST            = INTERNET_ERROR_BASE + 154;
  1570.   ERROR_HTTP_HEADER_ALREADY_EXISTS            = INTERNET_ERROR_BASE + 155;
  1571.   ERROR_HTTP_REDIRECT_FAILED                  = INTERNET_ERROR_BASE + 156;
  1572.   ERROR_HTTP_NOT_REDIRECTED                   = INTERNET_ERROR_BASE + 160;
  1573.   ERROR_HTTP_COOKIE_NEEDS_CONFIRMATION        = INTERNET_ERROR_BASE + 161;
  1574.   ERROR_HTTP_COOKIE_DECLINED                  = INTERNET_ERROR_BASE + 162;
  1575.   ERROR_HTTP_REDIRECT_NEEDS_CONFIRMATION      = INTERNET_ERROR_BASE + 168;
  1576.  
  1577. { additional Internet API error codes }
  1578.  
  1579.   ERROR_INTERNET_SECURITY_CHANNEL_ERROR       = INTERNET_ERROR_BASE + 157;
  1580.   ERROR_INTERNET_UNABLE_TO_CACHE_FILE         = INTERNET_ERROR_BASE + 158;
  1581.   ERROR_INTERNET_TCPIP_NOT_INSTALLED          = INTERNET_ERROR_BASE + 159;
  1582.   ERROR_INTERNET_DISCONNECTED                 = INTERNET_ERROR_BASE + 163;
  1583.   ERROR_INTERNET_SERVER_UNREACHABLE           = INTERNET_ERROR_BASE + 164;
  1584.   ERROR_INTERNET_PROXY_SERVER_UNREACHABLE     = INTERNET_ERROR_BASE + 165;
  1585.  
  1586.   ERROR_INTERNET_BAD_AUTO_PROXY_SCRIPT        = INTERNET_ERROR_BASE + 166;
  1587.   ERROR_INTERNET_UNABLE_TO_DOWNLOAD_SCRIPT    = INTERNET_ERROR_BASE + 167;
  1588.   ERROR_INTERNET_SEC_INVALID_CERT             = INTERNET_ERROR_BASE + 169;
  1589.   ERROR_INTERNET_SEC_CERT_REVOKED             = INTERNET_ERROR_BASE + 170;
  1590.  
  1591. { InternetAutodial specific errors }
  1592.  
  1593.   ERROR_INTERNET_FAILED_DUETOSECURITYCHECK    = INTERNET_ERROR_BASE + 171;
  1594.  
  1595.   INTERNET_ERROR_LAST                         = ERROR_INTERNET_FAILED_DUETOSECURITYCHECK;
  1596.  
  1597.  
  1598. { URLCACHE APIs }
  1599.  
  1600. { datatype definitions. }
  1601.  
  1602. { cache entry type flags. }
  1603.  
  1604.   NORMAL_CACHE_ENTRY          = $00000001;
  1605.   STABLE_CACHE_ENTRY          = $00000002;
  1606.   STICKY_CACHE_ENTRY          = $00000004;
  1607.   COOKIE_CACHE_ENTRY          = $00100000;
  1608.   URLHISTORY_CACHE_ENTRY      = $00200000;
  1609.   TRACK_OFFLINE_CACHE_ENTRY   = $00000010;
  1610.   TRACK_ONLINE_CACHE_ENTRY    = $00000020;
  1611.  
  1612.   SPARSE_CACHE_ENTRY          = $00010000;
  1613.   OCX_CACHE_ENTRY             = $00020000;
  1614.  
  1615.   URLCACHE_FIND_DEFAULT_FILTER = NORMAL_CACHE_ENTRY or
  1616.                                  COOKIE_CACHE_ENTRY or
  1617.                                  URLHISTORY_CACHE_ENTRY or
  1618.                                  TRACK_OFFLINE_CACHE_ENTRY or
  1619.                                  TRACK_ONLINE_CACHE_ENTRY or
  1620.                                  STICKY_CACHE_ENTRY;
  1621.  
  1622.  
  1623. type
  1624.   PInternetCacheEntryInfoA = ^TInternetCacheEntryInfoA;
  1625.   PInternetCacheEntryInfoW = ^TInternetCacheEntryInfoW;
  1626.   PInternetCacheEntryInfo = PInternetCacheEntryInfoA;
  1627.   TInternetCacheEntryInfoA = record
  1628.     dwStructSize: DWORD;         { version of cache system. ?? do we need this for all entries? }
  1629.     lpszSourceUrlName: PAnsiChar;    { embedded pointer to the URL name string. }
  1630.     lpszLocalFileName: PAnsiChar;   { embedded pointer to the local file name. }
  1631.     CacheEntryType: DWORD;       { cache type bit mask. }
  1632.     dwUseCount: DWORD;           { current users count of the cache entry. }
  1633.     dwHitRate: DWORD;            { num of times the cache entry was retrieved. }
  1634.     dwSizeLow: DWORD;            { low DWORD of the file size. }
  1635.     dwSizeHigh: DWORD;           { high DWORD of the file size. }
  1636.     LastModifiedTime: TFileTime; { last modified time of the file in GMT format. }
  1637.     ExpireTime: TFileTime;       { expire time of the file in GMT format }
  1638.     LastAccessTime: TFileTime;   { last accessed time in GMT format }
  1639.     LastSyncTime: TFileTime;     { last time the URL was synchronized }
  1640.                                  { with the source }
  1641.     lpHeaderInfo: PBYTE;         { embedded pointer to the header info. }
  1642.     dwHeaderInfoSize: DWORD;     { size of the above header. }
  1643.     lpszFileExtension: PAnsiChar;   { File extension used to retrive the urldata as a file. }
  1644.     dwReserved: DWORD;           { reserved for future use. }
  1645.   end;
  1646.   TInternetCacheEntryInfoW = record
  1647.     dwStructSize: DWORD;         { version of cache system. ?? do we need this for all entries? }
  1648.     lpszSourceUrlName: PAnsiChar;    { embedded pointer to the URL name string. }
  1649.     lpszLocalFileName: PWideChar;   { embedded pointer to the local file name. }
  1650.     CacheEntryType: DWORD;       { cache type bit mask. }
  1651.     dwUseCount: DWORD;           { current users count of the cache entry. }
  1652.     dwHitRate: DWORD;            { num of times the cache entry was retrieved. }
  1653.     dwSizeLow: DWORD;            { low DWORD of the file size. }
  1654.     dwSizeHigh: DWORD;           { high DWORD of the file size. }
  1655.     LastModifiedTime: TFileTime; { last modified time of the file in GMT format. }
  1656.     ExpireTime: TFileTime;       { expire time of the file in GMT format }
  1657.     LastAccessTime: TFileTime;   { last accessed time in GMT format }
  1658.     LastSyncTime: TFileTime;     { last time the URL was synchronized }
  1659.                                  { with the source }
  1660.     lpHeaderInfo: PBYTE;         { embedded pointer to the header info. }
  1661.     dwHeaderInfoSize: DWORD;     { size of the above header. }
  1662.     lpszFileExtension: PWideChar;   { File extension used to retrive the urldata as a file. }
  1663.     dwReserved: DWORD;           { reserved for future use. }
  1664.   end;
  1665.   TInternetCacheEntryInfo = TInternetCacheEntryInfoA;
  1666.  
  1667. { Cache APIs }
  1668.  
  1669. function CreateUrlCacheEntryA(lpszUrlName: PAnsiChar;
  1670.   dwExpectedFileSize: DWORD; lpszFileExtension: PAnsiChar;
  1671.   lpszFileName: PAnsiChar; dwReserved: DWORD): BOOL; stdcall;
  1672. function CreateUrlCacheEntryW(lpszUrlName: PAnsiChar;
  1673.   dwExpectedFileSize: DWORD; lpszFileExtension: PAnsiChar;
  1674.   lpszFileName: PWideChar; dwReserved: DWORD): BOOL; stdcall;
  1675. function CreateUrlCacheEntry(lpszUrlName: PAnsiChar;
  1676.   dwExpectedFileSize: DWORD; lpszFileExtension: PAnsiChar;
  1677.   lpszFileName: PChar; dwReserved: DWORD): BOOL; stdcall;
  1678.  
  1679. function CommitUrlCacheEntryA( lpszUrlName, lpszLocalFileName: PAnsiChar;
  1680.   ExpireTime, LastModifiedTime: TFileTime;  CacheEntryType: DWORD;
  1681.   lpHeaderInfo: PBYTE; dwHeaderSize: DWORD; lpszFileExtension: PAnsiChar;
  1682.   dwReserved: DWORD): BOOL; stdcall;
  1683. function CommitUrlCacheEntryW( lpszUrlName, lpszLocalFileName: PAnsiChar;
  1684.   ExpireTime, LastModifiedTime: TFileTime;  CacheEntryType: DWORD;
  1685.   lpHeaderInfo: PBYTE; dwHeaderSize: DWORD; lpszFileExtension: PWideChar;
  1686.   dwReserved: DWORD): BOOL; stdcall;
  1687. function CommitUrlCacheEntry( lpszUrlName, lpszLocalFileName: PAnsiChar;
  1688.   ExpireTime, LastModifiedTime: TFileTime;  CacheEntryType: DWORD;
  1689.   lpHeaderInfo: PBYTE; dwHeaderSize: DWORD; lpszFileExtension: PChar;
  1690.   dwReserved: DWORD): BOOL; stdcall;
  1691.  
  1692. function RetrieveUrlCacheEntryFileA(lpszUrlName: PAnsiChar;
  1693.   var lpCacheEntryInfo: TInternetCacheEntryInfo;
  1694.   var lpdwCacheEntryInfoBufferSize: DWORD;
  1695.   dwReserved: DWORD): BOOL; stdcall;
  1696. function RetrieveUrlCacheEntryFileW(lpszUrlName: PAnsiChar;
  1697.   var lpCacheEntryInfo: TInternetCacheEntryInfo;
  1698.   var lpdwCacheEntryInfoBufferSize: DWORD;
  1699.   dwReserved: DWORD): BOOL; stdcall;
  1700. function RetrieveUrlCacheEntryFile(lpszUrlName: PAnsiChar;
  1701.   var lpCacheEntryInfo: TInternetCacheEntryInfo;
  1702.   var lpdwCacheEntryInfoBufferSize: DWORD;
  1703.   dwReserved: DWORD): BOOL; stdcall;
  1704.  
  1705. function UnlockUrlCacheEntryFile(lpszUrlName: LPCSTR;
  1706.   dwReserved: DWORD): BOOL; stdcall;
  1707.  
  1708. function RetrieveUrlCacheEntryStreamA(lpszUrlName: PAnsiChar;
  1709.   var lpCacheEntryInfo: TInternetCacheEntryInfo;
  1710.   var lpdwCacheEntryInfoBufferSize: DWORD; fRandomRead: BOOL;
  1711.   dwReserved: DWORD): BOOL; stdcall;
  1712. function RetrieveUrlCacheEntryStreamW(lpszUrlName: PAnsiChar;
  1713.   var lpCacheEntryInfo: TInternetCacheEntryInfo;
  1714.   var lpdwCacheEntryInfoBufferSize: DWORD; fRandomRead: BOOL;
  1715.   dwReserved: DWORD): BOOL; stdcall;
  1716. function RetrieveUrlCacheEntryStream(lpszUrlName: PAnsiChar;
  1717.   var lpCacheEntryInfo: TInternetCacheEntryInfo;
  1718.   var lpdwCacheEntryInfoBufferSize: DWORD; fRandomRead: BOOL;
  1719.   dwReserved: DWORD): BOOL; stdcall;
  1720.  
  1721. function ReadUrlCacheEntryStream(hUrlCacheStream: THandle;
  1722.   dwLocation: DWORD; var lpBuffer: Pointer;
  1723.   var lpdwLen: DWORD; Reserved: DWORD): BOOL; stdcall;
  1724.  
  1725. function UnlockUrlCacheEntryStream(hUrlCacheStream: THandle;
  1726.   Reserved: DWORD): BOOL; stdcall;
  1727.  
  1728. function GetUrlCacheEntryInfoA(lpszUrlName: PAnsiChar;
  1729.   var lpCacheEntryInfo: TInternetCacheEntryInfo;
  1730.   var lpdwCacheEntryInfoBufferSize: DWORD): BOOL; stdcall;
  1731. function GetUrlCacheEntryInfoW(lpszUrlName: PAnsiChar;
  1732.   var lpCacheEntryInfo: TInternetCacheEntryInfo;
  1733.   var lpdwCacheEntryInfoBufferSize: DWORD): BOOL; stdcall;
  1734. function GetUrlCacheEntryInfo(lpszUrlName: PAnsiChar;
  1735.   var lpCacheEntryInfo: TInternetCacheEntryInfo;
  1736.   var lpdwCacheEntryInfoBufferSize: DWORD): BOOL; stdcall;
  1737.  
  1738. function GetUrlCacheEntryInfoExA(
  1739.     lpszUrl: PAnsiChar;
  1740.     lpCacheEntryInfo: PInternetCacheEntryInfo;
  1741.     lpdwCacheEntryInfoBufSize: LPDWORD;
  1742.     lpszReserved: PAnsiChar; { must pass nil }
  1743.     lpdwReserved: LPDWORD; { must pass nil }
  1744.     lpReserved: Pointer; { must pass nil }
  1745.     dwFlags: DWORD { reserved }
  1746.     ): BOOL; stdcall;
  1747. function GetUrlCacheEntryInfoExW(
  1748.     lpszUrl: PAnsiChar;
  1749.     lpCacheEntryInfo: PInternetCacheEntryInfo;
  1750.     lpdwCacheEntryInfoBufSize: LPDWORD;
  1751.     lpszReserved: PAnsiChar; { must pass nil }
  1752.     lpdwReserved: LPDWORD; { must pass nil }
  1753.     lpReserved: Pointer; { must pass nil }
  1754.     dwFlags: DWORD { reserved }
  1755.     ): BOOL; stdcall;
  1756. function GetUrlCacheEntryInfoEx(
  1757.     lpszUrl: PAnsiChar;
  1758.     lpCacheEntryInfo: PInternetCacheEntryInfo;
  1759.     lpdwCacheEntryInfoBufSize: LPDWORD;
  1760.     lpszReserved: PAnsiChar; { must pass nil }
  1761.     lpdwReserved: LPDWORD; { must pass nil }
  1762.     lpReserved: Pointer; { must pass nil }
  1763.     dwFlags: DWORD { reserved }
  1764.     ): BOOL; stdcall;
  1765.  
  1766. const
  1767.   CACHE_ENTRY_ATTRIBUTE_FC        = $00000004;
  1768.   CACHE_ENTRY_HITRATE_FC          = $00000010;
  1769.   CACHE_ENTRY_MODTIME_FC          = $00000040;
  1770.   CACHE_ENTRY_EXPTIME_FC          = $00000080;
  1771.   CACHE_ENTRY_ACCTIME_FC          = $00000100;
  1772.   CACHE_ENTRY_SYNCTIME_FC         = $00000200;
  1773.   CACHE_ENTRY_HEADERINFO_FC       = $00000400;
  1774.   CACHE_ENTRY_EXEMPT_DELTA_FC     = $00000800;
  1775.  
  1776. function SetUrlCacheEntryInfoA(lpszUrlName: PAnsiChar;
  1777.   var lpCacheEntryInfo: TInternetCacheEntryInfo;
  1778.   dwFieldControl: DWORD): BOOL; stdcall;
  1779. function SetUrlCacheEntryInfoW(lpszUrlName: PAnsiChar;
  1780.   var lpCacheEntryInfo: TInternetCacheEntryInfo;
  1781.   dwFieldControl: DWORD): BOOL; stdcall;
  1782. function SetUrlCacheEntryInfo(lpszUrlName: PAnsiChar;
  1783.   var lpCacheEntryInfo: TInternetCacheEntryInfo;
  1784.   dwFieldControl: DWORD): BOOL; stdcall;
  1785.  
  1786. type
  1787.   GROUPID = Int64;
  1788.  
  1789. function CreateUrlCacheGroup(dwFlags: DWORD;
  1790.   lpReserved: Pointer { must pass nill }
  1791.   ): Int64; stdcall;
  1792.  
  1793. function DeleteUrlCacheGroup(GroupId: Int64;
  1794.     dwFlags: DWORD;    { must pass 0 }
  1795.     lpReserved: Pointer { must pass nill }
  1796.     ): Bool; stdcall;
  1797.  
  1798. { Flags for SetUrlCacheEntryGroup }
  1799.  
  1800. const
  1801.   INTERNET_CACHE_GROUP_ADD      = 0;
  1802.   INTERNET_CACHE_GROUP_REMOVE   = 1;
  1803.  
  1804. function SetUrlCacheEntryGroup(lpszUrlName: LPCSTR; dwFlags: DWORD;
  1805.   GroupId: Int64;
  1806.   pbGroupAttributes: PChar; { must pass nil }
  1807.   cbGroupAttributes: DWORD;  { must pass 0 }
  1808.   lpReserved: Pointer        { must pass nil }
  1809.   ): Bool; stdcall;
  1810.  
  1811. function FindFirstUrlCacheEntryExA(lpszUrlSearchPattern: PAnsiChar;
  1812.     dwFlags: DWORD;
  1813.     dwFilter: DWORD;
  1814.     GroupId: GROUPID;
  1815.     lpFirstCacheEntryInfo: PInternetCacheEntryInfo;
  1816.     lpdwFirstCacheEntryInfoBufferSize: LPDWORD;
  1817.     lpGroupAttributes: Pointer;  { must pass nil }
  1818.     pcbGroupAttributes: LPDWORD;    { must pass nil }
  1819.     lpReserved: Pointer             { must pass nil }
  1820.     ): THandle; stdcall;
  1821. function FindFirstUrlCacheEntryExW(lpszUrlSearchPattern: PAnsiChar;
  1822.     dwFlags: DWORD;
  1823.     dwFilter: DWORD;
  1824.     GroupId: GROUPID;
  1825.     lpFirstCacheEntryInfo: PInternetCacheEntryInfo;
  1826.     lpdwFirstCacheEntryInfoBufferSize: LPDWORD;
  1827.     lpGroupAttributes: Pointer;  { must pass nil }
  1828.     pcbGroupAttributes: LPDWORD;    { must pass nil }
  1829.     lpReserved: Pointer             { must pass nil }
  1830.     ): THandle; stdcall;
  1831. function FindFirstUrlCacheEntryEx(lpszUrlSearchPattern: PAnsiChar;
  1832.     dwFlags: DWORD;
  1833.     dwFilter: DWORD;
  1834.     GroupId: GROUPID;
  1835.     lpFirstCacheEntryInfo: PInternetCacheEntryInfo;
  1836.     lpdwFirstCacheEntryInfoBufferSize: LPDWORD;
  1837.     lpGroupAttributes: Pointer;  { must pass nil }
  1838.     pcbGroupAttributes: LPDWORD;    { must pass nil }
  1839.     lpReserved: Pointer             { must pass nil }
  1840.     ): THandle; stdcall;
  1841.  
  1842. function FindNextUrlCacheEntryExA(hEnumHandle: THANDLE;
  1843.     lpFirstCacheEntryInfo: PInternetCacheEntryInfo;
  1844.     lpdwFirstCacheEntryInfoBufferSize: LPDWORD;
  1845.     lpGroupAttributes: Pointer;  { must pass nil }
  1846.     pcbGroupAttributes: LPDWORD;    { must pass nil }
  1847.     lpReserved: Pointer             { must pass nil }
  1848.     ): BOOL; stdcall;
  1849. function FindNextUrlCacheEntryExW(hEnumHandle: THANDLE;
  1850.     lpFirstCacheEntryInfo: PInternetCacheEntryInfo;
  1851.     lpdwFirstCacheEntryInfoBufferSize: LPDWORD;
  1852.     lpGroupAttributes: Pointer;  { must pass nil }
  1853.     pcbGroupAttributes: LPDWORD;    { must pass nil }
  1854.     lpReserved: Pointer             { must pass nil }
  1855.     ): BOOL; stdcall;
  1856. function FindNextUrlCacheEntryEx(hEnumHandle: THANDLE;
  1857.     lpFirstCacheEntryInfo: PInternetCacheEntryInfo;
  1858.     lpdwFirstCacheEntryInfoBufferSize: LPDWORD;
  1859.     lpGroupAttributes: Pointer;  { must pass nil }
  1860.     pcbGroupAttributes: LPDWORD;    { must pass nil }
  1861.     lpReserved: Pointer             { must pass nil }
  1862.     ): BOOL; stdcall;
  1863.  
  1864. function FindFirstUrlCacheEntryA(lpszUrlSearchPattern: PAnsiChar;
  1865.   var lpFirstCacheEntryInfo: TInternetCacheEntryInfo;
  1866.   var lpdwFirstCacheEntryInfoBufferSize: DWORD): BOOL; stdcall;
  1867. function FindFirstUrlCacheEntryW(lpszUrlSearchPattern: PAnsiChar;
  1868.   var lpFirstCacheEntryInfo: TInternetCacheEntryInfo;
  1869.   var lpdwFirstCacheEntryInfoBufferSize: DWORD): BOOL; stdcall;
  1870. function FindFirstUrlCacheEntry(lpszUrlSearchPattern: PAnsiChar;
  1871.   var lpFirstCacheEntryInfo: TInternetCacheEntryInfo;
  1872.   var lpdwFirstCacheEntryInfoBufferSize: DWORD): BOOL; stdcall;
  1873.  
  1874. function FindNextUrlCacheEntryA(hEnumHandle: THandle;
  1875.   var lpNextCacheEntryInfo: TInternetCacheEntryInfo;
  1876.   var lpdwNextCacheEntryInfoBufferSize: DWORD): BOOL; stdcall;
  1877. function FindNextUrlCacheEntryW(hEnumHandle: THandle;
  1878.   var lpNextCacheEntryInfo: TInternetCacheEntryInfo;
  1879.   var lpdwNextCacheEntryInfoBufferSize: DWORD): BOOL; stdcall;
  1880. function FindNextUrlCacheEntry(hEnumHandle: THandle;
  1881.   var lpNextCacheEntryInfo: TInternetCacheEntryInfo;
  1882.   var lpdwNextCacheEntryInfoBufferSize: DWORD): BOOL; stdcall;
  1883.  
  1884. function FindCloseUrlCache(hEnumHandle: THandle): BOOL; stdcall;
  1885.  
  1886. function DeleteUrlCacheEntry(lpszUrlName: LPCSTR): BOOL; stdcall;
  1887.  
  1888. function InternetDial(hwndParent: HWND; lpszConnectoid: LPTSTR; dwFlags: DWORD;
  1889.   lpdwConnection: LPDWORD; dwReserved: DWORD): DWORD; stdcall;
  1890.  
  1891. { Flags for InternetDial - must not conflict with InternetAutodial flags }
  1892. {                          as they are valid here also.                  }
  1893. const
  1894.   INTERNET_DIAL_UNATTENDED       = $8000;
  1895.  
  1896. function InternetHangUp(dwConnection: DWORD; dwReserved: DWORD): DWORD; stdcall;
  1897.  
  1898. const
  1899.   INTERENT_GOONLINE_REFRESH = $00000001;
  1900.   INTERENT_GOONLINE_MASK    = $00000001;
  1901.  
  1902. function InternetGoOnline(lpszURL: LPTSTR; hwndParent: HWND;
  1903.   dwFlags: DWORD): BOOL; stdcall;
  1904.  
  1905. function InternetAutodial(dwFlags: DWORD; dwReserved: DWORD): BOOL; stdcall;
  1906.  
  1907. { Flags for InternetAutodial }
  1908. const
  1909.   INTERNET_AUTODIAL_FORCE_ONLINE          = 1;
  1910.   INTERNET_AUTODIAL_FORCE_UNATTENDED      = 2;
  1911.   INTERNET_AUTODIAL_FAILIFSECURITYCHECK   = 4;
  1912.   INTERNET_AUTODIAL_FLAGS_MASK  = INTERNET_AUTODIAL_FORCE_ONLINE or
  1913.                                   INTERNET_AUTODIAL_FORCE_UNATTENDED or
  1914.                                   INTERNET_AUTODIAL_FAILIFSECURITYCHECK;
  1915.  
  1916. function InternetAutodialHangup(dwReserved: DWORD): BOOL; stdcall;
  1917.  
  1918. function InternetGetConnectedState(lpdwFlags: LPDWORD;
  1919.   dwReserved: DWORD): BOOL; stdcall;
  1920.  
  1921. { Flags for InternetGetConnectedState }
  1922. const
  1923.   INTERNET_CONNECTION_MODEM           = 1;
  1924.   INTERNET_CONNECTION_LAN             = 2;
  1925.   INTERNET_CONNECTION_PROXY           = 4;
  1926.   INTERNET_CONNECTION_MODEM_BUSY      = 8;
  1927.  
  1928. { Custom dial handler functions }
  1929.  
  1930. { Custom dial handler prototype }
  1931. type
  1932.   PFN_DIAL_HANDLER = function(A:HWND; B:LPCSTR; C:DWORD; D:LPDWORD): DWORD; stdcall;
  1933.  
  1934. { Flags for custom dial handler }
  1935. const
  1936.   INTERNET_CUSTOMDIAL_CONNECT         = 0;
  1937.   INTERNET_CUSTOMDIAL_UNATTENDED      = 1;
  1938.   INTERNET_CUSTOMDIAL_DISCONNECT      = 2;
  1939.   INTERNET_CUSTOMDIAL_SHOWOFFLINE     = 4;
  1940.  
  1941. { Custom dial handler supported functionality flags }
  1942.   INTERNET_CUSTOMDIAL_SAFE_FOR_UNATTENDED = 1;
  1943.   INTERNET_CUSTOMDIAL_WILL_SUPPLY_STATE   = 2;
  1944.   INTERNET_CUSTOMDIAL_CAN_HANGUP          = 4;
  1945.  
  1946. function InternetSetDialState(lpszConnectoid: LPCTSTR; dwState: DWORD;
  1947.   dwReserved: DWORD): BOOL; stdcall;
  1948.  
  1949. implementation
  1950.  
  1951. const
  1952.   winetdll = 'wininet.dll';
  1953.  
  1954. function CommitUrlCacheEntryA;          external winetdll name 'CommitUrlCacheEntryA';
  1955. function CommitUrlCacheEntryW;          external winetdll name 'CommitUrlCacheEntryW';
  1956. function CommitUrlCacheEntry;          external winetdll name 'CommitUrlCacheEntryA';
  1957. function CreateUrlCacheEntryA;          external winetdll name 'CreateUrlCacheEntryA';
  1958. function CreateUrlCacheEntryW;          external winetdll name 'CreateUrlCacheEntryW';
  1959. function CreateUrlCacheEntry;          external winetdll name 'CreateUrlCacheEntryA';
  1960. function DeleteUrlCacheEntry;             external winetdll name 'DeleteUrlCacheEntry';
  1961. function FindCloseUrlCache;               external winetdll name 'FindCloseUrlCache';
  1962. function FindFirstUrlCacheEntryA;       external winetdll name 'FindFirstUrlCacheEntryA';
  1963. function FindFirstUrlCacheEntryW;       external winetdll name 'FindFirstUrlCacheEntryW';
  1964. function FindFirstUrlCacheEntry;       external winetdll name 'FindFirstUrlCacheEntryA';
  1965. function FindNextUrlCacheEntryA;        external winetdll name 'FindNextUrlCacheEntryA';
  1966. function FindNextUrlCacheEntryW;        external winetdll name 'FindNextUrlCacheEntryW';
  1967. function FindNextUrlCacheEntry;        external winetdll name 'FindNextUrlCacheEntryA';
  1968. function FtpCommandA;                   external winetdll name 'FtpCommandA';
  1969. function FtpCommandW;                   external winetdll name 'FtpCommandW';
  1970. function FtpCommand;                   external winetdll name 'FtpCommandA';
  1971. function FtpCreateDirectoryA;           external winetdll name 'FtpCreateDirectoryA';
  1972. function FtpCreateDirectoryW;           external winetdll name 'FtpCreateDirectoryW';
  1973. function FtpCreateDirectory;           external winetdll name 'FtpCreateDirectoryA';
  1974. function FtpDeleteFileA;                external winetdll name 'FtpDeleteFileA';
  1975. function FtpDeleteFileW;                external winetdll name 'FtpDeleteFileW';
  1976. function FtpDeleteFile;                external winetdll name 'FtpDeleteFileA';
  1977. function FtpFindFirstFileA;             external winetdll name 'FtpFindFirstFileA';
  1978. function FtpFindFirstFileW;             external winetdll name 'FtpFindFirstFileW';
  1979. function FtpFindFirstFile;             external winetdll name 'FtpFindFirstFileA';
  1980. function FtpGetCurrentDirectoryA;       external winetdll name 'FtpGetCurrentDirectoryA';
  1981. function FtpGetCurrentDirectoryW;       external winetdll name 'FtpGetCurrentDirectoryW';
  1982. function FtpGetCurrentDirectory;       external winetdll name 'FtpGetCurrentDirectoryA';
  1983. function FtpGetFileA;                   external winetdll name 'FtpGetFileA';
  1984. function FtpGetFileW;                   external winetdll name 'FtpGetFileW';
  1985. function FtpGetFile;                   external winetdll name 'FtpGetFileA';
  1986. function FtpOpenFileA;                  external winetdll name 'FtpOpenFileA';
  1987. function FtpOpenFileW;                  external winetdll name 'FtpOpenFileW';
  1988. function FtpOpenFile;                  external winetdll name 'FtpOpenFileA';
  1989. function FtpPutFileA;                   external winetdll name 'FtpPutFileA';
  1990. function FtpPutFileW;                   external winetdll name 'FtpPutFileW';
  1991. function FtpPutFile;                   external winetdll name 'FtpPutFileA';
  1992. function FtpRemoveDirectoryA;           external winetdll name 'FtpRemoveDirectoryA';
  1993. function FtpRemoveDirectoryW;           external winetdll name 'FtpRemoveDirectoryW';
  1994. function FtpRemoveDirectory;           external winetdll name 'FtpRemoveDirectoryA';
  1995. function FtpRenameFileA;                external winetdll name 'FtpRenameFileA';
  1996. function FtpRenameFileW;                external winetdll name 'FtpRenameFileW';
  1997. function FtpRenameFile;                external winetdll name 'FtpRenameFileA';
  1998. function FtpSetCurrentDirectoryA;       external winetdll name 'FtpSetCurrentDirectoryA';
  1999. function FtpSetCurrentDirectoryW;       external winetdll name 'FtpSetCurrentDirectoryW';
  2000. function FtpSetCurrentDirectory;       external winetdll name 'FtpSetCurrentDirectoryA';
  2001. function GetUrlCacheEntryInfoA;         external winetdll name 'GetUrlCacheEntryInfoA';
  2002. function GetUrlCacheEntryInfoW;         external winetdll name 'GetUrlCacheEntryInfoW';
  2003. function GetUrlCacheEntryInfo;         external winetdll name 'GetUrlCacheEntryInfoA';
  2004. function GopherCreateLocatorA;          external winetdll name 'GopherCreateLocatorA';
  2005. function GopherCreateLocatorW;          external winetdll name 'GopherCreateLocatorW';
  2006. function GopherCreateLocator;          external winetdll name 'GopherCreateLocatorA';
  2007. function GopherFindFirstFileA;          external winetdll name 'GopherFindFirstFileA';
  2008. function GopherFindFirstFileW;          external winetdll name 'GopherFindFirstFileW';
  2009. function GopherFindFirstFile;          external winetdll name 'GopherFindFirstFileA';
  2010. function GopherGetAttributeA;           external winetdll name 'GopherGetAttributeA';
  2011. function GopherGetAttributeW;           external winetdll name 'GopherGetAttributeW';
  2012. function GopherGetAttribute;           external winetdll name 'GopherGetAttributeA';
  2013. function GopherGetLocatorTypeA;         external winetdll name 'GopherGetLocatorTypeA';
  2014. function GopherGetLocatorTypeW;         external winetdll name 'GopherGetLocatorTypeW';
  2015. function GopherGetLocatorType;         external winetdll name 'GopherGetLocatorTypeA';
  2016. function GopherOpenFileA;               external winetdll name 'GopherOpenFileA';
  2017. function GopherOpenFileW;               external winetdll name 'GopherOpenFileW';
  2018. function GopherOpenFile;               external winetdll name 'GopherOpenFileA';
  2019. function HttpAddRequestHeadersA;        external winetdll name 'HttpAddRequestHeadersA';
  2020. function HttpAddRequestHeadersW;        external winetdll name 'HttpAddRequestHeadersW';
  2021. function HttpAddRequestHeaders;        external winetdll name 'HttpAddRequestHeadersA';
  2022. function HttpOpenRequestA;              external winetdll name 'HttpOpenRequestA';
  2023. function HttpOpenRequestW;              external winetdll name 'HttpOpenRequestW';
  2024. function HttpOpenRequest;              external winetdll name 'HttpOpenRequestA';
  2025. function HttpQueryInfoA;                external winetdll name 'HttpQueryInfoA';
  2026. function HttpQueryInfoW;                external winetdll name 'HttpQueryInfoW';
  2027. function HttpQueryInfo;                external winetdll name 'HttpQueryInfoA';
  2028. function HttpSendRequestA;              external winetdll name 'HttpSendRequestA';
  2029. function HttpSendRequestW;              external winetdll name 'HttpSendRequestW';
  2030. function HttpSendRequest;              external winetdll name 'HttpSendRequestA';
  2031. function InternetCanonicalizeUrlA;      external winetdll name 'InternetCanonicalizeUrlA';
  2032. function InternetCanonicalizeUrlW;      external winetdll name 'InternetCanonicalizeUrlW';
  2033. function InternetCanonicalizeUrl;      external winetdll name 'InternetCanonicalizeUrlA';
  2034. function InternetCloseHandle;             external winetdll name 'InternetCloseHandle';
  2035. function InternetCombineUrlA;           external winetdll name 'InternetCombineUrlA';
  2036. function InternetCombineUrlW;           external winetdll name 'InternetCombineUrlW';
  2037. function InternetCombineUrl;           external winetdll name 'InternetCombineUrlA';
  2038. function InternetConfirmZoneCrossing;     external winetdll name 'InternetConfirmZoneCrossing';
  2039. function InternetConnectA;              external winetdll name 'InternetConnectA';
  2040. function InternetConnectW;              external winetdll name 'InternetConnectW';
  2041. function InternetConnect;              external winetdll name 'InternetConnectA';
  2042. function InternetCrackUrlA;             external winetdll name 'InternetCrackUrlA';
  2043. function InternetCrackUrlW;             external winetdll name 'InternetCrackUrlW';
  2044. function InternetCrackUrl;             external winetdll name 'InternetCrackUrlA';
  2045. function InternetCreateUrlA;            external winetdll name 'InternetCreateUrlA';
  2046. function InternetCreateUrlW;            external winetdll name 'InternetCreateUrlW';
  2047. function InternetCreateUrl;            external winetdll name 'InternetCreateUrlA';
  2048. function InternetErrorDlg;                external winetdll name 'InternetErrorDlg';
  2049. function InternetFindNextFileA;         external winetdll name 'InternetFindNextFileA';
  2050. function InternetFindNextFileW;         external winetdll name 'InternetFindNextFileW';
  2051. function InternetFindNextFile;         external winetdll name 'InternetFindNextFileA';
  2052. function InternetGetCookieA;            external winetdll name 'InternetGetCookieA';
  2053. function InternetGetCookieW;            external winetdll name 'InternetGetCookieW';
  2054. function InternetGetCookie;            external winetdll name 'InternetGetCookieA';
  2055. function InternetGetLastResponseInfoA;  external winetdll name 'InternetGetLastResponseInfoA';
  2056. function InternetGetLastResponseInfoW;  external winetdll name 'InternetGetLastResponseInfoW';
  2057. function InternetGetLastResponseInfo;  external winetdll name 'InternetGetLastResponseInfoA';
  2058. function InternetOpenA;                 external winetdll name 'InternetOpenA';
  2059. function InternetOpenW;                 external winetdll name 'InternetOpenW';
  2060. function InternetOpen;                 external winetdll name 'InternetOpenA';
  2061. function InternetOpenUrlA;              external winetdll name 'InternetOpenUrlA';
  2062. function InternetOpenUrlW;              external winetdll name 'InternetOpenUrlW';
  2063. function InternetOpenUrl;              external winetdll name 'InternetOpenUrlA';
  2064. function InternetQueryDataAvailable;      external winetdll name 'InternetQueryDataAvailable';
  2065. function InternetQueryOptionA;          external winetdll name 'InternetQueryOptionA';
  2066. function InternetQueryOptionW;          external winetdll name 'InternetQueryOptionW';
  2067. function InternetQueryOption;          external winetdll name 'InternetQueryOptionA';
  2068. function InternetReadFile;                external winetdll name 'InternetReadFile';
  2069. function InternetSetCookieA;            external winetdll name 'InternetSetCookieA';
  2070. function InternetSetCookieW;            external winetdll name 'InternetSetCookieW';
  2071. function InternetSetCookie;            external winetdll name 'InternetSetCookieA';
  2072. function InternetSetFilePointer;          external winetdll name 'InternetSetFilePointer';
  2073. function InternetSetOptionA;            external winetdll name 'InternetSetOptionA';
  2074. function InternetSetOptionW;            external winetdll name 'InternetSetOptionW';
  2075. function InternetSetOption;            external winetdll name 'InternetSetOptionA';
  2076. function InternetSetOptionExA;          external winetdll name 'InternetSetOptionExA';
  2077. function InternetSetOptionExW;          external winetdll name 'InternetSetOptionExW';
  2078. function InternetSetOptionEx;          external winetdll name 'InternetSetOptionExA';
  2079. function InternetSetStatusCallback;       external winetdll name 'InternetSetStatusCallback';
  2080. function InternetTimeFromSystemTime;      external winetdll name 'InternetTimeFromSystemTime';
  2081. function InternetWriteFile;               external winetdll name 'InternetWriteFile';
  2082. function ReadUrlCacheEntryStream;         external winetdll name 'ReadUrlCacheEntryStream';
  2083. function RetrieveUrlCacheEntryFileA;    external winetdll name 'RetrieveUrlCacheEntryFileA';
  2084. function RetrieveUrlCacheEntryFileW;    external winetdll name 'RetrieveUrlCacheEntryFileW';
  2085. function RetrieveUrlCacheEntryFile;    external winetdll name 'RetrieveUrlCacheEntryFileA';
  2086. function RetrieveUrlCacheEntryStreamA;  external winetdll name 'RetrieveUrlCacheEntryStreamA';
  2087. function RetrieveUrlCacheEntryStreamW;  external winetdll name 'RetrieveUrlCacheEntryStreamW';
  2088. function RetrieveUrlCacheEntryStream;  external winetdll name 'RetrieveUrlCacheEntryStreamA';
  2089. function SetUrlCacheEntryInfoA;         external winetdll name 'SetUrlCacheEntryInfoA';
  2090. function SetUrlCacheEntryInfoW;         external winetdll name 'SetUrlCacheEntryInfoW';
  2091. function SetUrlCacheEntryInfo;         external winetdll name 'SetUrlCacheEntryInfoA';
  2092. function UnlockUrlCacheEntryFile;         external winetdll name 'UnlockUrlCacheEntryFile';
  2093. function UnlockUrlCacheEntryStream;       external winetdll name 'UnlockUrlCacheEntryStream';
  2094.  
  2095. function CreateUrlCacheGroup;             external winetdll name 'CreateUrlCacheGroup';
  2096. function DeleteUrlCacheGroup;             external winetdll name 'DeleteUrlCacheGroup';
  2097. function FindFirstUrlCacheEntryExA;     external winetdll name 'FindFirstUrlCacheEntryExA';
  2098. function FindFirstUrlCacheEntryExW;     external winetdll name 'FindFirstUrlCacheEntryExW';
  2099. function FindFirstUrlCacheEntryEx;     external winetdll name 'FindFirstUrlCacheEntryExA';
  2100. function FindNextUrlCacheEntryExA;      external winetdll name 'FindNextUrlCacheEntryExA';
  2101. function FindNextUrlCacheEntryExW;      external winetdll name 'FindNextUrlCacheEntryExW';
  2102. function FindNextUrlCacheEntryEx;      external winetdll name 'FindNextUrlCacheEntryExA';
  2103. function GetUrlCacheEntryInfoExA;       external winetdll name 'GetUrlCacheEntryInfoExA';
  2104. function GetUrlCacheEntryInfoExW;       external winetdll name 'GetUrlCacheEntryInfoExW';
  2105. function GetUrlCacheEntryInfoEx;       external winetdll name 'GetUrlCacheEntryInfoExA';
  2106. function HttpEndRequestA;               external winetdll name 'HttpEndRequestA';
  2107. function HttpEndRequestW;               external winetdll name 'HttpEndRequestW';
  2108. function HttpEndRequest;               external winetdll name 'HttpEndRequestA';
  2109. function InternetAttemptConnect;          external winetdll name 'InternetAttemptConnect';
  2110. function InternetAuthNotifyCallback;      external winetdll name 'InternetAuthNotifyCallback';
  2111. function InternetAutodial;                external winetdll name 'InternetAutodial';
  2112. function InternetAutodialHangup;          external winetdll name 'InternetAutodialHangup';
  2113. function InternetCheckConnectionA;      external winetdll name 'InternetCheckConnectionA';
  2114. function InternetCheckConnectionW;      external winetdll name 'InternetCheckConnectionW';
  2115. function InternetCheckConnection;      external winetdll name 'InternetCheckConnectionA';
  2116. function InternetDial;                    external winetdll name 'InternetDial';
  2117. function InternetGetConnectedState;       external winetdll name 'InternetGetConnectedState';
  2118. function InternetGoOnline;                external winetdll name 'InternetGoOnline';
  2119. function InternetHangUp;                  external winetdll name 'InternetHangUp';
  2120. function InternetLockRequestFile;         external winetdll name 'InternetLockRequestFile';
  2121. function InternetReadFileExA;           external winetdll name 'InternetReadFileExA';
  2122. function InternetReadFileExW;           external winetdll name 'InternetReadFileExW';
  2123. function InternetReadFileEx;           external winetdll name 'InternetReadFileExA';
  2124. function InternetSetDialState;            external winetdll name 'InternetSetDialState';
  2125. function InternetUnlockRequestFile;       external winetdll name 'InternetUnlockRequestFile';
  2126. function SetUrlCacheEntryGroup;           external winetdll name 'SetUrlCacheEntryGroup';
  2127. function HttpSendRequestExA;            external winetdll name 'HttpSendRequestExA';
  2128. function HttpSendRequestExW;            external winetdll name 'HttpSendRequestExW';
  2129. function HttpSendRequestEx;            external winetdll name 'HttpSendRequestExA';
  2130.  
  2131.  
  2132.  
  2133. function IS_GOPHER_FILE(GopherType: DWORD): BOOL;
  2134. begin
  2135.   Result := GopherType and GOPHER_TYPE_FILE_MASK = 0;
  2136. end;
  2137.  
  2138. function IS_GOPHER_DIRECTORY(GopherType: DWORD): BOOL;
  2139. begin
  2140.   Result := GopherType and GOPHER_TYPE_DIRECTORY = 0;
  2141. end;
  2142.  
  2143. function IS_GOPHER_PHONE_SERVER(GopherType: DWORD): BOOL;
  2144. begin
  2145.   Result := GopherType and GOPHER_TYPE_CSO = 0;
  2146. end;
  2147.  
  2148. function IS_GOPHER_ERROR(GopherType: DWORD): BOOL;
  2149. begin
  2150.   Result := GopherType and GOPHER_TYPE_ERROR = 0;
  2151. end;
  2152.  
  2153. function IS_GOPHER_INDEX_SERVER(GopherType: DWORD): BOOL;
  2154. begin
  2155.   Result := GopherType and GOPHER_TYPE_INDEX_SERVER = 0;
  2156. end;
  2157.  
  2158. function IS_GOPHER_TELNET_SESSION(GopherType: DWORD): BOOL;
  2159. begin
  2160.   Result := GopherType and GOPHER_TYPE_TELNET = 0;
  2161. end;
  2162.  
  2163. function IS_GOPHER_BACKUP_SERVER(GopherType: DWORD): BOOL;
  2164. begin
  2165.   Result := GopherType and GOPHER_TYPE_REDUNDANT = 0;
  2166. end;
  2167.  
  2168. function IS_GOPHER_TN3270_SESSION(GopherType: DWORD): BOOL;
  2169. begin
  2170.   Result := GopherType and GOPHER_TYPE_TN3270 = 0;
  2171. end;
  2172.  
  2173. function IS_GOPHER_ASK(GopherType: DWORD): BOOL;
  2174. begin
  2175.   Result := GopherType and GOPHER_TYPE_ASK = 0;
  2176. end;
  2177.  
  2178. function IS_GOPHER_PLUS(GopherType: DWORD): BOOL;
  2179. begin
  2180.   Result := GopherType and GOPHER_TYPE_GOPHER_PLUS = 0;
  2181. end;
  2182.  
  2183. function IS_GOPHER_TYPE_KNOWN(GopherType: DWORD): BOOL;
  2184. begin
  2185.   Result := GopherType and GOPHER_TYPE_UNKNOWN = 0;
  2186. end;
  2187.  
  2188. end.
  2189.