mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-15 04:41:45 +00:00
urlmon: Added ObtainUserAgentString implementation.
This commit is contained in:
parent
3700d27960
commit
cef7e04f18
|
@ -631,6 +631,39 @@ HRESULT WINAPI UrlMkSetSessionOption(DWORD dwOption, LPVOID pBuffer, DWORD dwBuf
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* ObtainUserAgentString (URLMON.@)
|
||||
*/
|
||||
HRESULT WINAPI ObtainUserAgentString(DWORD dwOption, LPSTR pcszUAOut, DWORD *cbSize)
|
||||
{
|
||||
DWORD size;
|
||||
HRESULT hres = E_FAIL;
|
||||
|
||||
TRACE("(%d %p %p)\n", dwOption, pcszUAOut, cbSize);
|
||||
|
||||
if(!pcszUAOut || !cbSize)
|
||||
return E_INVALIDARG;
|
||||
|
||||
EnterCriticalSection(&session_cs);
|
||||
|
||||
ensure_useragent();
|
||||
if(user_agent) {
|
||||
size = WideCharToMultiByte(CP_ACP, 0, user_agent, -1, NULL, 0, NULL, NULL);
|
||||
|
||||
if(size <= *cbSize) {
|
||||
WideCharToMultiByte(CP_ACP, 0, user_agent, -1, pcszUAOut, *cbSize, NULL, NULL);
|
||||
hres = S_OK;
|
||||
}else {
|
||||
hres = E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
*cbSize = size;
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&session_cs);
|
||||
return hres;
|
||||
}
|
||||
|
||||
void free_session(void)
|
||||
{
|
||||
heap_free(user_agent);
|
||||
|
|
|
@ -362,31 +362,6 @@ HRESULT WINAPI DllRegisterServerEx(void)
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
static const CHAR Agent[] = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)";
|
||||
|
||||
/**************************************************************************
|
||||
* ObtainUserAgentString (URLMON.@)
|
||||
*/
|
||||
HRESULT WINAPI ObtainUserAgentString(DWORD dwOption, LPSTR pcszUAOut, DWORD *cbSize)
|
||||
{
|
||||
FIXME("(%d, %p, %p): stub\n", dwOption, pcszUAOut, cbSize);
|
||||
|
||||
if (pcszUAOut == NULL || cbSize == NULL)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (*cbSize < sizeof(Agent))
|
||||
{
|
||||
*cbSize = sizeof(Agent);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
if (sizeof(Agent) < *cbSize)
|
||||
*cbSize = sizeof(Agent);
|
||||
lstrcpynA(pcszUAOut, Agent, *cbSize);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* IsValidURL (URLMON.@)
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue