Determines the MIME type from the data provided.
HRESULT FindMimeFromData( LPBC pBC, LPCWSTR pwzUrl, LPVOID pBuffer, DWORD cbSize, LPCWSTR pwzMimeProposed, DWORD dwMimeFlags, LPWSTR *ppwzMimeOut, _Reserved_ DWORD dwReserved );
A pointer to the IBindCtx interface. Can be set to NULL.
A pointer to a string value that contains the URL of the data. Can be set to NULL if pBuffer contains the data to be sniffed.
A pointer to the buffer that contains the data to be sniffed. Can be set to NULL if pwzUrl contains a valid URL.
An unsigned long integer value that contains the size of the buffer.
A pointer to a string value that contains the proposed MIME type. This value is authoritative if type cannot be determined from the data. If the proposed type contains a semi-colon (;) it is removed. This parameter can be set to NULL.
No flags specified. Use default behavior for the function.
Treat the specified pwzUrl as a file name.
Internet Explorer 6 for Windows XP SP2 and later. Use MIME-type detection even if FEATURE_MIME_SNIFFING is detected. Usually, this feature control key would disable MIME-type detection.
Internet Explorer 6 for Windows XP SP2 and later. Perform MIME-type detection if "text/plain" is proposed, even if data sniffing is otherwise disabled. Plain text may be converted to
text/html if HTML tags are detected.
Internet Explorer 8. Use the authoritative MIME type specified in pwzMimeProposed. Unless FMFD_IGNOREMIMETEXTPLAIN is specified, no data sniffing is performed.
Internet Explorer 9. Do not perform detection if "text/plain" is specified in pwzMimeProposed.
Internet Explorer 9. Returns
image/jpeg instead of
The address of a string value that receives the suggested MIME type.
Reserved. Must be set to 0.
This function can return one of these values.
The operation completed successfully.
The operation failed.
One or more arguments are invalid.
There is insufficient memory to complete the operation.
MIME type detection, or "data sniffing," refers to the process of determining an appropriate MIME type from binary data. The final result depends on a combination of server-supplied MIME type headers, file name extension, and/or the data itself. Usually, only the first 256 bytes of data are significant. For more information and a complete list of recognized MIME types, see MIME Type Detection in Internet Explorer.
If pwzUrl is specified without data to be sniffed (pBuffer), the file name extension determines the MIME type. If the file name extension cannot be mapped to a MIME type, this method returns E_FAIL unless a proposed MIME type is supplied in pwzMimeProposed.
After ppwzMimeOut returns and is read, the memory allocated for it should be freed with the operator delete function.
Internet Explorer 8 and later. FindMimeFromData will not promote image types to "text/html" even if the data lacks signature bytes.
Minimum supported client
Minimum supported server
Windows 2000 Server
Internet Explorer 4.0