1.InternetOpen Function
Initializes an application's use of the WinINet functions.
Syntax
HINTERNET InternetOpen(
__in LPCTSTR lpszAgent,
__in DWORD dwAccessType,
__in LPCTSTR lpszProxyName,
__in LPCTSTR lpszProxyBypass,
__in DWORD dwFlags
);
hSession = ::InternetOpen(_T("star"), PRE_CONFIG_INTERNET_ACCESS, _T(""),INTERNET_INVALID_PORT_NUMBER,0 );
if(hSession == NULL)
{
return -1;
}
2.InternetConnectA (WININET.@)
SYNOPSIS
HINTERNET InternetConnectA
(
HINTERNET hInternet,
LPCSTR lpszServerName,
INTERNET_PORT nServerPort,
LPCSTR lpszUserName,
LPCSTR lpszPassword,
DWORD dwService,
DWORD dwFlags,
DWORD_PTR dwContext
)
DESCRIPTION
Open a ftp, gopher or http session.
RETURNS
HINTERNET a session handle on success NULL on failure
IMPLEMENTATION
Defined in "wininet.h".
hConnectFTP = ::InternetConnectA( hSession, sUrl.c_str(), INTERNET_DEFAULT_FTP_PORT, "sc", "sc123456", INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0 );
if (hConnectFTP == NULL)
{
return -1;
}
3.
FtpOpenFileA (WININET.@)
SYNOPSIS
HINTERNET FtpOpenFileA
(
HINTERNET hFtpSession,
LPCSTR lpszFileName,
DWORD fdwAccess,
DWORD dwFlags,
DWORD_PTR dwContext
)
DESCRIPTION
Open a remote file for writing or reading.
RETURNS
HINTERNET handle on success NULL on failure
IMPLEMENTATION
Defined in "wininet.h".
HINTERNET hOpenFile = ::FtpOpenFileA( hConnectFTP, (string("./") + sPath).c_str() , GENERIC_READ, FTP_TRANSFER_TYPE_ASCII, 0 ); //ServerUpdate4.ini ./20081027/0_116_115517.dat
4.FtpGetFileSize Function
Retrieves the file size of the requested FTP resource.
Syntax
DWORD FtpGetFileSize(
__in HINTERNET hFile,
__out LPDWORD lpdwFileSizeHigh
);
Parameters
hFile [in]
Handle returned from a call to FtpOpenFile.
lpdwFileSizeHigh [out]
Pointer to the high-order unsigned long integer of the file size of the requested FTP resource.
Return Value
Returns the low-order unsigned long integer of the file size of the requested FTP resource.
DWORD filesize = FtpGetFileSize(hOpenFile , NULL) ;
5.CreateDirectory
This function creates a new directory. If the underlying file system supports security on files and directories, the function applies a specified security descriptor to the new directory.
A RAPI version of this function exists, and it is named CeCreateDirectory (RAPI).
BOOL CreateDirectory(
LPCTSTR lpPathName,
LPSECURITY_ATTRIBUTES lpSecurityAttributes
);
Parameters
lpPathName
[in] Long pointer to a null-terminated string that specifies the path of the directory to be created.
There is a default string size limit for paths of MAX_PATH characters. This limit is related to how the CreateDirectory function parses paths.
lpSecurityAttributes
[in] Ignored; set to NULL.
Return Values
Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.
Remarks
Some file systems, such as NTFS file system, support compression or encryption for individual files and directories. On volumes formatted for such a file system, a new directory inherits the compression and encryption attributes of its parent directory.
Requirements
OS Versions: Windows CE 1.0 and later.
Header: Winbase.h.
Link Library: Coredll.lib.
See Also
CeCreateDirectory (RAPI) | CreateFile | RemoveDirectory
6.InternetCloseHandle