- Sync crypt32, jscript, mapi32, mlang, msctf, msvcrt20, msvcrt40, msxml3, snmpapi, urlmon with Wine head

svn path=/trunk/; revision=39867
This commit is contained in:
Dmitry Chapyshev 2009-03-04 15:29:32 +00:00
parent cc48677f8e
commit f98dc905a0
20 changed files with 1172 additions and 867 deletions

View file

@ -306,7 +306,13 @@ static BOOL CRYPT_AddCertToSimpleChain(PCertificateChainEngine engine,
= subjectInfoStatus;
/* FIXME: initialize the rest of element */
if (!(chain->cElement % engine->CycleDetectionModulus))
{
CRYPT_CheckSimpleChainForCycles(chain);
/* Reinitialize the element pointer in case the chain is
* cyclic, in which case the chain is truncated.
*/
element = chain->rgpElement[chain->cElement - 1];
}
CRYPT_CombineTrustStatus(&chain->TrustStatus,
&element->TrustStatus);
ret = TRUE;

View file

@ -1724,9 +1724,8 @@ static BOOL CRYPT_AsnDecodeUnicodeNameValueInternal(const BYTE *pbEncoded,
case ASN_UTF8STRING:
value->Value.cbData = MultiByteToWideChar(CP_UTF8, 0,
(LPCSTR)pbEncoded + 1 + lenBytes, dataLen,
str, bytesNeeded - sizeof(CERT_NAME_VALUE)) * 2;
value->Value.pbData[value->Value.cbData / sizeof(WCHAR)]
= 0;
str, bytesNeeded - sizeof(CERT_NAME_VALUE)) * sizeof(WCHAR);
*(WCHAR *)(value->Value.pbData + value->Value.cbData) = 0;
value->Value.cbData += sizeof(WCHAR);
break;
}

View file

@ -27,6 +27,7 @@
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
WINE_DECLARE_DEBUG_CHANNEL(heap);
const char *debugstr_variant(const VARIANT *v)
{
@ -51,6 +52,7 @@ const char *debugstr_variant(const VARIANT *v)
}
#define MIN_BLOCK_SIZE 128
#define ARENA_FREE_FILLER 0xaa
static inline DWORD block_size(DWORD block)
{
@ -83,26 +85,26 @@ void *jsheap_alloc(jsheap_t *heap, DWORD size)
heap->block_cnt = 1;
}
if(heap->offset + size < block_size(heap->last_block)) {
if(heap->offset + size <= block_size(heap->last_block)) {
tmp = ((BYTE*)heap->blocks[heap->last_block])+heap->offset;
heap->offset += size;
return tmp;
}
if(size < block_size(heap->last_block+1)) {
if(size <= block_size(heap->last_block+1)) {
if(heap->last_block+1 == heap->block_cnt) {
tmp = heap_realloc(heap->blocks, (heap->block_cnt+1)*sizeof(void*));
if(!tmp)
return NULL;
heap->blocks = tmp;
heap->blocks[heap->block_cnt] = heap_alloc(block_size(heap->block_cnt));
if(!heap->blocks[heap->block_cnt])
return NULL;
heap->block_cnt++;
}
tmp = heap_alloc(block_size(heap->block_cnt+1));
if(!tmp)
return NULL;
heap->blocks[heap->block_cnt++] = tmp;
heap->last_block++;
heap->offset = size;
return heap->blocks[heap->last_block];
@ -139,7 +141,15 @@ void jsheap_clear(jsheap_t *heap)
heap_free(tmp);
}
if(WARN_ON(heap)) {
DWORD i;
for(i=0; i < heap->block_cnt; i++)
memset(heap->blocks[i], ARENA_FREE_FILLER, block_size(i));
}
heap->last_block = heap->offset = 0;
heap->mark = FALSE;
}
void jsheap_free(jsheap_t *heap)

View file

@ -11,6 +11,7 @@
<file>prop.c</file>
<file>sendmail.c</file>
<file>util.c</file>
<file>version.rc</file>
<library>wine</library>
<library>shlwapi</library>
<library>shell32</library>

View file

@ -0,0 +1,22 @@
/*
* Copyright 2009 Vincent Povirk for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define WINE_FILEDESCRIPTION_STR "Wine Messaging API"
#define WINE_FILENAME_STR "mapi32.dll"
#include "wine/wine_common_ver.rc"

View file

@ -1912,9 +1912,34 @@ static HRESULT WINAPI fnIMLangFontLink_GetStrCodePages(
DWORD* pdwCodePages,
long* pcchCodePages)
{
FIXME("(pszSrc=%s, cchSrc=%ld, dwPriorityCodePages=%d) stub\n", debugstr_w(pszSrc), cchSrc, dwPriorityCodePages);
*pdwCodePages = 0;
*pcchCodePages = 1;
long i;
DWORD cps = 0;
TRACE("(%p)->%s %ld %x %p %p\n", iface, debugstr_wn(pszSrc,cchSrc),cchSrc,dwPriorityCodePages,pdwCodePages,pcchCodePages);
if (pdwCodePages) *pdwCodePages = 0;
if (pcchCodePages) *pcchCodePages = 0;
if (!pszSrc || !cchSrc || cchSrc < 0)
return E_INVALIDARG;
for (i = 0; i < cchSrc; i++)
{
DWORD cp;
HRESULT ret;
ret = fnIMLangFontLink_GetCharCodePages(iface, pszSrc[i], &cp);
if (ret != S_OK) return E_FAIL;
if (!cps) cps = cp;
else cps &= cp;
/* FIXME: not tested */
if (dwPriorityCodePages & cps) break;
}
if (pdwCodePages) *pdwCodePages = cps;
if (pcchCodePages) *pcchCodePages = i;
return S_OK;
}
@ -3179,10 +3204,8 @@ static HRESULT WINAPI fnIMLangFontLink2_GetStrCodePages( IMLangFontLink2* This,
const WCHAR *pszSrc, long cchSrc, DWORD dwPriorityCodePages,
DWORD *pdwCodePages, long *pcchCodePages)
{
FIXME("(%p)->%s %li %x %p %p\n",This, debugstr_wn(pszSrc,cchSrc),cchSrc,dwPriorityCodePages,pdwCodePages,pcchCodePages);
*pdwCodePages = 0;
*pcchCodePages = 1;
return S_OK;
return fnIMLangFontLink_GetStrCodePages((IMLangFontLink *)This,
pszSrc, cchSrc, dwPriorityCodePages, pdwCodePages, pcchCodePages);
}
static HRESULT WINAPI fnIMLangFontLink2_CodePageToCodePages(IMLangFontLink2* This,

View file

@ -168,9 +168,67 @@ static HRESULT WINAPI CategoryMgr_EnumItemsInCategory ( ITfCategoryMgr *iface,
static HRESULT WINAPI CategoryMgr_FindClosestCategory ( ITfCategoryMgr *iface,
REFGUID rguid, GUID *pcatid, const GUID **ppcatidList, ULONG ulCount)
{
static const WCHAR fmt[] = { '%','s','\\','%','s','\\','C','a','t','e','g','o','r','y','\\','I','t','e','m','\\','%','s',0};
WCHAR fullkey[110];
WCHAR buf[39];
HKEY key;
HRESULT hr = S_FALSE;
INT index = 0;
CategoryMgr *This = (CategoryMgr*)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
TRACE("(%p)\n",This);
if (!pcatid || (ulCount && ppcatidList == NULL))
return E_INVALIDARG;
StringFromGUID2(rguid, buf, 39);
sprintfW(fullkey,fmt,szwSystemTIPKey,buf,buf);
*pcatid = GUID_NULL;
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,fullkey, 0, KEY_READ, &key ) !=
ERROR_SUCCESS)
return S_FALSE;
while (1)
{
HRESULT hr2;
ULONG res;
GUID guid;
WCHAR catid[39];
DWORD cName;
cName = 39;
res = RegEnumKeyExW(key, index, catid, &cName, NULL, NULL, NULL, NULL);
if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) break;
index ++;
hr2 = CLSIDFromString(catid, &guid);
if (FAILED(hr2)) continue;
if (ulCount)
{
int j;
BOOL found = FALSE;
for (j = 0; j < ulCount; j++)
if (IsEqualGUID(&guid, ppcatidList[j]))
{
found = TRUE;
*pcatid = guid;
hr = S_OK;
break;
}
if (found) break;
}
else
{
*pcatid = guid;
hr = S_OK;
break;
}
}
return hr;
}
static HRESULT WINAPI CategoryMgr_RegisterGUIDDescription (

View file

@ -72,6 +72,7 @@ typedef struct tagEnumTfLanguageProfiles {
DWORD lang_index;
LANGID langid;
ITfCategoryMgr *catmgr;
} EnumTfLanguageProfiles;
static HRESULT ProfilesEnumGuid_Constructor(IEnumGUID **ppOut);
@ -670,6 +671,7 @@ static void EnumTfLanguageProfiles_Destructor(EnumTfLanguageProfiles *This)
RegCloseKey(This->tipkey);
if (This->langkey)
RegCloseKey(This->langkey);
ITfCategoryMgr_Release(This->catmgr);
HeapFree(GetProcessHeap(),0,This);
}
@ -746,6 +748,9 @@ static INT next_LanguageProfile(EnumTfLanguageProfiles *This, CLSID clsid, TF_LA
if (tflp)
{
static const GUID * tipcats[3] = { &GUID_TFCAT_TIP_KEYBOARD,
&GUID_TFCAT_TIP_SPEECH,
&GUID_TFCAT_TIP_HANDWRITING };
res = CLSIDFromString(profileid, &profile);
if (FAILED(res)) return 0;
@ -754,7 +759,10 @@ static INT next_LanguageProfile(EnumTfLanguageProfiles *This, CLSID clsid, TF_LA
/* FIXME */
tflp->fActive = FALSE;
tflp->guidProfile = profile;
/* FIXME set catid */
if (ITfCategoryMgr_FindClosestCategory(This->catmgr, &clsid,
&tflp->catid, tipcats, 3) != S_OK)
ITfCategoryMgr_FindClosestCategory(This->catmgr, &clsid,
&tflp->catid, NULL, 0);
}
return 1;
@ -865,6 +873,7 @@ static const IEnumTfLanguageProfilesVtbl IEnumTfLanguageProfiles_Vtbl ={
static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguageProfiles **ppOut)
{
HRESULT hr;
EnumTfLanguageProfiles *This;
This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(EnumTfLanguageProfiles));
@ -875,6 +884,13 @@ static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguage
This->refCount = 1;
This->langid = langid;
hr = CategoryMgr_Constructor(NULL,(IUnknown**)&This->catmgr);
if (FAILED(hr))
{
HeapFree(GetProcessHeap(),0,This);
return hr;
}
if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, szwSystemTIPKey, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &This->tipkey, NULL) != ERROR_SUCCESS)
return E_FAIL;

