General Win32 Internet Functions

General Win32 Internet Functions


The general Win32 Internet functions described in this section perform basic Internet file manipulations.
InternetAttemptConnect
InternetCheckConnection
InternetCloseHandle
InternetConfirmZoneCrossing
InternetConnect
InternetErrorDlg
InternetFindNextFile
InternetGetLastResponseInfo
InternetLockRequestFile
InternetOpen
InternetQueryDataAvailable
InternetQueryOption
InternetReadFile
InternetReadFileEx
InternetSetFilePointer
InternetSetOption
InternetSetOptionEx
InternetSetStatusCallback
InternetTimeFromSystemTime
InternetTimeToSystemTime
InternetUnlockRequestFile
InternetWriteFile

InternetAttemptConnect

DWORD InternetAttemptConnect(
    IN DWORD dwReserved
);

Attempts to make a connection to the Internet.

dwReserved
Reserved; must be zero.

This function allows an application to first attempt to connect before issuing any requests. A client program can use this to evoke the dialup dialog box. If the attempt fails, the application should enter offline mode.

InternetCheckConnection

BOOL InternetCheckConnection(
    IN LPCSTR lpszUrl,
    IN DWORD dwFlags,
    IN DWORD dwReserved
);

Allows an application to check if a connection to the Internet can be established.

lpszUrl
Address of a string containing the Uniform Resource Locator (URL) to use to check the connection. This value can be set to NULL.
dwFlags
Unsigned long integer value containing the flag values. FLAG_ICC_FORCE_CONNECTION is the only flag that is currently available. If this flag is set, it forces a connection. A sockets connection is attempted in the following order:
  • If lpszUrl is non-NULL, the host value is extracted from it and used to ping that specific host.
  • If lpszUrl is NULL and there is an entry in WinInet's internal server database for the nearest sever, the host value is extracted from the entry and used to ping that server.
dwReserved
Reserved, must be zero.

InternetCloseHandle

BOOL InternetCloseHandle(
    IN HINTERNET hInet
);

Closes a single Internet handle.

hInet
Valid Internet handle to be closed.

The function terminates any pending operations on the handle and discards any outstanding data. If a thread is blocking a call to Wininet.dll, another thread in the application can call InternetCloseHandle on the Internet handle being used by the first thread to cancel the operation and unblock the first thread.

If there is a status callback registered for the handle being closed and the handle was created with a non-NULL context value, an INTERNET_STATUS_HANDLE_CLOSING callback will be made. This indication will be the last callback made from a handle and indicates that the handle is being destroyed.

If asynchronous requests are pending for the handle or any of its child handles, the handle cannot be closed immediately, but it will be invalidated. Any new requests attempted using the handle will return with an ERROR_INVALID_HANDLE notification. The asynchronous requests will complete with INTERNET_STATUS_REQUEST_COMPLETE. Applications must be prepared to receive any INTERNET_STATUS_REQUEST_COMPLETE indications on the handle before the final INTERNET_STATUS_HANDLE_CLOSING indication is made, which indicates that the handle is completely closed.

An application can call GetLastError to determine if requests are pending. If GetLastError returns ERROR_IO_PENDING, there were outstanding requests when the handle was closed.

See also FtpFindFirstFile, FtpOpenFile, GopherFindFirstFile, HttpOpenRequest, InternetConnect

InternetConfirmZoneCrossing

DWORD InternetConfirmZoneCrossing(
    IN HWND hWnd,
    IN LPSTR szUrlPrev,
    IN LPSTR szUrlNew,
    IN BOOL bPost
); 

Checks for changes between secure and nonsecure URLs. When a change occurs in security between two URLs, an application should allow the user to acknowledge this change, typically by displaying a dialog box.

hWnd
Handle to the parent window for any needed dialog box.
szUrlPrev
URL that was viewed before the current request was made.
szUrlNew
New URL that the user has requested to view.
bPost
TRUE if a post is being made in this request. This flag is ignored in this release.

