CreateUrlCacheEntryA function

Creates a local file name for saving the cache entry based on the specified URL and the file name extension.

Syntax

BOOLAPI CreateUrlCacheEntryA(
  LPCSTR lpszUrlName,
  DWORD  dwExpectedFileSize,
  LPCSTR lpszFileExtension,
  LPSTR  lpszFileName,
  DWORD  dwReserved
);

Parameters

lpszUrlName

Pointer to a string value that contains the name of the URL. The string must contain a value; an empty string will cause CreateUrlCacheEntry to fail. In addition, the string must not contain any escape characters.

dwExpectedFileSize

Expected size of the file needed to store the data that corresponds to the source entity, in TCHARs. If the expected size is unknown, set this value to zero.

lpszFileExtension

Pointer to a string value that contains an extension name of the file in the local storage.

lpszFileName

Pointer to a buffer that receives the file name. The buffer should be large enough to store the path of the created file (at least MAX_PATH characters in length).

dwReserved

This parameter is reserved and must be 0.

Return Value

If the function succeeds, the function returns TRUE.

If the function fails, it returns FALSE. To get extended error information, call GetLastError.

Remarks

After CreateUrlCacheEntry is called, the application can write directly into the file in local storage. When the file is completely received, the caller should call CommitUrlCacheEntry to commit the entry in the cache.

WinINet attempts to decode Unicode parameters according to the system code page. Applications should ensure that Unicode parameters are properly encoded for the system code page. Applications can set the system code page with InternetSetOption as shown in the following code example:

DWORD CP_SHIFT_JIS = 932;  // ANSI/OEM  Japanese, Shift-JIS
InternetSetOption( hRequest, 
                   INTERNET_OPTION_CODEPAGE,
                   &CP_SHIFT_JIS, 
                   sizeof(DWORD) );

If the Unicode parameter is not properly encoded to the system code page, WinINet attempts UTF8 decoding.

When items are retrieved from the cache, the system code page that was used to place the item in the cache must match the current system code page for the user. For applications running under IE6 and earlier, if decoding for the system code page fails, WinINet attempts UTF8 decoding.

Like all other aspects of the WinINet API, this function cannot be safely called from within DllMain or the constructors and destructors of global objects.

Note  WinINet does not support server implementations. In addition, it should not be used from a service. For server implementations or services use Microsoft Windows HTTP Services (WinHTTP).
 

Requirements

   
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wininet.h
Library Wininet.lib
DLL Wininet.dll

See Also

Caching

CommitUrlCacheEntry

WinINet Functions