View file

@ -437,22 +437,22 @@
@ stub ?xsgetn@streambuf@@UAEHPADH@Z #
@ stub ?xsputn@streambuf@@UAEHPBDH@Z #
@ stub $I10_OUTPUT #
@ cdecl _CIacos() msvcrt._CIacos
@ cdecl _CIasin() msvcrt._CIasin
@ cdecl _CIatan() msvcrt._CIatan
@ cdecl _CIatan2() msvcrt._CIatan2
@ cdecl _CIcos() msvcrt._CIcos
@ cdecl _CIcosh() msvcrt._CIcosh
@ cdecl _CIexp() msvcrt._CIexp
@ cdecl _CIfmod() msvcrt._CIfmod
@ cdecl _CIlog() msvcrt._CIlog
@ cdecl _CIlog10() msvcrt._CIlog10
@ cdecl _CIpow() msvcrt._CIpow
@ cdecl _CIsin() msvcrt._CIsin
@ cdecl _CIsinh() msvcrt._CIsinh
@ cdecl _CIsqrt() msvcrt._CIsqrt
@ cdecl _CItan() msvcrt._CItan
@ cdecl _CItanh() msvcrt._CItanh
@ cdecl -arch=i386 _CIacos() msvcrt._CIacos
@ cdecl -arch=i386 _CIasin() msvcrt._CIasin
@ cdecl -arch=i386 _CIatan() msvcrt._CIatan
@ cdecl -arch=i386 _CIatan2() msvcrt._CIatan2
@ cdecl -arch=i386 _CIcos() msvcrt._CIcos
@ cdecl -arch=i386 _CIcosh() msvcrt._CIcosh
@ cdecl -arch=i386 _CIexp() msvcrt._CIexp
@ cdecl -arch=i386 _CIfmod() msvcrt._CIfmod
@ cdecl -arch=i386 _CIlog() msvcrt._CIlog
@ cdecl -arch=i386 _CIlog10() msvcrt._CIlog10
@ cdecl -arch=i386 _CIpow() msvcrt._CIpow
@ cdecl -arch=i386 _CIsin() msvcrt._CIsin
@ cdecl -arch=i386 _CIsinh() msvcrt._CIsinh
@ cdecl -arch=i386 _CIsqrt() msvcrt._CIsqrt
@ cdecl -arch=i386 _CItan() msvcrt._CItan
@ cdecl -arch=i386 _CItanh() msvcrt._CItanh
@ cdecl _CxxThrowException(long long) msvcrt._CxxThrowException
@ extern _HUGE msvcrt._HUGE
@ cdecl _XcptFilter(long ptr) msvcrt._XcptFilter
@ -471,32 +471,32 @@
@ cdecl __iscsymf(long) msvcrt.__iscsymf
@ cdecl __lconv_init() msvcrt.__lconv_init
@ extern __mb_cur_max msvcrt.__mb_cur_max
@ cdecl __p___argc() msvcrt.__p___argc
@ cdecl __p___argv() msvcrt.__p___argv
@ cdecl __p___initenv() msvcrt.__p___initenv
@ cdecl __p___mb_cur_max() msvcrt.__p___mb_cur_max
@ cdecl __p___wargv() msvcrt.__p___wargv
@ cdecl __p___winitenv() msvcrt.__p___winitenv
@ cdecl __p__acmdln() msvcrt.__p__acmdln
@ cdecl __p__amblksiz() msvcrt.__p__amblksiz
@ cdecl __p__commode() msvcrt.__p__commode
@ cdecl __p__daylight() msvcrt.__p__daylight
@ cdecl __p__environ() msvcrt.__p__environ
@ cdecl __p__fmode() msvcrt.__p__fmode
@ cdecl __p__iob() msvcrt.__p__iob
@ cdecl __p__mbctype() msvcrt.__p__mbctype
@ cdecl __p__osver() msvcrt.__p__osver
@ cdecl __p__pctype() msvcrt.__p__pctype
@ cdecl __p__pgmptr() msvcrt.__p__pgmptr
@ cdecl __p__pwctype() msvcrt.__p__pwctype
@ cdecl __p__timezone() msvcrt.__p__timezone
@ cdecl __p__tzname() msvcrt.__p__tzname
@ cdecl __p__wcmdln() msvcrt.__p__wcmdln
@ cdecl __p__wenviron() msvcrt.__p__wenviron
@ cdecl __p__winmajor() msvcrt.__p__winmajor
@ cdecl __p__winminor() msvcrt.__p__winminor
@ cdecl __p__winver() msvcrt.__p__winver
@ cdecl __p__wpgmptr() msvcrt.__p__wpgmptr
@ cdecl -arch=i386 __p___argc() msvcrt.__p___argc
@ cdecl -arch=i386 __p___argv() msvcrt.__p___argv
@ cdecl -arch=i386 __p___initenv() msvcrt.__p___initenv
@ cdecl -arch=i386 __p___mb_cur_max() msvcrt.__p___mb_cur_max
@ cdecl -arch=i386 __p___wargv() msvcrt.__p___wargv
@ cdecl -arch=i386 __p___winitenv() msvcrt.__p___winitenv
@ cdecl -arch=i386 __p__acmdln() msvcrt.__p__acmdln
@ cdecl -arch=i386 __p__amblksiz() msvcrt.__p__amblksiz
@ cdecl -arch=i386 __p__commode() msvcrt.__p__commode
@ cdecl -arch=i386 __p__daylight() msvcrt.__p__daylight
@ cdecl -arch=i386 __p__environ() msvcrt.__p__environ
@ cdecl -arch=i386 __p__fmode() msvcrt.__p__fmode
@ cdecl -arch=i386 __p__iob() msvcrt.__p__iob
@ cdecl -arch=i386 __p__mbctype() msvcrt.__p__mbctype
@ cdecl -arch=i386 __p__osver() msvcrt.__p__osver
@ cdecl -arch=i386 __p__pctype() msvcrt.__p__pctype
@ cdecl -arch=i386 __p__pgmptr() msvcrt.__p__pgmptr
@ cdecl -arch=i386 __p__pwctype() msvcrt.__p__pwctype
@ cdecl -arch=i386 __p__timezone() msvcrt.__p__timezone
@ cdecl -arch=i386 __p__tzname() msvcrt.__p__tzname
@ cdecl -arch=i386 __p__wcmdln() msvcrt.__p__wcmdln
@ cdecl -arch=i386 __p__wenviron() msvcrt.__p__wenviron
@ cdecl -arch=i386 __p__winmajor() msvcrt.__p__winmajor
@ cdecl -arch=i386 __p__winminor() msvcrt.__p__winminor
@ cdecl -arch=i386 __p__winver() msvcrt.__p__winver
@ cdecl -arch=i386 __p__wpgmptr() msvcrt.__p__wpgmptr
@ cdecl __pxcptinfoptrs() msvcrt.__pxcptinfoptrs
@ cdecl __threadhandle() msvcrt.__threadhandle
@ cdecl __threadid() msvcrt.__threadid