InternetConnect

HINTERNET InternetConnect(
    IN HINTERNET hInternetSession,
    IN LPCSTR lpszServerName,
    IN INTERNET_PORT nServerPort,
    IN LPCSTR lpszUsername,
    IN LPCSTR lpszPassword,
    IN DWORD dwService,
    IN DWORD dwFlags,
    IN DWORD dwContext
);

Opens an FTP, Gopher, or HTTP session for a given site.

hInternetSession
Handle to the current Internet session. The handle must have been returned by a previous call to InternetOpen.
lpszServerName
Address of a null-terminated string that contains the host name of an Internet server. Alternately, the string can contain the IP number of the site in ASCII dotted-decimal format (for example, 11.0.1.45).
nServerPort
Number of the TCP/IP port on the server to connect to. Can be one of the values in the following list. These flags set only the port that will be used. The service is set by the value of dwService.
INTERNET_DEFAULT_FTP_PORT Uses the default port for FTP servers (port 21).
INTERNET_DEFAULT_GOPHER_PORT Uses the default port for Gopher servers (port 70).
INTERNET_DEFAULT_HTTP_PORT Uses the default port for HTTP servers (port 80).
INTERNET_DEFAULT_HTTPS_PORT Uses the default port for HTTPS servers (port 443).
INTERNET_DEFAULT_SOCKS_PORT Uses the default port for SOCKS firewall servers (port 1080).
INTERNET_INVALID_PORT_NUMBER Uses the default port for the service specified by dwService.
lpszUsername
Address of a null-terminated string that contains the name of the user to log on. If this parameter is NULL, the function uses an appropriate default, except for HTTP; a NULL parameter in HTTP causes the server to return an error. For the FTP protocol, the default is "anonymous".
lpszPassword
Address of a null-terminated string that contains the password to use to log on. If both lpszPassword and lpszUsername are NULL, the function uses the default "anonymous" password. In the case of FTP, the default password is the user's e-mail name. If lpszPassword is NULL, but lpszUsername is not NULL, the function uses a blank password. The following table describes the behavior for the four possible settings of lpszUsername and lpszPassword.
lpszUsername lpszPassword User name sent to FTP server Password sent to FTP server
NULL NULL "anonymous" User's e-mail name
Non-NULL string NULL lpszUsername ""
NULL Non-NULL string ERROR ERROR
Non-NULL string Non-NULL string lpszUsername lpszPassword
dwService
Type of service to access. Can be one of the following values:
INTERNET_SERVICE_FTP FTP service.
INTERNET_SERVICE_GOPHER Gopher service.
INTERNET_SERVICE_HTTP HTTP service.
dwFlags
Flags specific to the service used. When the value of dwService is INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE causes the application to use passive FTP semantics.
dwContext
Application-defined value that is used to identify the application context for the returned handle in callbacks.

The InternetConnect function is required before communicating with any Internet service.

Having a connect function for all protocols, even those that do not use persistent connections, lets an application communicate common information about several requests by using a single function call. In addition, this allows for future versions of Internet protocols that do not require a connection to be established for every client request.

For FTP sites, InternetConnect actually establishes a connection with the server; for others, such as Gopher, the actual connection is not established until the application requests a specific transaction.

For maximum efficiency, applications using the Gopher and HTTP protocols should try to minimize calls to InternetConnect and avoid calling this function for every transaction requested by the user. One way to accomplish this is to keep a small cache of handles returned from InternetConnect; when the user makes a request to a previously accessed server, that session handle is still available.

An application that needs to display multiline text information sent by an FTP server can use InternetGetLastResponseInfo to retrieve the text.

For FTP connections, if lpszUsername is NULL, InternetConnect sends the string "anonymous" as the user name. If lpszPassword is NULL, InternetConnect attempts to use the user's e-mail name as the password.

