Fix the ITS moniker implementation.

This commit is contained in:
Mike McCormack 2004-08-25 17:30:18 +00:00 committed by Alexandre Julliard
parent 3615587427
commit 332408b836
5 changed files with 95 additions and 8 deletions

View File

@ -626,7 +626,7 @@ struct chmFile *chm_openW(const WCHAR *filename)
/* open file */
if ((newHandle->fd=CreateFileW(filename,
GENERIC_READ,
0,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,

View File

@ -39,6 +39,8 @@
#include "wine/unicode.h"
#include "wine/debug.h"
#include "itsstor.h"
WINE_DEFAULT_DEBUG_CHANNEL(itss);
#include "initguid.h"
@ -48,8 +50,6 @@ DEFINE_GUID(CLSID_ITSProtocol,0x9d148290,0xb9c8,0x11d0,0xa4,0xcc,0x00,0x00,0xf8,
DEFINE_GUID(IID_IITStorage, 0x88cc31de, 0x27ab, 0x11d0, 0x9d, 0xf9, 0x0, 0xa0, 0xc9, 0x22, 0xe6, 0xec);
static HRESULT ITSS_create(IUnknown *pUnkOuter, LPVOID *ppObj);
extern HRESULT ITS_IParseDisplayName_create(IUnknown *pUnkOuter, LPVOID *ppObj);
extern HRESULT ITSS_StgOpenStorage( const WCHAR*, IStorage*, DWORD, SNB, DWORD, IStorage** );
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
{

38
dlls/itss/itsstor.h Normal file
View File

@ -0,0 +1,38 @@
/*
* ITSS Storage implementation
*
* Copyright 2004 Mike McCormack
*
* see http://bonedaddy.net/pabs3/hhm/#chmspec
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WINE_ITS_STORAGE_PRIVATE__
#define __WINE_ITS_STORAGE_PRIVATE__
extern HRESULT ITSS_StgOpenStorage(
const WCHAR* pwcsName,
IStorage* pstgPriority,
DWORD grfMode,
SNB snbExclude,
DWORD reserved,
IStorage** ppstgOpen);
extern HRESULT ITS_IParseDisplayName_create(
IUnknown *pUnkOuter,
LPVOID *ppObj);
#endif /* __WINE_ITS_STORAGE_PRIVATE__ */

View File

@ -38,6 +38,8 @@
#include "wine/unicode.h"
#include "wine/debug.h"
#include "itsstor.h"
WINE_DEFAULT_DEBUG_CHANNEL(itss);
/*****************************************************************************/
@ -153,8 +155,30 @@ static HRESULT WINAPI ITS_IMonikerImpl_BindToStorage(
REFIID riid,
void** ppvObj)
{
FIXME("\n");
return E_NOTIMPL;
ICOM_THIS(ITS_IMonikerImpl,iface);
DWORD grfMode = STGM_SIMPLE | STGM_READ | STGM_SHARE_EXCLUSIVE;
HRESULT r;
IStorage *stg = NULL;
TRACE("%p %p %p %s %p\n", This,
pbc, pmkToLeft, debugstr_guid(riid), ppvObj);
r = ITSS_StgOpenStorage( This->szFile, NULL, grfMode, 0, 0, &stg );
if( r == S_OK )
{
TRACE("Opened storage %s\n", debugstr_w( This->szFile ) );
if (IsEqualGUID(riid, &IID_IStream))
r = IStorage_OpenStream( stg, This->szHtml,
NULL, grfMode, 0, (IStream**)ppvObj );
else if (IsEqualGUID(riid, &IID_IStorage))
r = IStorage_OpenStorage( stg, This->szHtml,
NULL, grfMode, NULL, 0, (IStorage**)ppvObj );
else
r = STG_E_ACCESSDENIED;
IStorage_Release( stg );
}
return r;
}
static HRESULT WINAPI ITS_IMonikerImpl_Reduce(

View File

@ -36,6 +36,7 @@
#include "itss.h"
#include "chm_lib.h"
#include "itsstor.h"
#include "wine/unicode.h"
#include "wine/debug.h"
@ -330,8 +331,16 @@ HRESULT WINAPI ITSS_IStorageImpl_OpenStream(
len = strlenW( This->dir ) + strlenW( pwcsName ) + 1;
path = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
strcpyW( path, This->dir );
if( pwcsName[0] == '/' )
{
WCHAR *p = &path[strlenW( path ) - 1];
while( ( path <= p ) && ( *p = '/' ) )
*p-- = 0;
}
strcatW( path, pwcsName );
TRACE("Resolving %s\n", debugstr_w(path));
r = chm_resolve_object(This->chmfile, path, &ui);
HeapFree( GetProcessHeap(), 0, path );
@ -368,7 +377,10 @@ HRESULT WINAPI ITSS_IStorageImpl_OpenStorage(
DWORD reserved,
IStorage** ppstg)
{
FIXME("\n");
ICOM_THIS(ITSS_IStorageImpl,iface);
FIXME("%p %s %p %lu %p %lu %p\n", This, debugstr_w(pwcsName),
pstgPriority, grfMode, snbExclude, reserved, ppstg);
return E_NOTIMPL;
}
@ -749,8 +761,21 @@ static HRESULT WINAPI ITSS_IStream_Stat(
STATSTG* pstatstg,
DWORD grfStatFlag)
{
FIXME("\n");
return E_NOTIMPL;
ICOM_THIS(IStream_Impl,iface);
TRACE("%p %p %ld\n", This, pstatstg, grfStatFlag);
memset( pstatstg, 0, sizeof *pstatstg );
if( !( grfStatFlag & STATFLAG_NONAME ) )
{
FIXME("copy the name\n");
}
pstatstg->type = STGTY_STREAM;
pstatstg->cbSize.QuadPart = This->ui.length;
pstatstg->grfMode = STGM_READ;
memcpy( &pstatstg->clsid, &CLSID_ITStorage, sizeof (CLSID) );
return S_OK;
}
static HRESULT WINAPI ITSS_IStream_Clone(