View file

@ -22,9 +22,6 @@
#include "windef.h"
#include "winbase.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt40);
BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
{

View file

@ -481,22 +481,22 @@
@ stub ?xsgetn@streambuf@@UAEHPADH@Z
@ stub ?xsputn@streambuf@@UAEHPBDH@Z
@ cdecl $I10_OUTPUT() msvcrt.$I10_OUTPUT
@ cdecl _CIacos() msvcrt._CIacos
@ cdecl _CIasin() msvcrt._CIasin
@ cdecl _CIatan() msvcrt._CIatan
@ cdecl _CIatan2() msvcrt._CIatan2
@ cdecl _CIcos() msvcrt._CIcos
@ cdecl _CIcosh() msvcrt._CIcosh
@ cdecl _CIexp() msvcrt._CIexp
@ cdecl _CIfmod() msvcrt._CIfmod
@ cdecl _CIlog() msvcrt._CIlog
@ cdecl _CIlog10() msvcrt._CIlog10
@ cdecl _CIpow() msvcrt._CIpow
@ cdecl _CIsin() msvcrt._CIsin
@ cdecl _CIsinh() msvcrt._CIsinh
@ cdecl _CIsqrt() msvcrt._CIsqrt
@ cdecl _CItan() msvcrt._CItan
@ cdecl _CItanh() msvcrt._CItanh
@ cdecl -arch=i386 _CIacos() msvcrt._CIacos
@ cdecl -arch=i386 _CIasin() msvcrt._CIasin
@ cdecl -arch=i386 _CIatan() msvcrt._CIatan
@ cdecl -arch=i386 _CIatan2() msvcrt._CIatan2
@ cdecl -arch=i386 _CIcos() msvcrt._CIcos
@ cdecl -arch=i386 _CIcosh() msvcrt._CIcosh
@ cdecl -arch=i386 _CIexp() msvcrt._CIexp
@ cdecl -arch=i386 _CIfmod() msvcrt._CIfmod
@ cdecl -arch=i386 _CIlog() msvcrt._CIlog
@ cdecl -arch=i386 _CIlog10() msvcrt._CIlog10
@ cdecl -arch=i386 _CIpow() msvcrt._CIpow
@ cdecl -arch=i386 _CIsin() msvcrt._CIsin
@ cdecl -arch=i386 _CIsinh() msvcrt._CIsinh
@ cdecl -arch=i386 _CIsqrt() msvcrt._CIsqrt
@ cdecl -arch=i386 _CItan() msvcrt._CItan
@ cdecl -arch=i386 _CItanh() msvcrt._CItanh
@ cdecl _CxxThrowException(long long) msvcrt._CxxThrowException
@ cdecl -i386 _EH_prolog() msvcrt._EH_prolog
@ extern _HUGE msvcrt._HUGE
@ -519,33 +519,33 @@
@ cdecl __iscsymf(long) msvcrt.__iscsymf
@ cdecl __lconv_init() msvcrt.__lconv_init
@ extern __mb_cur_max msvcrt.__mb_cur_max
@ cdecl __p___argc() msvcrt.__p___argc
@ cdecl __p___argv() msvcrt.__p___argv
@ cdecl __p___initenv() msvcrt.__p___initenv
@ cdecl __p___mb_cur_max() msvcrt.__p___mb_cur_max
@ cdecl __p___wargv() msvcrt.__p___wargv
@ cdecl __p___winitenv() msvcrt.__p___winitenv
@ cdecl __p__acmdln() msvcrt.__p__acmdln
@ cdecl __p__amblksiz() msvcrt.__p__amblksiz
@ cdecl __p__commode() msvcrt.__p__commode
@ cdecl __p__daylight() msvcrt.__p__daylight
@ cdecl __p__dstbias() msvcrt.__p__dstbias
@ cdecl __p__environ() msvcrt.__p__environ
@ cdecl __p__fmode() msvcrt.__p__fmode
@ cdecl __p__iob() msvcrt.__p__iob
@ cdecl __p__mbctype() msvcrt.__p__mbctype
@ cdecl __p__osver() msvcrt.__p__osver
@ cdecl __p__pctype() msvcrt.__p__pctype
@ cdecl __p__pgmptr() msvcrt.__p__pgmptr
@ cdecl __p__pwctype() msvcrt.__p__pwctype
@ cdecl __p__timezone() msvcrt.__p__timezone
@ cdecl __p__tzname() msvcrt.__p__tzname
@ cdecl __p__wcmdln() msvcrt.__p__wcmdln
@ cdecl __p__wenviron() msvcrt.__p__wenviron
@ cdecl __p__winmajor() msvcrt.__p__winmajor
@ cdecl __p__winminor() msvcrt.__p__winminor
@ cdecl __p__winver() msvcrt.__p__winver
@ cdecl __p__wpgmptr() msvcrt.__p__wpgmptr
@ cdecl -arch=i386 __p___argc() msvcrt.__p___argc
@ cdecl -arch=i386 __p___argv() msvcrt.__p___argv
@ cdecl -arch=i386 __p___initenv() msvcrt.__p___initenv
@ cdecl -arch=i386 __p___mb_cur_max() msvcrt.__p___mb_cur_max
@ cdecl -arch=i386 __p___wargv() msvcrt.__p___wargv
@ cdecl -arch=i386 __p___winitenv() msvcrt.__p___winitenv
@ cdecl -arch=i386 __p__acmdln() msvcrt.__p__acmdln
@ cdecl -arch=i386 __p__amblksiz() msvcrt.__p__amblksiz
@ cdecl -arch=i386 __p__commode() msvcrt.__p__commode
@ cdecl -arch=i386 __p__daylight() msvcrt.__p__daylight
@ cdecl -arch=i386 __p__dstbias() msvcrt.__p__dstbias
@ cdecl -arch=i386 __p__environ() msvcrt.__p__environ
@ cdecl -arch=i386 __p__fmode() msvcrt.__p__fmode
@ cdecl -arch=i386 __p__iob() msvcrt.__p__iob
@ cdecl -arch=i386 __p__mbctype() msvcrt.__p__mbctype
@ cdecl -arch=i386 __p__osver() msvcrt.__p__osver
@ cdecl -arch=i386 __p__pctype() msvcrt.__p__pctype
@ cdecl -arch=i386 __p__pgmptr() msvcrt.__p__pgmptr
@ cdecl -arch=i386 __p__pwctype() msvcrt.__p__pwctype
@ cdecl -arch=i386 __p__timezone() msvcrt.__p__timezone
@ cdecl -arch=i386 __p__tzname() msvcrt.__p__tzname
@ cdecl -arch=i386 __p__wcmdln() msvcrt.__p__wcmdln
@ cdecl -arch=i386 __p__wenviron() msvcrt.__p__wenviron
@ cdecl -arch=i386 __p__winmajor() msvcrt.__p__winmajor
@ cdecl -arch=i386 __p__winminor() msvcrt.__p__winminor
@ cdecl -arch=i386 __p__winver() msvcrt.__p__winver
@ cdecl -arch=i386 __p__wpgmptr() msvcrt.__p__wpgmptr
@ cdecl __pxcptinfoptrs() msvcrt.__pxcptinfoptrs
@ cdecl __set_app_type(long) msvcrt.__set_app_type
@ cdecl __setusermatherr(ptr) msvcrt.__setusermatherr

View file

@ -387,6 +387,11 @@ static HRESULT get_node(
if ( !out )
return E_INVALIDARG;
/* if we dont have a doc, use our parent. */
if(node && !node->doc && node->parent)
node->doc = node->parent->doc;
*out = create_node( node );
if (!*out)
return S_FALSE;

View file

@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdio.h>
#include <stdarg.h>

View file

@ -1200,7 +1200,7 @@ static void report_data(Binding *This, DWORD bscf, ULONG progress, ULONG progres
TRACE("(%p)->(%d %u %u)\n", This, bscf, progress, progress_max);
if(This->download_state == END_DOWNLOAD)
if(This->download_state == END_DOWNLOAD || (This->state & BINDING_STOPPED))
return;
if(GetCurrentThreadId() != This->apartment_thread)

View file

@ -1,5 +1,5 @@
/*
* Copyright 2005 Jacek Caban
* Copyright 2005-2009 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -22,13 +22,63 @@
WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
typedef struct {
Protocol base;
const IInternetProtocolVtbl *lpInternetProtocolVtbl;
const IInternetPriorityVtbl *lpInternetPriorityVtbl;
LONG ref;
} FtpProtocol;
#define PROTOCOL_THIS(iface) DEFINE_THIS(FtpProtocol, InternetProtocol, iface)
#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl)
#define PRIORITY(x) ((IInternetPriority*) &(x)->lpInternetPriorityVtbl)
#define ASYNCPROTOCOL_THIS(iface) DEFINE_THIS2(FtpProtocol, base, iface)
static HRESULT FtpProtocol_open_request(Protocol *prot, LPCWSTR url, DWORD request_flags,
IInternetBindInfo *bind_info)
{
FtpProtocol *This = ASYNCPROTOCOL_THIS(prot);
This->base.request = InternetOpenUrlW(This->base.internet, url, NULL, 0,
request_flags|INTERNET_FLAG_EXISTING_CONNECT|INTERNET_FLAG_PASSIVE,
(DWORD_PTR)&This->base);
if (!This->base.request && GetLastError() != ERROR_IO_PENDING) {
WARN("InternetOpenUrl failed: %d\n", GetLastError());
return INET_E_RESOURCE_NOT_FOUND;
}
return S_OK;
}
static HRESULT FtpProtocol_start_downloading(Protocol *prot)
{
FtpProtocol *This = ASYNCPROTOCOL_THIS(prot);
DWORD size;
BOOL res;
res = FtpGetFileSize(This->base.request, &size);
if(res)
This->base.content_length = size;
else
WARN("FtpGetFileSize failed: %d\n", GetLastError());
return S_OK;
}
static void FtpProtocol_close_connection(Protocol *prot)
{
}
#undef ASYNCPROTOCOL_THIS
static const ProtocolVtbl AsyncProtocolVtbl = {
FtpProtocol_open_request,
FtpProtocol_start_downloading,
FtpProtocol_close_connection
};
#define PROTOCOL_THIS(iface) DEFINE_THIS(FtpProtocol, InternetProtocol, iface)
static HRESULT WINAPI FtpProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
{
@ -44,6 +94,9 @@ static HRESULT WINAPI FtpProtocol_QueryInterface(IInternetProtocol *iface, REFII
}else if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv);
*ppv = PROTOCOL(This);
}else if(IsEqualGUID(&IID_IInternetPriority, riid)) {
TRACE("(%p)->(IID_IInternetPriority %p)\n", This, ppv);
*ppv = PRIORITY(This);
}
if(*ppv) {
@ -71,6 +124,7 @@ static ULONG WINAPI FtpProtocol_Release(IInternetProtocol *iface)
TRACE("(%p) ref=%d\n", This, ref);
if(!ref) {
protocol_close_connection(&This->base);
heap_free(This);
URLMON_UnlockModule();
@ -84,16 +138,25 @@ static HRESULT WINAPI FtpProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
DWORD grfPI, DWORD dwReserved)
{
FtpProtocol *This = PROTOCOL_THIS(iface);
FIXME("(%p)->(%s %p %p %08x %d)\n", This, debugstr_w(szUrl), pOIProtSink,
pOIBindInfo, grfPI, dwReserved);
return E_NOTIMPL;
static const WCHAR ftpW[] = {'f','t','p',':'};
TRACE("(%p)->(%s %p %p %08x %d)\n", This, debugstr_w(szUrl), pOIProtSink,
pOIBindInfo, grfPI, dwReserved);
if(strncmpW(szUrl, ftpW, sizeof(ftpW)/sizeof(WCHAR)))
return MK_E_SYNTAX;
return protocol_start(&This->base, PROTOCOL(This), szUrl, pOIProtSink, pOIBindInfo);
}
static HRESULT WINAPI FtpProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
{
FtpProtocol *This = PROTOCOL_THIS(iface);
FIXME("(%p)->(%p)\n", This, pProtocolData);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, pProtocolData);
return protocol_continue(&This->base, pProtocolData);
}
static HRESULT WINAPI FtpProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
@ -107,8 +170,11 @@ static HRESULT WINAPI FtpProtocol_Abort(IInternetProtocol *iface, HRESULT hrReas
static HRESULT WINAPI FtpProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
{
FtpProtocol *This = PROTOCOL_THIS(iface);
FIXME("(%p)->(%08x)\n", This, dwOptions);
return E_NOTIMPL;
TRACE("(%p)->(%08x)\n", This, dwOptions);
protocol_close_connection(&This->base);
return S_OK;
}
static HRESULT WINAPI FtpProtocol_Suspend(IInternetProtocol *iface)
@ -129,8 +195,10 @@ static HRESULT WINAPI FtpProtocol_Read(IInternetProtocol *iface, void *pv,
ULONG cb, ULONG *pcbRead)
{
FtpProtocol *This = PROTOCOL_THIS(iface);
FIXME("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead);
return E_NOTIMPL;
TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead);
return protocol_read(&This->base, pv, cb, pcbRead);
}
static HRESULT WINAPI FtpProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove,
@ -144,15 +212,19 @@ static HRESULT WINAPI FtpProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER d
static HRESULT WINAPI FtpProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
{
FtpProtocol *This = PROTOCOL_THIS(iface);
FIXME("(%p)->(%08x)\n", This, dwOptions);
return E_NOTIMPL;
TRACE("(%p)->(%08x)\n", This, dwOptions);
return protocol_lock_request(&This->base);
}
static HRESULT WINAPI FtpProtocol_UnlockRequest(IInternetProtocol *iface)
{
FtpProtocol *This = PROTOCOL_THIS(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL;
TRACE("(%p)\n", This);
return protocol_unlock_request(&This->base);
}
#undef PROTOCOL_THIS
@ -173,6 +245,56 @@ static const IInternetProtocolVtbl FtpProtocolVtbl = {
FtpProtocol_UnlockRequest
};
#define PRIORITY_THIS(iface) DEFINE_THIS(FtpProtocol, InternetPriority, iface)
static HRESULT WINAPI FtpPriority_QueryInterface(IInternetPriority *iface, REFIID riid, void **ppv)
{
FtpProtocol *This = PRIORITY_THIS(iface);
return IInternetProtocol_QueryInterface(PROTOCOL(This), riid, ppv);
}
static ULONG WINAPI FtpPriority_AddRef(IInternetPriority *iface)
{
FtpProtocol *This = PRIORITY_THIS(iface);
return IInternetProtocol_AddRef(PROTOCOL(This));
}
static ULONG WINAPI FtpPriority_Release(IInternetPriority *iface)
{
FtpProtocol *This = PRIORITY_THIS(iface);
return IInternetProtocol_Release(PROTOCOL(This));
}
static HRESULT WINAPI FtpPriority_SetPriority(IInternetPriority *iface, LONG nPriority)
{
FtpProtocol *This = PRIORITY_THIS(iface);
TRACE("(%p)->(%d)\n", This, nPriority);
This->base.priority = nPriority;
return S_OK;
}
static HRESULT WINAPI FtpPriority_GetPriority(IInternetPriority *iface, LONG *pnPriority)
{
FtpProtocol *This = PRIORITY_THIS(iface);
TRACE("(%p)->(%p)\n", This, pnPriority);
*pnPriority = This->base.priority;
return S_OK;
}
#undef PRIORITY_THIS
static const IInternetPriorityVtbl FtpPriorityVtbl = {
FtpPriority_QueryInterface,
FtpPriority_AddRef,
FtpPriority_Release,
FtpPriority_SetPriority,
FtpPriority_GetPriority
};
HRESULT FtpProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
{
FtpProtocol *ret;
@ -181,9 +303,11 @@ HRESULT FtpProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
URLMON_LockModule();
ret = heap_alloc(sizeof(FtpProtocol));
ret = heap_alloc_zero(sizeof(FtpProtocol));
ret->base.vtbl = &AsyncProtocolVtbl;
ret->lpInternetProtocolVtbl = &FtpProtocolVtbl;
ret->lpInternetPriorityVtbl = &FtpPriorityVtbl;
ret->ref = 1;
*ppobj = PROTOCOL(ret);

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,430 @@
/*
* Copyright 2007 Misha Koshelev
* Copyright 2009 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "urlmon_main.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
/* Flags are needed for, among other things, return HRESULTs from the Read function
* to conform to native. For example, Read returns:
*
* 1. E_PENDING if called before the request has completed,
* (flags = 0)
* 2. S_FALSE after all data has been read and S_OK has been reported,
* (flags = FLAG_REQUEST_COMPLETE | FLAG_ALL_DATA_READ | FLAG_RESULT_REPORTED)
* 3. INET_E_DATA_NOT_AVAILABLE if InternetQueryDataAvailable fails. The first time
* this occurs, INET_E_DATA_NOT_AVAILABLE will also be reported to the sink,
* (flags = FLAG_REQUEST_COMPLETE)
* but upon subsequent calls to Read no reporting will take place, yet
* InternetQueryDataAvailable will still be called, and, on failure,
* INET_E_DATA_NOT_AVAILABLE will still be returned.
* (flags = FLAG_REQUEST_COMPLETE | FLAG_RESULT_REPORTED)
*
* FLAG_FIRST_DATA_REPORTED and FLAG_LAST_DATA_REPORTED are needed for proper
* ReportData reporting. For example, if OnResponse returns S_OK, Continue will
* report BSCF_FIRSTDATANOTIFICATION, and when all data has been read Read will
* report BSCF_INTERMEDIATEDATANOTIFICATION|BSCF_LASTDATANOTIFICATION. However,
* if OnResponse does not return S_OK, Continue will not report data, and Read
* will report BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION when all
* data has been read.
*/
#define FLAG_REQUEST_COMPLETE 0x0001
#define FLAG_FIRST_CONTINUE_COMPLETE 0x0002
#define FLAG_FIRST_DATA_REPORTED 0x0004
#define FLAG_ALL_DATA_READ 0x0008
#define FLAG_LAST_DATA_REPORTED 0x0010
#define FLAG_RESULT_REPORTED 0x0020
static inline HRESULT report_progress(Protocol *protocol, ULONG status_code, LPCWSTR status_text)
{
return IInternetProtocolSink_ReportProgress(protocol->protocol_sink, status_code, status_text);
}
static inline HRESULT report_result(Protocol *protocol, HRESULT hres)
{
if (!(protocol->flags & FLAG_RESULT_REPORTED) && protocol->protocol_sink) {
protocol->flags |= FLAG_RESULT_REPORTED;
IInternetProtocolSink_ReportResult(protocol->protocol_sink, hres, 0, NULL);
}
return hres;
}
static void report_data(Protocol *protocol)
{
DWORD bscf;
if((protocol->flags & FLAG_LAST_DATA_REPORTED) || !protocol->protocol_sink)
return;
if(protocol->flags & FLAG_FIRST_DATA_REPORTED) {
bscf = BSCF_INTERMEDIATEDATANOTIFICATION;
}else {
protocol->flags |= FLAG_FIRST_DATA_REPORTED;
bscf = BSCF_FIRSTDATANOTIFICATION;
}
if(protocol->flags & FLAG_ALL_DATA_READ && !(protocol->flags & FLAG_LAST_DATA_REPORTED)) {
protocol->flags |= FLAG_LAST_DATA_REPORTED;
bscf |= BSCF_LASTDATANOTIFICATION;
}
IInternetProtocolSink_ReportData(protocol->protocol_sink, bscf,
protocol->current_position+protocol->available_bytes,
protocol->content_length);
}
static void all_data_read(Protocol *protocol)
{
protocol->flags |= FLAG_ALL_DATA_READ;
report_data(protocol);
report_result(protocol, S_OK);
}
static void request_complete(Protocol *protocol, INTERNET_ASYNC_RESULT *ar)
{
PROTOCOLDATA data;
if(!ar->dwResult) {
WARN("request failed: %d\n", ar->dwError);
return;
}
protocol->flags |= FLAG_REQUEST_COMPLETE;
if(!protocol->request) {
TRACE("setting request handle %p\n", (HINTERNET)ar->dwResult);
protocol->request = (HINTERNET)ar->dwResult;
}
/* PROTOCOLDATA same as native */
memset(&data, 0, sizeof(data));
data.dwState = 0xf1000000;
if(protocol->flags & FLAG_FIRST_CONTINUE_COMPLETE)
data.pData = (LPVOID)BINDSTATUS_ENDDOWNLOADCOMPONENTS;
else
data.pData = (LPVOID)BINDSTATUS_DOWNLOADINGDATA;
if (protocol->bindf & BINDF_FROMURLMON)
IInternetProtocolSink_Switch(protocol->protocol_sink, &data);
else
protocol_continue(protocol, &data);
}
static void WINAPI internet_status_callback(HINTERNET internet, DWORD_PTR context,
DWORD internet_status, LPVOID status_info, DWORD status_info_len)
{
Protocol *protocol = (Protocol*)context;
switch(internet_status) {
case INTERNET_STATUS_RESOLVING_NAME:
TRACE("%p INTERNET_STATUS_RESOLVING_NAME\n", protocol);
report_progress(protocol, BINDSTATUS_FINDINGRESOURCE, (LPWSTR)status_info);
break;
case INTERNET_STATUS_CONNECTING_TO_SERVER:
TRACE("%p INTERNET_STATUS_CONNECTING_TO_SERVER\n", protocol);
report_progress(protocol, BINDSTATUS_CONNECTING, (LPWSTR)status_info);
break;
case INTERNET_STATUS_SENDING_REQUEST:
TRACE("%p INTERNET_STATUS_SENDING_REQUEST\n", protocol);
report_progress(protocol, BINDSTATUS_SENDINGREQUEST, (LPWSTR)status_info);
break;
case INTERNET_STATUS_REQUEST_COMPLETE:
request_complete(protocol, status_info);
break;
case INTERNET_STATUS_HANDLE_CREATED:
TRACE("%p INTERNET_STATUS_HANDLE_CREATED\n", protocol);
IInternetProtocol_AddRef(protocol->protocol);
break;
case INTERNET_STATUS_HANDLE_CLOSING:
TRACE("%p INTERNET_STATUS_HANDLE_CLOSING\n", protocol);
if(*(HINTERNET *)status_info == protocol->request) {
protocol->request = NULL;
if(protocol->protocol_sink) {
IInternetProtocolSink_Release(protocol->protocol_sink);
protocol->protocol_sink = NULL;
}
if(protocol->bind_info.cbSize) {
ReleaseBindInfo(&protocol->bind_info);
memset(&protocol->bind_info, 0, sizeof(protocol->bind_info));
}
}else if(*(HINTERNET *)status_info == protocol->connection) {
protocol->connection = NULL;
}
IInternetProtocol_Release(protocol->protocol);
break;
default:
WARN("Unhandled Internet status callback %d\n", internet_status);
}
}
HRESULT protocol_start(Protocol *protocol, IInternetProtocol *prot, LPCWSTR url,
IInternetProtocolSink *protocol_sink, IInternetBindInfo *bind_info)
{
LPOLESTR user_agent = NULL;
DWORD request_flags;
ULONG size = 0;
HRESULT hres;
protocol->protocol = prot;
IInternetProtocolSink_AddRef(protocol_sink);
protocol->protocol_sink = protocol_sink;
memset(&protocol->bind_info, 0, sizeof(protocol->bind_info));
protocol->bind_info.cbSize = sizeof(BINDINFO);
hres = IInternetBindInfo_GetBindInfo(bind_info, &protocol->bindf, &protocol->bind_info);
if(hres != S_OK) {
WARN("GetBindInfo failed: %08x\n", hres);
return report_result(protocol, hres);
}
if(!(protocol->bindf & BINDF_FROMURLMON))
report_progress(protocol, BINDSTATUS_DIRECTBIND, NULL);
hres = IInternetBindInfo_GetBindString(bind_info, BINDSTRING_USER_AGENT, &user_agent, 1, &size);
if (hres != S_OK || !size) {
DWORD len;
CHAR null_char = 0;
LPSTR user_agenta = NULL;
len = 0;
if ((hres = ObtainUserAgentString(0, &null_char, &len)) != E_OUTOFMEMORY) {
WARN("ObtainUserAgentString failed: %08x\n", hres);
}else if (!(user_agenta = heap_alloc(len*sizeof(CHAR)))) {
WARN("Out of memory\n");
}else if ((hres = ObtainUserAgentString(0, user_agenta, &len)) != S_OK) {
WARN("ObtainUserAgentString failed: %08x\n", hres);
}else {
if(!(user_agent = CoTaskMemAlloc((len)*sizeof(WCHAR))))
WARN("Out of memory\n");
else
MultiByteToWideChar(CP_ACP, 0, user_agenta, -1, user_agent, len);
}
heap_free(user_agenta);
}
protocol->internet = InternetOpenW(user_agent, 0, NULL, NULL, INTERNET_FLAG_ASYNC);
CoTaskMemFree(user_agent);
if(!protocol->internet) {
WARN("InternetOpen failed: %d\n", GetLastError());
return report_result(protocol, INET_E_NO_SESSION);
}
/* Native does not check for success of next call, so we won't either */
InternetSetStatusCallbackW(protocol->internet, internet_status_callback);
request_flags = INTERNET_FLAG_KEEP_CONNECTION;
if(protocol->bindf & BINDF_NOWRITECACHE)
request_flags |= INTERNET_FLAG_NO_CACHE_WRITE;
if(protocol->bindf & BINDF_NEEDFILE)
request_flags |= INTERNET_FLAG_NEED_FILE;
hres = protocol->vtbl->open_request(protocol, url, request_flags, bind_info);
if(FAILED(hres)) {
protocol_close_connection(protocol);
return report_result(protocol, hres);
}
return S_OK;
}
HRESULT protocol_continue(Protocol *protocol, PROTOCOLDATA *data)
{
HRESULT hres;
if (!data) {
WARN("Expected pProtocolData to be non-NULL\n");
return S_OK;
}
if(!protocol->request) {
WARN("Expected request to be non-NULL\n");
return S_OK;
}
if(!protocol->protocol_sink) {
WARN("Expected IInternetProtocolSink pointer to be non-NULL\n");
return S_OK;
}
if(data->pData == (LPVOID)BINDSTATUS_DOWNLOADINGDATA) {
hres = protocol->vtbl->start_downloading(protocol);
if(FAILED(hres)) {
protocol_close_connection(protocol);
report_result(protocol, hres);
return S_OK;
}
if(protocol->bindf & BINDF_NEEDFILE) {
WCHAR cache_file[MAX_PATH];
DWORD buflen = sizeof(cache_file);
if(InternetQueryOptionW(protocol->request, INTERNET_OPTION_DATAFILE_NAME,
cache_file, &buflen)) {
report_progress(protocol, BINDSTATUS_CACHEFILENAMEAVAILABLE, cache_file);
}else {
FIXME("Could not get cache file\n");
}
}
protocol->flags |= FLAG_FIRST_CONTINUE_COMPLETE;
}
if(data->pData >= (LPVOID)BINDSTATUS_DOWNLOADINGDATA) {
BOOL res;
/* InternetQueryDataAvailable may immediately fork and perform its asynchronous
* read, so clear the flag _before_ calling so it does not incorrectly get cleared
* after the status callback is called */
protocol->flags &= ~FLAG_REQUEST_COMPLETE;
res = InternetQueryDataAvailable(protocol->request, &protocol->available_bytes, 0, 0);
if(res) {
protocol->flags |= FLAG_REQUEST_COMPLETE;
report_data(protocol);
}else if(GetLastError() != ERROR_IO_PENDING) {
protocol->flags |= FLAG_REQUEST_COMPLETE;
WARN("InternetQueryDataAvailable failed: %d\n", GetLastError());
report_result(protocol, INET_E_DATA_NOT_AVAILABLE);
}
}
return S_OK;
}
HRESULT protocol_read(Protocol *protocol, void *buf, ULONG size, ULONG *read_ret)
{
ULONG read = 0;
BOOL res;
HRESULT hres = S_FALSE;
if(!(protocol->flags & FLAG_REQUEST_COMPLETE)) {
*read_ret = 0;
return E_PENDING;
}
if(protocol->flags & FLAG_ALL_DATA_READ) {
*read_ret = 0;
return S_FALSE;
}
while(read < size) {
if(protocol->available_bytes) {
ULONG len;
res = InternetReadFile(protocol->request, ((BYTE *)buf)+read,
protocol->available_bytes > size-read ? size-read : protocol->available_bytes, &len);
if(!res) {
WARN("InternetReadFile failed: %d\n", GetLastError());
hres = INET_E_DOWNLOAD_FAILURE;
report_result(protocol, hres);
break;
}
if(!len) {
all_data_read(protocol);
break;
}
read += len;
protocol->current_position += len;
protocol->available_bytes -= len;
}else {
/* InternetQueryDataAvailable may immediately fork and perform its asynchronous
* read, so clear the flag _before_ calling so it does not incorrectly get cleared
* after the status callback is called */
protocol->flags &= ~FLAG_REQUEST_COMPLETE;
res = InternetQueryDataAvailable(protocol->request, &protocol->available_bytes, 0, 0);
if(!res) {
if (GetLastError() == ERROR_IO_PENDING) {
hres = E_PENDING;
}else {
WARN("InternetQueryDataAvailable failed: %d\n", GetLastError());
hres = INET_E_DATA_NOT_AVAILABLE;
report_result(protocol, hres);
}
break;
}
if(!protocol->available_bytes) {
all_data_read(protocol);
break;
}
}
}
*read_ret = read;
if (hres != E_PENDING)
protocol->flags |= FLAG_REQUEST_COMPLETE;
if(FAILED(hres))
return hres;
return read ? S_OK : S_FALSE;
}
HRESULT protocol_lock_request(Protocol *protocol)
{
if (!InternetLockRequestFile(protocol->request, &protocol->lock))
WARN("InternetLockRequest failed: %d\n", GetLastError());
return S_OK;
}
HRESULT protocol_unlock_request(Protocol *protocol)
{
if(!protocol->lock)
return S_OK;
if(!InternetUnlockRequestFile(protocol->lock))
WARN("InternetUnlockRequest failed: %d\n", GetLastError());
protocol->lock = 0;
return S_OK;
}
void protocol_close_connection(Protocol *protocol)
{
protocol->vtbl->close_connection(protocol);
if(protocol->request)
InternetCloseHandle(protocol->request);
if(protocol->connection)
InternetCloseHandle(protocol->connection);
if(protocol->internet) {
InternetCloseHandle(protocol->internet);
protocol->internet = 0;
}
protocol->flags = 0;
}

View file

@ -532,8 +532,6 @@ static HRESULT URLMonikerImpl_BindToStorage_hack(LPCWSTR URLName, IBindCtx* pbc,
if(SUCCEEDED(hres)) {
URL_COMPONENTSW url;
WCHAR *host, *path, *user, *pass;
DWORD dwService = 0;
BOOL bSuccess;
TRACE("got bindinfo. bindf = %08x extrainfo = %s bindinfof = %08x bindverb = %08x iid %s\n",
bindf, debugstr_w(bi.szExtraInfo), bi.grfBindInfoF, bi.dwBindVerb, debugstr_guid(&bi.iid));
@ -583,23 +581,10 @@ static HRESULT URLMonikerImpl_BindToStorage_hack(LPCWSTR URLName, IBindCtx* pbc,
break;
}
switch ((DWORD) url.nScheme)
{
case INTERNET_SCHEME_FTP:
if (!url.nPort)
url.nPort = INTERNET_DEFAULT_FTP_PORT;
dwService = INTERNET_SERVICE_FTP;
break;
case INTERNET_SCHEME_GOPHER:
if (!url.nPort)
url.nPort = INTERNET_DEFAULT_GOPHER_PORT;
dwService = INTERNET_SERVICE_GOPHER;
break;
}
if (!url.nPort)
url.nPort = INTERNET_DEFAULT_GOPHER_PORT;
bind->hconnect = InternetConnectW(bind->hinternet, host, url.nPort, user, pass,
dwService, 0, (DWORD_PTR)bind);
INTERNET_SERVICE_GOPHER, 0, (DWORD_PTR)bind);
if (!bind->hconnect)
{
hres = HRESULT_FROM_WIN32(GetLastError());
@ -612,37 +597,12 @@ static HRESULT URLMonikerImpl_BindToStorage_hack(LPCWSTR URLName, IBindCtx* pbc,
hres = IBindStatusCallback_OnProgress(bind->pbscb, 0, 0, BINDSTATUS_CONNECTING, NULL);
hres = IBindStatusCallback_OnProgress(bind->pbscb, 0, 0, BINDSTATUS_SENDINGREQUEST, NULL);
bSuccess = FALSE;
switch (dwService)
{
case INTERNET_SERVICE_GOPHER:
bind->hrequest = GopherOpenFileW(bind->hconnect,
path,
0,
INTERNET_FLAG_RELOAD,
0);
if (bind->hrequest)
bSuccess = TRUE;
else
hres = HRESULT_FROM_WIN32(GetLastError());
break;
case INTERNET_SERVICE_FTP:
bind->hrequest = FtpOpenFileW(bind->hconnect,
path,
GENERIC_READ,
FTP_TRANSFER_TYPE_BINARY |
INTERNET_FLAG_TRANSFER_BINARY |
INTERNET_FLAG_RELOAD,
0);
if (bind->hrequest)
bSuccess = TRUE;
else
hres = HRESULT_FROM_WIN32(GetLastError());
break;
}
if(bSuccess)
bind->hrequest = GopherOpenFileW(bind->hconnect,
path,
0,
INTERNET_FLAG_RELOAD,
0);
if (bind->hrequest)
{
TRACE("res = %d gle = %u url len = %d\n", hres, GetLastError(), bind->expected_size);
@ -660,7 +620,10 @@ static HRESULT URLMonikerImpl_BindToStorage_hack(LPCWSTR URLName, IBindCtx* pbc,
}
InternetCloseHandle(bind->hrequest);
hres = S_OK;
}else {
hres = HRESULT_FROM_WIN32(GetLastError());
}
InternetCloseHandle(bind->hconnect);
InternetCloseHandle(bind->hinternet);
@ -704,9 +667,7 @@ static HRESULT WINAPI URLMonikerImpl_BindToStorage(IMoniker* iface,
return E_FAIL;
}
if(IsEqualGUID(&IID_IStream, riid) &&
( url.nScheme == INTERNET_SCHEME_FTP
|| url.nScheme == INTERNET_SCHEME_GOPHER))
if(IsEqualGUID(&IID_IStream, riid) && url.nScheme == INTERNET_SCHEME_GOPHER)
return URLMonikerImpl_BindToStorage_hack(This->URLName, pbc, ppvObject);
TRACE("(%p)->(%p %p %s %p)\n", This, pbc, pmkToLeft, debugstr_guid(riid), ppvObject);

View file

@ -18,6 +18,7 @@
<file>http.c</file>
<file>internet.c</file>
<file>mk.c</file>
<file>protocol.c</file>
<file>regsvr.c</file>
<file>sec_mgr.c</file>
<file>session.c</file>

View file

@ -1,5 +1,6 @@
/*
* Copyright 2002 Huw D M Davies for CodeWeavers
* Copyright 2009 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -30,6 +31,7 @@
#include "winuser.h"
#include "ole2.h"
#include "urlmon.h"
#include "wininet.h"
#include "wine/unicode.h"
@ -50,7 +52,8 @@ static inline void URLMON_LockModule(void) { InterlockedIncrement( &URLMON_refCo
static inline void URLMON_UnlockModule(void) { InterlockedDecrement( &URLMON_refCount ); }
#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
#define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
#define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
#define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
typedef struct
{
@ -76,6 +79,43 @@ HRESULT bind_to_object(IMoniker *mon, LPCWSTR url, IBindCtx *pbc, REFIID riid, v
HRESULT create_binding_protocol(LPCWSTR url, BOOL from_urlmon, IInternetProtocol **protocol);
void set_binding_sink(IInternetProtocol *bind_protocol, IInternetProtocolSink *sink);
typedef struct ProtocolVtbl ProtocolVtbl;
typedef struct {
const ProtocolVtbl *vtbl;
IInternetProtocol *protocol;
IInternetProtocolSink *protocol_sink;
DWORD bindf;
BINDINFO bind_info;
HINTERNET internet;
HINTERNET request;
HINTERNET connection;
DWORD flags;
HANDLE lock;
ULONG current_position;
ULONG content_length;
ULONG available_bytes;
LONG priority;
} Protocol;
struct ProtocolVtbl {
HRESULT (*open_request)(Protocol*,LPCWSTR,DWORD,IInternetBindInfo*);
HRESULT (*start_downloading)(Protocol*);
void (*close_connection)(Protocol*);
};
HRESULT protocol_start(Protocol*,IInternetProtocol*,LPCWSTR,IInternetProtocolSink*,IInternetBindInfo*);
HRESULT protocol_continue(Protocol*,PROTOCOLDATA*);
HRESULT protocol_read(Protocol*,void*,ULONG,ULONG*);
HRESULT protocol_lock_request(Protocol*);
HRESULT protocol_unlock_request(Protocol*);
void protocol_close_connection(Protocol*);
static inline void *heap_alloc(size_t len)
{
return HeapAlloc(GetProcessHeap(), 0, len);
@ -111,6 +151,21 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
return ret;
}
static inline LPWSTR heap_strndupW(LPCWSTR str, int len)
{
LPWSTR ret = NULL;
if(str) {
ret = heap_alloc((len+1)*sizeof(WCHAR));
if(ret) {
memcpy(ret, str, len*sizeof(WCHAR));
ret[len] = 0;
}
}
return ret;
}
static inline LPWSTR heap_strdupAtoW(const char *str)
{
LPWSTR ret = NULL;