To close the handle returned from InternetConnect, the application should call InternetCloseHandle. This function disconnects the client from the server and frees all resources associated with the connection.

InternetErrorDlg

DWORD InternetErrorDlg(
    IN HWND hWnd,
    IN OUT HINTERNET hInternet,
    IN DWORD dwError,
    IN DWORD dwFlags,
    IN OUT LPVOID *lppvData
);

Displays a dialog box for the error that is passed to InternetErrorDlg, if an appropriate dialog box exists. If the FLAGS_ERROR_UI_FILTER_FOR_ERRORS flag is used, the function also checks the headers for any hidden errors and displays a dialog box if needed.

hWnd
Handle to the parent window for any needed dialog box. This parameter can be NULL if no dialog box is needed.
hInternet
Handle to the Internet connection used in the call to HttpSendRequest.
dwError
Error value for which to display a dialog box. Can be one of the following values:
ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR
Notifies the user of the zone crossing to and from a secure site.
ERROR_INTERNET_INCORRECT_PASSWORD
Displays a dialog box for obtaining the user's name and password. (On Microsoft Windows® 95, the function first attempts to use any cached authentication information for the server being accessed, before displaying a dialog box.)
ERROR_INTERNET_INVALID_CA
Notifies the user that the Win32 Internet function does not recognize the certificate authority that generated the certificate for this Secure Sockets Layer (SSL) site.
ERROR_INTERNET_POST_IS_NON_SECURE
Displays a warning about posting data to the server through a nonsecure connection.
ERROR_INTERNET_SEC_CERT_CN_INVALID
Indicates that the SSL certificate Common Name (hostname field) is incorrect. Displays an Invalid SSL Common Name dialog box, and lets the user view the incorrect certificate. Also allows the user to select a certificate in response to a server request.
ERROR_INTERNET_SEC_CERT_DATE_INVALID
Tells the user that the SSL certificate has expired.
dwFlags
Action flags. Can be a combination of these values:
FLAGS_ERROR_UI_FILTER_FOR_ERRORS
Scans the returned headers for errors. Call after using HttpSendRequest. This option detects any hidden errors, such as an authentication error.
FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS
If the function succeeds, stores the results of the dialog box in the Internet handle.
FLAGS_ERROR_UI_FLAGS_GENERATE_DATA
Queries the Internet handle for needed information. The function constructs the appropriate data structure for the error. (For example, for Cert CN failures, the function grabs the certificate.)
FLAGS_ERROR_UI_SERIALIZE_DIALOGS
Serializes authentication dialog boxes for concurrent requests on a password cache entry. The lppvData parameter should contain the address of a pointer to an INTERNET_AUTHNOTIFY_DATA structure, and the client should implement a thread-safe, nonblocking callback function.
lppvData
Address of a data structure. The structure can be different for each error that needs to be handled.

Authentication errors are hidden, since the call to HttpSendRequest will complete successfully, but the status code would indicate that the proxy or server requires authentication. The FLAGS_ERROR_UI_FILTER_FOR_ERRORS flag causes the function to search the headers for status codes that indicate that user input is needed.

InternetFindNextFile

BOOL InternetFindNextFile(
    IN HINTERNET hFind,
    OUT LPVOID lpvFindData
);

Continues a file search started as a result of a previous call to FtpFindFirstFile or GopherFindFirstFile.

hFind
Valid handle returned from either FtpFindFirstFile or GopherFindFirstFile, or InternetOpenUrl (directories only).
lpvFindData
Address of the buffer that receives information about the found file or directory. The format of the information placed in the buffer depends on the protocol in use. The FTP protocol returns a WIN32_FIND_DATA structure, and the Gopher protocol returns a GOPHER_FIND_DATA structure.

InternetGetLastResponseInfo

BOOL InternetGetLastResponseInfo(
    OUT LPDWORD lpdwError,
    OUT LPSTR lpszBuffer,
    IN OUT LPDWORD lpdwBufferLength
);

