Commit ed494ec5 authored by Noomen Hamza's avatar Noomen Hamza Committed by Alexandre Julliard

Implemented:

- IMoniker interface for FileMoniker,ItemMoniker,AntiMoniker and GenericCompositeMoniker - IRunningObjectTable interface, and - IBindCtx interface.
parent 44a79c49
#ifndef __WINE_COMPOBJ_H
#define __WINE_COMPOBJ_H
/* "compobj.h" is obsolete, you should include "objbase.h" instead */
/* All private prototye functions used by OLE will be added to this header file */
#include "objbase.h"
/* This function initialize the Running Object Table */
HRESULT WINAPI RunningObjectTableImpl_Initialize();
/* This function uninitialize the Running Object Table */
HRESULT WINAPI RunningObjectTableImpl_UnInitialize();
/* This function decompose a String path to a String Table containing all the elements ("\" or "subDirectory" or "Directoy" or "FileName") of the path */
int WINAPI FileMonikerImpl_DecomposePath(LPOLESTR str, LPOLESTR** stringTable);
#endif /* __WINE_COMPOBJ_H */
......@@ -20,6 +20,8 @@
#include "wine/obj_dragdrop.h"
HRESULT WINAPI GetClassFile(LPOLESTR filePathName,CLSID *pclsid);
#ifdef __cplusplus
extern "C" {
#endif
......
......@@ -28,15 +28,15 @@ HRESULT WINAPI RevokeDragDrop16(HWND16);
HRESULT WINAPI RevokeDragDrop(HWND);
HRESULT WINAPI DoDragDrop16(LPDATAOBJECT,LPDROPSOURCE,DWORD,DWORD*);
HRESULT WINAPI DoDragDrop(LPDATAOBJECT,LPDROPSOURCE,DWORD,DWORD*);
HOLEMENU WINAPI OleCreateMenuDescriptor(HMENU hmenuCombined,
LPOLEMENUGROUPWIDTHS lpMenuWidths);
HRESULT WINAPI OleLoadFromStream(IStream *pStm,REFIID iidInterface,void** ppvObj);
HRESULT WINAPI OleSaveToStream(IPersistStream *pPStm,IStream *pStm);
HOLEMENU WINAPI OleCreateMenuDescriptor(HMENU hmenuCombined,LPOLEMENUGROUPWIDTHS lpMenuWidths);
HRESULT WINAPI OleDestroyMenuDescriptor(HOLEMENU hmenuDescriptor);
HRESULT WINAPI OleSetMenuDescriptor(HOLEMENU hmenuDescriptor,
HWND hwndFrame,
HWND hwndActiveObject,
LPOLEINPLACEFRAME lpFrame,
LPOLEINPLACEACTIVEOBJECT lpActiveObject);
HRESULT WINAPI OleSetMenuDescriptor(HOLEMENU hmenuDescriptor,HWND hwndFrame,HWND hwndActiveObject,LPOLEINPLACEFRAME lpFrame,LPOLEINPLACEACTIVEOBJECT lpActiveObject);
HRESULT WINAPI ReadClassStg(IStorage *pstg,CLSID *pclsid);
HRESULT WINAPI WriteClassStm(IStream *pStm,REFCLSID rclsid);
HRESULT WINAPI ReadClassStm(IStream *pStm,REFCLSID pclsid);
#endif /* __WINE_OLE2_H */
......@@ -817,6 +817,10 @@ HRESULT WINAPI CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, LPVOID pvRe
HRESULT WINAPI CoInitialize16(LPVOID lpReserved);
HRESULT WINAPI CoInitialize(LPVOID lpReserved);
HRESULT WINAPI CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit);
void WINAPI CoUninitialize16(void);
void WINAPI CoUninitialize(void);
typedef enum tagCOINIT
{
......@@ -826,7 +830,6 @@ typedef enum tagCOINIT
COINIT_SPEED_OVER_MEMORY = 0x8 /* Trade memory for speed */
} COINIT;
HRESULT WINAPI CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit);
/* FIXME: not implemented */
BOOL WINAPI CoIsOle1Class(REFCLSID rclsid);
......@@ -850,10 +853,6 @@ HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid,LPUNKNOWN pUnk,DWORD dwClsC
HRESULT WINAPI CoRevokeClassObject(DWORD dwRegister);
void WINAPI CoUninitialize16(void);
void WINAPI CoUninitialize(void);
/*****************************************************************************
* Internal WINE API
*/
......
......@@ -384,7 +384,7 @@ ICOM_DEFINE(IParseDisplayName,IUnknown)
#define IParseDisplayName_AddRef(p) ICOM_CALL (AddRef,p)
#define IParseDisplayName_Release(p) ICOM_CALL (Release,p)
/*** IParseDisplayName methods ***/
#define IParseDisplayName_ParseDisplayName(p,a,b,c,d) ICOM_CALL4(ParseDisplayName,a,b,c,d)
#define IParseDisplayName_ParseDisplayName(p,a,b,c,d) ICOM_CALL4(ParseDisplayName,p,a,b,c,d)
#endif
......
......@@ -33,7 +33,13 @@ typedef struct IRunnableObject IRunnableObject,*LPRUNNABLEOBJECT;
DEFINE_OLEGUID(IID_IRunningObjectTable, 0x00000010L, 0, 0);
typedef struct IRunningObjectTable IRunningObjectTable,*LPRUNNINGOBJECTTABLE;
DEFINE_GUID( CLSID_FileMoniker,0x00000303,0,0,0xc0,0,0,0,0,0,0,0x46);
DEFINE_GUID( CLSID_ItemMoniker,0x00000304,0,0,0xc0,0,0,0,0,0,0,0x46);
DEFINE_GUID( CLSID_AntiMoniker,0x00000305,0,0,0xc0,0,0,0,0,0,0,0x46);
DEFINE_GUID( CLSID_CompositeMoniker,0x00000309,0,0,0xc0,0,0,0,0,0,0,0x46);
/*********************************************************************************
* BIND_OPTS and BIND_OPTS2 structures definition
......@@ -66,12 +72,12 @@ typedef struct tagBIND_OPTS2
#define IBindCtx_METHODS \
ICOM_METHOD1 (HRESULT, RegisterObjectBound, IUnknown*,punk) \
ICOM_METHOD1 (HRESULT, RevokeObjectBound, IUnknown*,punk) \
ICOM_METHOD (HRESULT, ReleaseObjects) \
ICOM_METHOD (HRESULT, ReleaseBoundObjects) \
ICOM_METHOD1 (HRESULT, SetBindOptions, LPBIND_OPTS2,pbindopts) \
ICOM_METHOD1 (HRESULT, GetBindOptions, LPBIND_OPTS2,pbindopts) \
ICOM_METHOD1 (HRESULT, GetRunningObjectTable,IRunningObjectTable**,pprot) \
ICOM_METHOD2 (HRESULT, RegisterObjectParam, LPOLESTR,pszkey, IUnknown*,punk) \
ICOM_METHOD2 (HRESULT, GetObjectParam, LPOLESTR,pszkey, IUnknown*,punk) \
ICOM_METHOD2 (HRESULT, GetObjectParam, LPOLESTR,pszkey, IUnknown**,punk) \
ICOM_METHOD1 (HRESULT, EnumObjectParam, IEnumString**,ppenum) \
ICOM_METHOD1 (HRESULT, RevokeObjectParam, LPOLESTR,pszkey)
#define IBindCtx_IMETHODS \
......@@ -88,7 +94,7 @@ ICOM_DEFINE(IBindCtx,IUnknown)
/* IBindCtx methods*/
#define IBindCtx_RegisterObjectBound(p,a) ICOM_CALL1(RegisterObjectBound,p,a)
#define IBindCtx_RevokeObjectBound(p,a) ICOM_CALL1(RevokeObjectBound,p,a)
#define IBindCtx_ReleaseObjects(p) ICOM_CALL (ReleaseObjects,p)
#define IBindCtx_ReleaseBoundObjects(p) ICOM_CALL (ReleaseBoundObjects,p)
#define IBindCtx_SetBindOptions(p,a) ICOM_CALL1(SetBindOptions,p,a)
#define IBindCtx_GetBindOptions(p,a) ICOM_CALL1(GetBindOptions,p,a)
#define IBindCtx_GetRunningObjectTable(p,a) ICOM_CALL1(GetRunningObjectTable,p,a)
......@@ -101,7 +107,6 @@ ICOM_DEFINE(IBindCtx,IUnknown)
HRESULT WINAPI CreateBindCtx16(DWORD reserved, LPBC* ppbc);
HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC* ppbc);
/*****************************************************************************
* IClassActivator interface
*/
......@@ -151,7 +156,6 @@ ICOM_DEFINE(IEnumMoniker,IUnknown)
#define IEnumMoniker_Clone(p,a) ICOM_CALL1(Clone,p,a)
#endif
/*****************************************************************************
* IMoniker interface
*/
......@@ -203,6 +207,7 @@ ICOM_DEFINE(IMoniker,IPersistStream)
#define IMoniker_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
#define IMoniker_AddRef(p) ICOM_CALL (AddRef,p)
#define IMoniker_Release(p) ICOM_CALL (Release,p)
/*** IPersist methods ***/
#define IMoniker_GetClassID(p,a) ICOM_CALL1(GetClassID,p,a)
/*** IPersistStream methods ***/
......@@ -211,45 +216,44 @@ ICOM_DEFINE(IMoniker,IPersistStream)
#define IMoniker_Save(p,a,b) ICOM_CALL2(Save,p,a,b)
#define IMoniker_GetSizeMax(p,a) ICOM_CALL1(GetSizeMax,p,a)
/*** IMoniker methods ***/
#define IMoniker_BindToObject(p,a,b,c,d) ICOM_CALL(BindToObject,p,a,b,c,d)
#define IMoniker_BindToStorage(p,a,b,c,d) ICOM_CALL(BindToStorage,p,a,b,c,d)
#define IMoniker_Reduce(p,a,b,c,d) ICOM_CALL(Reduce,p,a,b,c,d)
#define IMoniker_ComposeWith(p,a,b,c) ICOM_CALL(ComposeWith,p,a,b,c)
#define IMoniker_Enum(p,a,b) ICOM_CALL(Enum,p,a,b)
#define IMoniker_IsEqual(p,a) ICOM_CALL(IsEqual,p,a)
#define IMoniker_Hash(p,a) ICOM_CALL(Hash,p,a)
#define IMoniker_IsRunning(p,a,b,c) ICOM_CALL(IsRunning,p,a,b,c)
#define IMoniker_GetTimeOfLastChange(p,a,b,c) ICOM_CALL(GetTimeOfLastChange,p,a,b,c)
#define IMoniker_Inverse(p,a) ICOM_CALL(Inverse,p,a)
#define IMoniker_CommonPrefixWith(p,a,b) ICOM_CALL(CommonPrefixWith,p,a,b)
#define IMoniker_RelativePathTo(p,a,b) ICOM_CALL(RelativePathTo,p,a,b)
#define IMoniker_GetDisplayName(p,a,b,c) ICOM_CALL(GetDisplayName,p,a,b,c)
#define IMoniker_ParseDisplayName(p,a,b,c,d,e) ICOM_CALL(ParseDisplayName,p,a,b,c,d,e)
#define IMoniker_IsSystemMoniker(p,a) ICOM_CALL(IsSystemMoniker,p,a)
#define IMoniker_BindToObject(p,a,b,c,d) ICOM_CALL4(BindToObject,p,a,b,c,d)
#define IMoniker_BindToStorage(p,a,b,c,d) ICOM_CALL4(BindToStorage,p,a,b,c,d)
#define IMoniker_Reduce(p,a,b,c,d) ICOM_CALL4(Reduce,p,a,b,c,d)
#define IMoniker_ComposeWith(p,a,b,c) ICOM_CALL3(ComposeWith,p,a,b,c)
#define IMoniker_Enum(p,a,b) ICOM_CALL2(Enum,p,a,b)
#define IMoniker_IsEqual(p,a) ICOM_CALL1(IsEqual,p,a)
#define IMoniker_Hash(p,a) ICOM_CALL1(Hash,p,a)
#define IMoniker_IsRunning(p,a,b,c) ICOM_CALL3(IsRunning,p,a,b,c)
#define IMoniker_GetTimeOfLastChange(p,a,b,c) ICOM_CALL3(GetTimeOfLastChange,p,a,b,c)
#define IMoniker_Inverse(p,a) ICOM_CALL1(Inverse,p,a)
#define IMoniker_CommonPrefixWith(p,a,b) ICOM_CALL2(CommonPrefixWith,p,a,b)
#define IMoniker_RelativePathTo(p,a,b) ICOM_CALL2(RelativePathTo,p,a,b)
#define IMoniker_GetDisplayName(p,a,b,c) ICOM_CALL3(GetDisplayName,p,a,b,c)
#define IMoniker_ParseDisplayName(p,a,b,c,d,e) ICOM_CALL5(ParseDisplayName,p,a,b,c,d,e)
#define IMoniker_IsSystemMoniker(p,a) ICOM_CALL1(IsSystemMoniker,p,a)
#endif
/* FIXME: not implemented */
HRESULT WINAPI BindMoniker(LPMONIKER pmk, DWORD grfOpt, REFIID iidResult, LPVOID* ppvResult);
/* FIXME: not implemented */
HRESULT WINAPI CreateAntiMoniker(LPMONIKER* ppmk);
/* FIXME: not implemented */
HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, LPMONIKER* ppmk);
HRESULT WINAPI CreateFileMoniker16(LPCOLESTR16 lpszPathName, LPMONIKER* ppmk);
HRESULT WINAPI CreateFileMoniker(LPCOLESTR lpszPathName, LPMONIKER* ppmk);
HRESULT WINAPI CreateItemMoniker16(LPCOLESTR16 lpszDelim, LPCOLESTR lpszItem, LPMONIKER* ppmk);
HRESULT WINAPI CreateItemMoniker(LPCOLESTR lpszDelim, LPCOLESTR lpszItem, LPMONIKER* ppmk);
/* FIXME: not implemented */
HRESULT WINAPI CreateAntiMoniker(LPMONIKER * ppmk);
HRESULT WINAPI CreateGenericComposite(LPMONIKER pmkFirst, LPMONIKER pmkRest, LPMONIKER* ppmkComposite);
/* FIXME: not implemented */
HRESULT WINAPI CreatePointerMoniker(LPUNKNOWN punk, LPMONIKER* ppmk);
HRESULT WINAPI BindMoniker(LPMONIKER pmk, DWORD grfOpt, REFIID iidResult, LPVOID* ppvResult);
/* FIXME: not implemented */
HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, LPMONIKER* ppmk);
/* FIXME: not implemented */
HRESULT WINAPI CreatePointerMoniker(LPUNKNOWN punk, LPMONIKER* ppmk);
/* FIXME: not implemented */
HRESULT WINAPI MonikerCommonPrefixWith(IMoniker* pmkThis,IMoniker* pmkOther,IMoniker** ppmkCommon);
/*****************************************************************************
* IROTData interface
*/
......@@ -271,6 +275,7 @@ ICOM_DEFINE(IROTData,IUnknown)
#define IROTData_GetComparisonData(p,a,b,c) ICOM_CALL3(GetComparisonData,p,a,b,c)
#endif
#define ICOM_THIS_From_IROTData(class, name) class* This = (class*)(((void*)name)-sizeof(void*))
/*****************************************************************************
* IRunnableObject interface
......@@ -335,6 +340,8 @@ ICOM_DEFINE(IRunningObjectTable,IUnknown)
#define IRunningObjectTable_EnumRunning(p,a) ICOM_CALL1(EnumRunning,p,a)
#endif
HRESULT WINAPI GetRunningObjectTable(DWORD reserved, LPVOID *pprot);
HRESULT WINAPI GetRunningObjectTable16(DWORD reserved, LPVOID *pprot);
/*****************************************************************************
* Additional API
......
......@@ -299,6 +299,7 @@ extern int WIN32_LastError;
#define E_POINTER 0x80004003
#define E_ABORT 0x80004004
#define E_FAIL 0x80004005
#define E_UNSPEC E_FAIL // must to be defined (used by FileMoniker, IOleLink and DoDragDrop as a return value)
/*#define CO_E_INIT_TLS 0x80004006
#define CO_E_INIT_SHARED_ALLOCATOR 0x80004007
......@@ -313,9 +314,11 @@ extern int WIN32_LastError;
#define CO_E_INIT_SCM_MAP_VIEW_OF_FILE 0x80004010
#define CO_E_INIT_SCM_EXEC_FAILURE 0x80004011
#define CO_E_INIT_ONLY_SINGLE_THREADED 0x80004012 */
#define CO_E_ERRORINDLL 0x800401F9L
#define CO_E_NOTINITIALIZED 0x800401F0
#define CO_E_ERRORINDLL 0x800401F9
#define CO_E_OBJISREG 0x800401FB
#define OLE_E_ENUM_NOMORE 0x80040002
#define OLE_E_ADVISENOTSUPPORTED 0x80040003
#define OLE_E_NOCONNECTION 0x80040004
......@@ -326,18 +329,46 @@ extern int WIN32_LastError;
#define OLE_E_STATIC 0x8004000B
#define OLE_E_PROMPTSAVECANCELLED 0x8004000C
#define OLE_S_USEREG 0x00040000
#define DV_E_FORMATETC 0x80040064
#define DV_E_DVASPECT 0x8004006B
#define CLASS_E_NOAGGREGATION 0x80040110
#define CLASS_E_CLASSNOTAVAILABLE 0x80040111
#define DATA_S_SAMEFORMATETC 0x80040130
#define E_ACCESSDENIED 0x80070005
#define E_HANDLE 0x80070006
#define E_OUTOFMEMORY 0x8007000E
#define E_INVALIDARG 0x80070057
/*#define OLE_E_FIRST 0x80040000L */
/*#define OLE_E_LAST 0x800400FFL */
/*#define OLE_S_FIRST 0x00040000L */
/*#define OLE_S_LAST 0x000400FFL */
#define MK_S_REDUCED_TO_SELF 0x000401E2
#define MK_S_ME 0x000401E4
#define MK_S_HIM 0x000401E5
#define MK_S_US 0x000401E6
#define MK_S_MONIKERALREADYREGISTERED 0x000401E7
#define MK_E_EXCEEDEDDEADLINE 0x800401E1
#define MK_E_NEEDGENERIC 0x800401E2
#define MK_E_UNAVAILABLE 0x800401E3
#define MK_E_SYNTAX 0x800401E4
#define MK_E_NOOBJECT 0x800401E5
#define MK_E_INVALIDEXTENSION 0x800401E6
#define MK_E_INTERMEDIATEINTERFACENOTSUPPORTED 0x800401E7
#define MK_E_NOTBINDABLE 0x800401E8
#define MK_E_NOTBOUND 0x800401E9
#define MK_E_CANTOPENFILE 0x800401EA
#define MK_E_MIUSTBOTHERUSER 0x800401EB
#define MK_E_NOINVERSE 0x800401EC
#define MK_E_NOSTORAGE 0x800401ED
#define MK_E_NOPREFIX 0x800401EE
#define STG_E_INVALIDFUNCTION 0x80030001
#define STG_E_FILENOTFOUND 0x80030002
#define STG_E_PATHNOTFOUND 0x80030003
......@@ -405,11 +436,6 @@ extern int WIN32_LastError;
#define CLASS_E_NOAGGREGATION 0x80040110
#define CLASS_E_CLASSNOTAVAILABLE 0x80040111
#define MK_E_EXCEEDEDDEADLINE 0x800401E1L
#define MK_E_SYNTAX 0x800401E4L
#define MK_E_NOOBJECT 0x800401E5L
#define MK_E_INVALIDEXTENSION 0x800401E6L
#define MK_E_NOSTORAGE 0x800401EDL
#define OLEOBJ_E_NOVERBS 0x00040180L
#define OLEOBJ_S_INVALIDVERB 0x00040180L
......
......@@ -228,6 +228,12 @@ typedef struct {
PACL Dacl;
} SECURITY_DESCRIPTOR, *PSECURITY_DESCRIPTOR;
#ifndef _ROTFLAGS_DEFINED
#define _ROTFLAGS_DEFINED
#define ROTFLAGS_REGISTRATIONKEEPSALIVE 0x1
#define ROTFLAGS_ALLOWANYCLIENT 0x2
#endif // !_ROTFLAGS_DEFINED
#endif /* _SECURITY_DEFINED */
......
......@@ -6,8 +6,10 @@ VPATH = @srcdir@
MODULE = ole
C_SRCS = \
antimoniker.c \
bindctx.c \
compobj.c \
compositemoniker.c \
filemoniker.c \
guid.c \
ifs.c \
......@@ -23,10 +25,10 @@ C_SRCS = \
olesvr.c \
parsedt.c \
safearray.c \
storage.c \
storage32.c \
stg_bigblockfile.c \
stg_stream.c \
storage.c \
storage32.c \
typelib.c \
variant.c
......
......@@ -50,7 +50,7 @@
#include "wine/obj_clientserver.h"
#include "ifs.h"
#include "compobj.h"
/****************************************************************************
* COM External Lock structures and methods declaration
*
......@@ -270,6 +270,8 @@ HRESULT WINAPI CoInitializeEx(
*/
TRACE(ole, "() - Initializing the COM libraries\n");
RunningObjectTableImpl_Initialize();
hr = S_OK;
}
else
......@@ -322,6 +324,7 @@ void WINAPI CoUninitialize(void)
*/
TRACE(ole, "() - Releasing the COM libraries\n");
RunningObjectTableImpl_UnInitialize();
/*
* Release the references to the registered class objects.
*/
......@@ -738,7 +741,7 @@ HRESULT WINE_StringFromCLSID(
return E_FAIL;
}
sprintf(idstr, "{%08lX-%04X-%04X-%02x%02X-",
sprintf(idstr, "{%08lX-%04X-%04X-%02X%02X-",
id->Data1, id->Data2, id->Data3,
id->Data4[0], id->Data4[1]);
s = &idstr[25];
......@@ -894,6 +897,47 @@ HRESULT WINAPI CLSIDFromProgID(
return ret;
}
/************************************************************************************************
* OleSaveToStream
*
* This function write a CLSID on stream
*/
HRESULT WINAPI WriteClassStm(IStream *pStm,REFCLSID rclsid)
{
TRACE(ole,"(%p,%p)\n",pStm,rclsid);
if (rclsid==NULL)
return E_INVALIDARG;
return IStream_Write(pStm,rclsid,sizeof(CLSID),NULL);
}
/************************************************************************************************
* OleSaveToStream
*
* This function read a CLSID from a stream
*/
HRESULT WINAPI ReadClassStm(IStream *pStm,REFCLSID rclsid)
{
ULONG nbByte;
HRESULT res;
TRACE(ole,"(%p,%p)\n",pStm,rclsid);
if (rclsid==NULL)
return E_INVALIDARG;
res = IStream_Read(pStm,(void*)rclsid,sizeof(CLSID),&nbByte);
if (FAILED(res))
return res;
if (nbByte != sizeof(CLSID))
return S_FALSE;
else
return S_OK;
}
/* FIXME: this function is not declared in the WINELIB headers. But where should it go ? */
/***********************************************************************
* LookupETask (COMPOBJ.94)
......@@ -1248,6 +1292,97 @@ HRESULT WINAPI CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext,
return hres;
}
/****************************************************************************************
* GetClassFile
*
* This function supplies the CLSID associated with the given filename.
*/
HRESULT WINAPI GetClassFile(LPOLESTR filePathName,CLSID *pclsid)
{
IStorage *pstg=0;
HRESULT res;
int nbElm=0,length=0,i=0;
LONG sizeProgId=20;
LPOLESTR *pathDec=0,absFile=0,progId=0;
WCHAR extention[100]={0};
TRACE(ole,"()\n");
/* if the file contain a storage object the return the CLSID writen by IStorage_SetClass method*/
if((StgIsStorageFile(filePathName))==S_OK){
res=StgOpenStorage(filePathName,NULL,STGM_READ | STGM_SHARE_DENY_WRITE,NULL,0,&pstg);
if (SUCCEEDED(res))
res=ReadClassStg(pstg,pclsid);
IStorage_Release(pstg);
return res;
}
/* if the file is not a storage object then attemps to match various bits in the file against a
pattern in the registry. this case is not frequently used ! so I present only the psodocode for
this case
for(i=0;i<nFileTypes;i++)
for(i=0;j<nPatternsForType;j++){
PATTERN pat;
HANDLE hFile;
pat=ReadPatternFromRegistry(i,j);
hFile=CreateFileW(filePathName,,,,,,hFile);
SetFilePosition(hFile,pat.offset);
ReadFile(hFile,buf,pat.size,NULL,NULL);
if (memcmp(buf&pat.mask,pat.pattern.pat.size)==0){
*pclsid=ReadCLSIDFromRegistry(i);
return S_OK;
}
}
*/
/* if the obove strategies fail then search for the extension key in the registry */
/* get the last element (absolute file) in the path name */
nbElm=FileMonikerImpl_DecomposePath(filePathName,&pathDec);
absFile=pathDec[nbElm-1];
/* failed if the path represente a directory and not an absolute file name*/
if (lstrcmpW(absFile,(LPOLESTR)"\\"))
return MK_E_INVALIDEXTENSION;
/* get the extension of the file */
length=lstrlenW(absFile);
for(i=length-1; ( (i>=0) && (extention[i]=absFile[i]) );i--);
/* get the progId associated to the extension */
progId=CoTaskMemAlloc(sizeProgId);
res=RegQueryValueW(HKEY_CLASSES_ROOT,extention,progId,&sizeProgId);
if (res==ERROR_MORE_DATA){
CoTaskMemRealloc(progId,sizeProgId);
res=RegQueryValueW(HKEY_CLASSES_ROOT,extention,progId,&sizeProgId);
}
if (res==ERROR_SUCCESS)
/* return the clsid associated to the progId */
res= CLSIDFromProgID(progId,pclsid);
for(i=0; pathDec[i]!=NULL;i++)
CoTaskMemFree(pathDec[i]);
CoTaskMemFree(pathDec);
CoTaskMemFree(progId);
if (res==ERROR_SUCCESS)
return res;
return MK_E_INVALIDEXTENSION;
}
/******************************************************************************
* CoRegisterMessageFilter16 [COMPOBJ.27]
*/
......@@ -1413,7 +1548,6 @@ LPVOID WINAPI CoTaskMemAlloc(
return IMalloc_Alloc(lpmalloc,size);
}
/***********************************************************************
* CoTaskMemFree (OLE32.44)
*/
......
......@@ -25,6 +25,7 @@
#include "windef.h"
#include "storage32.h"
#include "ole2.h"
#define FILE_BEGIN 0
......@@ -5159,6 +5160,83 @@ HRESULT WINAPI WriteClassStg(IStorage* pStg, REFCLSID rclsid)
return hRes;
}
/*******************************************************************************************
* ReadClassStg
*
* This method reads the CLSID previously written to a storage object with the WriteClassStg.
*/
HRESULT WINAPI ReadClassStg(IStorage *pstg,CLSID *pclsid){
STATSTG pstatstg;
HRESULT hRes;
TRACE(ole,"()\n");
if(pclsid==NULL)
return E_POINTER;
/*
* read a STATSTG structure (contains the clsid) from the storage
*/
hRes=IStorage_Stat(pstg,&pstatstg,STATFLAG_DEFAULT);
if(SUCCEEDED(hRes))
*pclsid=pstatstg.clsid;
return hRes;
}
/*************************************************************************************
* OleLoadFromStream
*
* This function loads an object from stream
*/
HRESULT WINAPI OleLoadFromStream(IStream *pStm,REFIID iidInterface,void** ppvObj)
{
CLSID clsid;
HRESULT res;
FIXME(ole,"(),stub!\n");
res=ReadClassStm(pStm,&clsid);
if (SUCCEEDED(res)){
res=CoCreateInstance(&clsid,NULL,CLSCTX_INPROC_SERVER,iidInterface,ppvObj);
if (SUCCEEDED(res))
res=IPersistStream_Load((IPersistStream*)ppvObj,pStm);
}
return res;
}
/************************************************************************************************
* OleSaveToStream
*
* This function saves an object with the IPersistStream interface on it to the specified stream
*/
HRESULT WINAPI OleSaveToStream(IPersistStream *pPStm,IStream *pStm)
{
CLSID clsid;
HRESULT res;
TRACE(ole,"(%p,%p)\n",pPStm,pStm);
res=IPersistStream_GetClassID(pPStm,&clsid);
if (SUCCEEDED(res)){
res=WriteClassStm(pStm,&clsid);
if (SUCCEEDED(res))
res=IPersistStream_Save(pPStm,pStm,FALSE);
}
return res;
}
/****************************************************************************
* This method validate a STGM parameter that can contain the values below
......@@ -5306,7 +5384,7 @@ static DWORD GetShareModeFromSTGM(DWORD stgm)
*/
static DWORD GetAccessModeFromSTGM(DWORD stgm)
{
DWORD dwDesiredAccess = 0;
DWORD dwDesiredAccess = GENERIC_READ;
BOOL bSTGM_WRITE = ((stgm & STGM_WRITE) == STGM_WRITE);
BOOL bSTGM_READWRITE = ((stgm & STGM_READWRITE) == STGM_READWRITE);
BOOL bSTGM_READ = ! (bSTGM_WRITE || bSTGM_READWRITE);
......
......@@ -51,12 +51,12 @@ type win32
48 stub CoUnloadingWOW
49 stub CoUnmarshalHresult # stdcall (ptr ptr) return 0,ERR_NOTIMPLEMENTED
50 stub CoUnmarshalInterface # stdcall (ptr ptr ptr) return 0,ERR_NOTIMPLEMENTED
51 stub CreateAntiMoniker # stdcall (ptr) return 0,ERR_NOTIMPLEMENTED
51 stdcall CreateAntiMoniker(ptr) CreateAntiMoniker
52 stdcall CreateBindCtx(long ptr) CreateBindCtx
53 stub CreateDataAdviseHolder # stdcall (ptr) return 0,ERR_NOTIMPLEMENTED
54 stub CreateDataCache # stdcall (ptr ptr ptr ptr) return 0,ERR_NOTIMPLEMENTED
55 stdcall CreateFileMoniker(wstr ptr) CreateFileMoniker
56 stub CreateGenericComposite # stdcall (ptr ptr ptr) return 0,ERR_NOTIMPLEMENTED
56 stdcall CreateGenericComposite(ptr ptr ptr) CreateGenericComposite
57 stub CreateILockBytesOnHGlobal # stdcall (ptr long ptr) return 0,ERR_NOTIMPLEMENTED
58 stdcall CreateItemMoniker(wstr wstr ptr) CreateItemMoniker
59 stdcall CreateOleAdviseHolder(ptr) CreateOleAdviseHolder
......@@ -67,7 +67,7 @@ type win32
64 stub DllGetClassObjectWOW
65 stdcall DoDragDrop(ptr ptr long ptr) DoDragDrop
66 stub EnableHookObject
67 stub GetClassFile
67 stdcall GetClassFile(ptr ptr) GetClassFile
68 stub GetConvertStg
69 stub GetDocumentBitStg
70 stub GetHGlobalFromILockBytes
......@@ -134,8 +134,8 @@ type win32
131 stdcall OleUninitialize() OleUninitialize
132 stub OpenOrCreateStream
133 stub ProgIDFromCLSID
134 stub ReadClassStg
135 stub ReadClassStm
134 stdcall ReadClassStg(ptr ptr) ReadClassStg
135 stdcall ReadClassStm(ptr ptr) ReadClassStm
136 stub ReadFmtUserTypeStg
137 stub ReadOleStg
138 stub ReadStringStream
......@@ -159,7 +159,7 @@ type win32
156 stub UtGetDvtd16Info
157 stub UtGetDvtd32Info
158 stdcall WriteClassStg(ptr ptr) WriteClassStg
159 stub WriteClassStm
159 stdcall WriteClassStm(ptr ptr) WriteClassStm
160 stub WriteFmtUserTypeStg
161 stub WriteOleStg
162 stub WriteStringStream
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment