urlmon: Improve ObtainUserAgentString conformance to native.

This commit is contained in:
Misha Koshelev 2007-07-09 21:49:58 -05:00 committed by Alexandre Julliard
parent 17ba74195b
commit e4282a59dd

View file

@ -304,13 +304,18 @@ HRESULT WINAPI ObtainUserAgentString(DWORD dwOption, LPSTR pcszUAOut, DWORD *cbS
{ {
FIXME("(%d, %p, %p): stub\n", dwOption, pcszUAOut, cbSize); FIXME("(%d, %p, %p): stub\n", dwOption, pcszUAOut, cbSize);
if(dwOption) { if (pcszUAOut == NULL || cbSize == NULL)
ERR("dwOption: %d, must be zero\n", dwOption); return E_INVALIDARG;
if (*cbSize < sizeof(Agent))
{
*cbSize = sizeof(Agent);
return E_OUTOFMEMORY;
} }
if (sizeof(Agent) < *cbSize) if (sizeof(Agent) < *cbSize)
*cbSize = sizeof(Agent); *cbSize = sizeof(Agent);
lstrcpynA(pcszUAOut, Agent, *cbSize); lstrcpynA(pcszUAOut, Agent, *cbSize);
return S_OK; return S_OK;
} }