Retrieves the last Win32 Internet function error description or server response on the thread calling this function.

lpdwError
Address of a variable that receives an error message pertaining to the operation that failed.
lpszBuffer
Address of a buffer that receives the error text.
lpdwBufferLength
Size of the lpszBuffer buffer. When the function returns, this parameter contains the size of the string written to the buffer.

The FTP and Gopher protocols can return additional text information along with most errors. This extended error information can be retrieved by using the InternetGetLastResponseInfo function whenever GetLastError returns ERROR_INTERNET_EXTENDED_ERROR (occurring after an unsuccessful function call).

The buffer pointed to by lpszBuffer must be large enough to hold both the error string and a zero terminator at the end of the string. However, note that the value returned in lpdwBufferLength does not include the terminating zero.

InternetGetLastResponseInfo can be called multiple times until another Win32 Internet function is called on this thread. When another function is called, the internal buffer that is storing the last response information is cleared.

InternetLockRequestFile

BOOL InternetLockRequestFile (
    IN HINTERNET hInternet,
    OUT HANDLE *lphLockReqHandle
);

Allows the user to place a lock on the file that is being used.

hInternet
HINTERNET handle returned by FtpOpenFile, GopherOpenFile, HttpOpenRequest, or InternetOpenUrl.
lphLockReqHandle
Address of a handle to store the lock request handle.

If the HINTERNET handle passed to hInternet was created using INTERNET_FLAG_NO_CACHE_WRITE or INTERNET_FLAG_DONT_CACHE, the function creates a temporary file with the extension TMP, unless it is an HTTPS resource. If the handle was created using INTERNET_FLAG_NO_CACHE_WRITE or INTERNET_FLAG_DONT_CACHE and it is accessing an HTTPS resource, InternetLockRequestFile fails.

See also InternetUnlockRequestFile

InternetOpen

HINTERNET InternetOpen(
    IN LPCSTR lpszAgent,
    IN DWORD dwAccessType,
    IN LPCSTR lpszProxyName,
    IN LPCSTR lpszProxyBypass,
    IN DWORD dwFlags
);

Initializes an application's use of the Win32 Internet functions.

lpszAgent
Address of a string that contains the name of the application or entity calling the Internet functions (for example, Microsoft Internet Explorer). This name is used as the user agent in the HTTP protocol.
dwAccessType
Type of access required. Can be one of the following values:
INTERNET_OPEN_TYPE_DIRECT
Resolves all host names locally.
INTERNET_OPEN_TYPE_PRECONFIG
Retrieves the proxy or direct configuration from the registry.
INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY
Retrieves the proxy or direct configuration from the registry and prevents the use of a startup JScript or Internet Setup (INS) file.
INTERNET_OPEN_TYPE_PROXY
Passes requests to the proxy unless a proxy bypass list is supplied and the name to be resolved bypasses the proxy. In this case, the function uses INTERNET_OPEN_TYPE_DIRECT.
lpszProxyName
Address of a string that contains the name of the proxy server (or servers) to use if proxy access was specified. If this parameter is NULL, the function reads proxy information from the registry. Do not use an empty string, because InternetOpen will use it as the proxy name. The Win32 Internet functions only recognize CERN type proxies (HTTP only) and the TIS FTP gateway (FTP only). If Microsoft Internet Explorer is installed, the Win32 Internet functions also support SOCKS proxies. FTP and Gopher requests can be made through a CERN type proxy either by changing them to an HTTP request or by using InternetOpenUrl.
lpszProxyBypass
Address of an optional list of host names or IP addresses, or both, that should not be routed through the proxy. The list can contain wildcards. Do not use an empty string, because InternetOpen will use it as the proxy bypass list. If this parameter specifies the "<local>" macro as the only entry, the function bypasses any host name that does not contain a period. If this parameter is NULL, the function reads the bypass list from the registry.
dwFlags
Flags that indicate various options affecting the behavior of the function. Can be a combination of these values:
INTERNET_FLAG_ASYNC
INTERNET_FLAG_FROM_CACHE
INTERNET_FLAG_OFFLINE

InternetOpen is the first Win32 Internet function called by an application. It tells the Internet DLL to initialize internal data structures and prepare for future calls from the application. When the application finishes using the Internet functions, it should call InternetCloseHandle to free the handle and any associated resources.

The application can make any number of calls to InternetOpen, although a single call is normally sufficient. The application might need to have separate behaviors defined for each InternetOpen instance, such as different proxy servers configured for each.

InternetQueryDataAvailable

BOOL InternetQueryDataAvailable( 
    IN HINTERNET hFile,
    OUT LPDWORD lpdwNumberOfBytesAvailable,
    IN DWORD dwFlags,
    IN DWORD dwContext
);

Queries the amount of data available.

hFile
Valid Internet file handle, as returned by InternetOpenUrl, FtpOpenFile, GopherOpenFile, or HttpOpenRequest.
lpdwNumberOfBytesAvailable
Optional. Address of a variable that receives the number of available bytes.
dwFlags
Reserved; must be zero.
dwContext
Reserved; must be zero.

This function returns the number of bytes of data that are available to be read immediately by a subsequent call to InternetReadFile. If there is currently no data available and the end of the file has not been reached, the request waits until data becomes available. The amount of data remaining will not be recalculated until all available data indicated by the call to InternetQueryDataAvailable is read.

For HINTERNET handles created by HttpOpenRequest and sent by HttpSendRequestEx, a call to HttpEndRequest must be made on the handle before InternetQueryDataAvailable can be used.

InternetQueryOption

BOOL InternetQueryOption(
    IN HINTERNET hInternet,
    IN DWORD dwOption,
    OUT LPVOID lpBuffer,
    IN OUT LPDWORD lpdwBufferLength
);

Queries an Internet option on the specified handle.

hInternet
Internet handle on which to query information.
dwOption
Internet option to query. Can be one of the Option Flags values.
lpBuffer
Address of a buffer that receives the option setting.
lpdwBufferLength
Address of a variable that contains the length of lpBuffer. When the function returns, the variable receives the length of the data placed into lpBuffer. If GetLastError returns ERROR_INSUFFICIENT_BUFFER, this parameter receives the number of bytes required to hold the created URL.

See also FtpGetFile, FtpPutFile, InternetConnect, InternetOpen, InternetSetOption

InternetReadFile

BOOL InternetReadFile(
    IN HINTERNET hFile,
    IN LPVOID lpBuffer,
    IN DWORD dwNumberOfBytesToRead,
    OUT LPDWORD lpNumberOfBytesRead
);

Reads data from a handle opened by the InternetOpenUrl, FtpOpenFile, GopherOpenFile, or HttpOpenRequest function.

hFile
Valid handle returned from a previous call to InternetOpenUrl, FtpOpenFile, GopherOpenFile, or HttpOpenRequest.
lpBuffer
Address of a buffer that receives the data read.
dwNumberOfBytesToRead
Number of bytes to read.
lpNumberOfBytesRead
Address of a variable that receives the number of bytes read. InternetReadFile sets this value to zero before doing any work or error checking.

If the return value is TRUE and the number of bytes read is zero, the transfer has been completed and there are no more bytes to read on the handle. This is analogous to reaching EOF in a local file. Call InternetCloseHandle to free the connection to the server.

The buffer pointed to by lpBuffer is not always filled by calls to InternetReadFile (sufficient data might not have arrived from the server). When reading HTML data, for the first read posted, the buffer must be large enough to hold the HTML headers. When reading HTML-encoded directory entries, the buffer must be large enough to hold at least one complete entry.

When the item being read is also being cached by a Win32 Internet function, the application must ensure that a read is made for end-of-file so the cache file is committed correctly.

This function always fulfills the user's request. If more data is requested than is available, the function waits until enough data to complete the request is available. The only time that less data is returned than requested is when the end of the file has been reached.

This function can also be used to retrieve FTP and Gopher directory listings as an HTML document on a handle opened by InternetOpenUrl. The INTERNET_FLAG_RAW_DATA value must not have been specified in the call to InternetOpenUrl.

If the HINTERNET handle stored in hFile was created by HttpOpenRequest and sent by HttpSendRequestEx, a call to HttpEndRequest must be made on the handle before InternetReadFile is used.

InternetReadFileEx

InternetReadFileEx(
    IN HINTERNET hFile,
    OUT LPINTERNET_BUFFERS lpBuffersOut,
    IN DWORD dwFlags,
    IN DWORD dwContext
);

Reads data from a handle opened by the InternetOpenUrl, FtpOpenFile, GopherOpenFile, or HttpOpenRequest function.

hFile
HINTERNET handle returned by the InternetOpenUrl, FtpOpenFile, GopherOpenFile, or HttpOpenRequest function.
lpBuffersOut
Address of an INTERNET_BUFFERS structure that contains the data downloaded.
dwFlags
DWORD variable that contains the flags controlling the download. Can be one of the following values:
IRF_ASYNC Identical to WININET_API_FLAG_ASYNC.
IRF_SYNC Identical to WININET_API_FLAG_SYNC.
IRF_USE_CONTEXT Identical to WININET_API_FLAG_USE_CONTEXT.
IRF_NO_WAIT Do not wait for data. If there is data available, the function returns either the amount of data requested or the amount of data available (whichever is smaller).
dwContext
DWORD variable that contains the context value used for asynchronous operations.

InternetSetFilePointer

DWORD InternetSetFilePointer(
    IN HINTERNET hFile,
    IN LONG lDistanceToMove,
    IN PVOID pReserved,
    IN DWORD dwMoveMethod,
    IN DWORD dwContext
);

Sets a file position for InternetReadFile. This is a synchronous call; however, subsequent calls to InternetReadFile may block or return pending if the data is not available from the cache and the server does not support random access.

hFile
Valid handle returned from a previous call to InternetOpenUrl (on an HTTP or HTTPS URL) or HttpOpenRequest (using the GET or HEAD method and passed to HttpSendRequest or HttpSendRequestEx). This handle must not have been created with the INTERNET_FLAG_DONT_CACHE or INTERNET_FLAG_NO_CACHE_WRITE value set.
lDistanceToMove
Number of bytes to move the file pointer. A positive value moves the pointer forward in the file, and a negative value moves it backward.
pReserved
Reserved; must be NULL.
dwMoveMethod
Starting point for the file pointer move. Can be one of the following values:
FILE_BEGIN The starting point is zero or the beginning of the file. If FILE_BEGIN is specified, lDistanceToMove is interpreted as an unsigned location for the new file pointer.
FILE_CURRENT The current value of the file pointer is the starting point.
FILE_END The current end-of-file position is the starting point. This method fails if the content length is unknown.
dwContext
Reserved; must be zero.

This function cannot be used once the end of file has been reached by InternetReadFile.

For HINTERNET handles created by HttpOpenRequest and sent by HttpSendRequestEx, a call to HttpEndRequest must be made on the handle before InternetSetFilePointer is used.

InternetSetFilePointer cannot be used reliably if the content length is unknown and with chunked transfers.

InternetSetOption

BOOL InternetSetOption(
    IN HINTERNET hInternet,
    IN DWORD dwOption,
    IN LPVOID lpBuffer,
    IN DWORD dwBufferLength
);

Sets an Internet option.

hInternet
Internet handle on which to set information.
dwOption
Internet option to set. Can be one of the Option Flags values.
lpBuffer
Address of a buffer that contains the option setting.
dwBufferLength
Length of the lpBuffer buffer.

See also FtpGetFile, FtpPutFile, InternetConnect, InternetOpen, InternetQueryOption

InternetSetOptionEx

Not currently implemented.

InternetSetStatusCallback

INTERNET_STATUS_CALLBACK InternetSetStatusCallback(
    IN HINTERNET hInternet,
    IN INTERNET_STATUS_CALLBACK lpfnInternetCallback
);

Sets up a callback function that Win32 Internet functions can call as progress is made during an operation.

hInternet
Handle for which the callback is to be set.
lpfnInternetCallback
Address of the callback function to call when progress is made, or to return NULL to remove the existing callback function. For more information about the callback function, see INTERNET_STATUS_CALLBACK.

Both synchronous and asynchronous functions use the callback function to indicate the progress of the request, such as resolving a name, connecting to a server, and so on. The callback function is required for an asynchronous operation. The asynchronous request will call back to the application with INTERNET_STATUS_REQUEST_COMPLETE to indicate the request has been completed.

A callback function can be set on any handle, and is inherited by derived handles. A callback function can be changed using InternetSetStatusCallback, providing there are no pending requests that need to use the previous callback value. Note, however, that changing the callback function on a handle does not change the callbacks on derived handles, such as that returned by InternetConnect. You must change the callback function at each level.

Many of the Win32 Internet functions perform several operations on the network. Each operation can take time to complete, and each can fail.

It is sometimes desirable to display status information during a long-term operation. You can display status information by setting up an Internet status callback function that cannot be removed as long as any callbacks or any asynchronous functions are pending.

After initiating InternetSetStatusCallback, the callback function can be accessed from within any Win32 Internet function for monitoring time-intensive network operations.

InternetTimeFromSystemTime

BOOL InternetTimeFromSystemTime(
    IN  CONST SYSTEMTIME *pst,
    IN  DWORD dwRFC,
    OUT LPSTR lpszTime,
    IN  DWORD cbTime
);

Formats a date and time according to the specified RFC format (as specified in the HTTP version 1.0 specification).

pst
Address of a SYSTEMTIME structure that contains the date and time to format.
dwRFC
RFC format used. Currently, the only valid format is INTERNET_RFC1123_FORMAT.
lpszTime
Address of a buffer that receives the formatted date and time. The buffer should be of size INTERNET_RFC1123_BUFSIZE.
cbTime
Size, in bytes, of the lpszTime buffer.

InternetTimeToSystemTime

BOOL InternetTimeToSystemTime(
    IN LPCSTR lpszTime,
    OUT SYSTEMTIME *pst,
    IN DWORD dwReserved
);

Takes an HTTP time/date string and converts it to a SYSTEMTIME structure.

lpszTime
Address of a null-terminated date/time string to convert.
pst
Address of the pointer to the converted time.
dwReserved
Reserved; must be zero.

InternetUnlockRequestFile

BOOL InternetUnlockRequestFile (
    IN HANDLE hLockHandle
);

Unlocks a file that was locked using InternetLockRequestFile.

hLockHandle
Lock request handle that was returned by InternetLockRequestFile.

InternetWriteFile

BOOL InternetWriteFile(
    IN HINTERNET hFile,
    IN LPCVOID lpBuffer,
    IN DWORD dwNumberOfBytesToWrite,
    OUT LPDWORD lpdwNumberOfBytesWritten
);

Writes data to an open Internet file.

hFile
Valid handle returned from a previous call to FtpOpenFile or an HINTERNET handle sent by HttpSendRequestEx.
lpBuffer
Address of a buffer that contains the data to be written to the file.
dwNumberOfBytesToWrite
Number of bytes to write to the file.
lpdwNumberOfBytesWritten
Address of a variable that receives the number of bytes written to the buffer. InternetWriteFile sets this value to zero before doing any work or error checking.

When the application is sending data, it must call InternetCloseHandle to end the data transfer.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.