Commit 912ffd6a authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Remove unnecessary declarations and make functions static.

parent 8a0f9898
...@@ -203,7 +203,7 @@ HRESULT WINAPI RunningObjectTableImpl_Initialize(void); ...@@ -203,7 +203,7 @@ HRESULT WINAPI RunningObjectTableImpl_Initialize(void);
HRESULT WINAPI RunningObjectTableImpl_UnInitialize(void); HRESULT WINAPI RunningObjectTableImpl_UnInitialize(void);
/* This function decomposes a String path to a String Table containing all the elements ("\" or "subDirectory" or "Directory" or "FileName") of the path */ /* This function decomposes a String path to a String Table containing all the elements ("\" or "subDirectory" or "Directory" or "FileName") of the path */
int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable); int FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable);
/* Apartment Functions */ /* Apartment Functions */
......
/*************************************************************************************** /*
* FileMonikers implementation * FileMonikers implementation
* *
* Copyright 1999 Noomen Hamza * Copyright 1999 Noomen Hamza
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************************/ */
#include <assert.h> #include <assert.h>
#include <stdarg.h> #include <stdarg.h>
...@@ -59,101 +59,18 @@ typedef struct FileMonikerImpl{ ...@@ -59,101 +59,18 @@ typedef struct FileMonikerImpl{
} FileMonikerImpl; } FileMonikerImpl;
/********************************************************************************/
/* FileMoniker prototype functions : */
/* IUnknown prototype functions */
static HRESULT WINAPI FileMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject);
static ULONG WINAPI FileMonikerImpl_AddRef(IMoniker* iface);
static ULONG WINAPI FileMonikerImpl_Release(IMoniker* iface);
/* IPersist prototype functions */
static HRESULT WINAPI FileMonikerImpl_GetClassID(IMoniker* iface, CLSID *pClassID);
/* IPersistStream prototype functions */
static HRESULT WINAPI FileMonikerImpl_IsDirty(IMoniker* iface);
static HRESULT WINAPI FileMonikerImpl_Load(IMoniker* iface, IStream* pStm);
static HRESULT WINAPI FileMonikerImpl_Save(IMoniker* iface, IStream* pStm, BOOL fClearDirty);
static HRESULT WINAPI FileMonikerImpl_GetSizeMax(IMoniker* iface, ULARGE_INTEGER* pcbSize);
/* IMoniker prototype functions */
static HRESULT WINAPI FileMonikerImpl_BindToObject(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, REFIID riid, VOID** ppvResult);
static HRESULT WINAPI FileMonikerImpl_BindToStorage(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, REFIID riid, VOID** ppvResult);
static HRESULT WINAPI FileMonikerImpl_Reduce(IMoniker* iface,IBindCtx* pbc, DWORD dwReduceHowFar,IMoniker** ppmkToLeft, IMoniker** ppmkReduced);
static HRESULT WINAPI FileMonikerImpl_ComposeWith(IMoniker* iface,IMoniker* pmkRight,BOOL fOnlyIfNotGeneric, IMoniker** ppmkComposite);
static HRESULT WINAPI FileMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker);
static HRESULT WINAPI FileMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker);
static HRESULT WINAPI FileMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash);
static HRESULT WINAPI FileMonikerImpl_IsRunning(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, IMoniker* pmkNewlyRunning);
static HRESULT WINAPI FileMonikerImpl_GetTimeOfLastChange(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft, FILETIME* pFileTime);
static HRESULT WINAPI FileMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk);
static HRESULT WINAPI FileMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther, IMoniker** ppmkPrefix);
static HRESULT WINAPI FileMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath);
static HRESULT WINAPI FileMonikerImpl_GetDisplayName(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, LPOLESTR *ppszDisplayName);
static HRESULT WINAPI FileMonikerImpl_ParseDisplayName(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, LPOLESTR pszDisplayName, ULONG* pchEaten, IMoniker** ppmkOut);
static HRESULT WINAPI FileMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys);
/********************************************************************************/
/* IROTData prototype functions */
/* IUnknown prototype functions */
static HRESULT WINAPI FileMonikerROTDataImpl_QueryInterface(IROTData* iface,REFIID riid,VOID** ppvObject);
static ULONG WINAPI FileMonikerROTDataImpl_AddRef(IROTData* iface);
static ULONG WINAPI FileMonikerROTDataImpl_Release(IROTData* iface);
/* IROTData prototype function */ /* IROTData prototype function */
static HRESULT WINAPI FileMonikerROTDataImpl_GetComparaisonData(IROTData* iface,BYTE* pbData,ULONG cbMax,ULONG* pcbData); static HRESULT WINAPI FileMonikerROTDataImpl_GetComparaisonData(IROTData* iface,BYTE* pbData,ULONG cbMax,ULONG* pcbData);
/* Local function used by filemoniker implementation */ /* Local function used by filemoniker implementation */
HRESULT WINAPI FileMonikerImpl_Construct(FileMonikerImpl* iface, LPCOLESTR lpszPathName); static HRESULT WINAPI FileMonikerImpl_Construct(FileMonikerImpl* iface, LPCOLESTR lpszPathName);
HRESULT WINAPI FileMonikerImpl_Destroy(FileMonikerImpl* iface); static HRESULT WINAPI FileMonikerImpl_Destroy(FileMonikerImpl* iface);
int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** tabStr);
/********************************************************************************/
/* Virtual function table for the FileMonikerImpl class which include IPersist,*/
/* IPersistStream and IMoniker functions. */
static IMonikerVtbl VT_FileMonikerImpl =
{
FileMonikerImpl_QueryInterface,
FileMonikerImpl_AddRef,
FileMonikerImpl_Release,
FileMonikerImpl_GetClassID,
FileMonikerImpl_IsDirty,
FileMonikerImpl_Load,
FileMonikerImpl_Save,
FileMonikerImpl_GetSizeMax,
FileMonikerImpl_BindToObject,
FileMonikerImpl_BindToStorage,
FileMonikerImpl_Reduce,
FileMonikerImpl_ComposeWith,
FileMonikerImpl_Enum,
FileMonikerImpl_IsEqual,
FileMonikerImpl_Hash,
FileMonikerImpl_IsRunning,
FileMonikerImpl_GetTimeOfLastChange,
FileMonikerImpl_Inverse,
FileMonikerImpl_CommonPrefixWith,
FileMonikerImpl_RelativePathTo,
FileMonikerImpl_GetDisplayName,
FileMonikerImpl_ParseDisplayName,
FileMonikerImpl_IsSystemMoniker
};
/********************************************************************************/
/* Virtual function table for the IROTData class. */
static IROTDataVtbl VT_ROTDataImpl =
{
FileMonikerROTDataImpl_QueryInterface,
FileMonikerROTDataImpl_AddRef,
FileMonikerROTDataImpl_Release,
FileMonikerROTDataImpl_GetComparaisonData
};
/******************************************************************************* /*******************************************************************************
* FileMoniker_QueryInterface * FileMoniker_QueryInterface
*******************************************************************************/ */
HRESULT WINAPI FileMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject) static HRESULT WINAPI
FileMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject)
{ {
FileMonikerImpl *This = (FileMonikerImpl *)iface; FileMonikerImpl *This = (FileMonikerImpl *)iface;
...@@ -182,15 +99,16 @@ HRESULT WINAPI FileMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ...@@ -182,15 +99,16 @@ HRESULT WINAPI FileMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void**
return E_NOINTERFACE; return E_NOINTERFACE;
/* Query Interface always increases the reference count by one when it is successful */ /* Query Interface always increases the reference count by one when it is successful */
FileMonikerImpl_AddRef(iface); IMoniker_AddRef(iface);
return S_OK; return S_OK;
} }
/****************************************************************************** /******************************************************************************
* FileMoniker_AddRef * FileMoniker_AddRef
******************************************************************************/ */
ULONG WINAPI FileMonikerImpl_AddRef(IMoniker* iface) static ULONG WINAPI
FileMonikerImpl_AddRef(IMoniker* iface)
{ {
FileMonikerImpl *This = (FileMonikerImpl *)iface; FileMonikerImpl *This = (FileMonikerImpl *)iface;
...@@ -201,8 +119,9 @@ ULONG WINAPI FileMonikerImpl_AddRef(IMoniker* iface) ...@@ -201,8 +119,9 @@ ULONG WINAPI FileMonikerImpl_AddRef(IMoniker* iface)
/****************************************************************************** /******************************************************************************
* FileMoniker_Release * FileMoniker_Release
******************************************************************************/ */
ULONG WINAPI FileMonikerImpl_Release(IMoniker* iface) static ULONG WINAPI
FileMonikerImpl_Release(IMoniker* iface)
{ {
FileMonikerImpl *This = (FileMonikerImpl *)iface; FileMonikerImpl *This = (FileMonikerImpl *)iface;
ULONG ref; ULONG ref;
...@@ -219,9 +138,9 @@ ULONG WINAPI FileMonikerImpl_Release(IMoniker* iface) ...@@ -219,9 +138,9 @@ ULONG WINAPI FileMonikerImpl_Release(IMoniker* iface)
/****************************************************************************** /******************************************************************************
* FileMoniker_GetClassID * FileMoniker_GetClassID
******************************************************************************/ */
HRESULT WINAPI FileMonikerImpl_GetClassID(IMoniker* iface, static HRESULT WINAPI
CLSID *pClassID)/* Pointer to CLSID of object */ FileMonikerImpl_GetClassID(IMoniker* iface, CLSID *pClassID)
{ {
TRACE("(%p,%p)\n",iface,pClassID); TRACE("(%p,%p)\n",iface,pClassID);
...@@ -235,12 +154,14 @@ HRESULT WINAPI FileMonikerImpl_GetClassID(IMoniker* iface, ...@@ -235,12 +154,14 @@ HRESULT WINAPI FileMonikerImpl_GetClassID(IMoniker* iface,
/****************************************************************************** /******************************************************************************
* FileMoniker_IsDirty * FileMoniker_IsDirty
******************************************************************************/ *
HRESULT WINAPI FileMonikerImpl_IsDirty(IMoniker* iface) * Note that the OLE-provided implementations of the IPersistStream::IsDirty
* method in the OLE-provided moniker interfaces always return S_FALSE because
* their internal state never changes.
*/
static HRESULT WINAPI
FileMonikerImpl_IsDirty(IMoniker* iface)
{ {
/* Note that the OLE-provided implementations of the IPersistStream::IsDirty
method in the OLE-provided moniker interfaces always return S_FALSE because
their internal state never changes. */
TRACE("(%p)\n",iface); TRACE("(%p)\n",iface);
...@@ -249,8 +170,12 @@ HRESULT WINAPI FileMonikerImpl_IsDirty(IMoniker* iface) ...@@ -249,8 +170,12 @@ HRESULT WINAPI FileMonikerImpl_IsDirty(IMoniker* iface)
/****************************************************************************** /******************************************************************************
* FileMoniker_Load * FileMoniker_Load
******************************************************************************/ *
HRESULT WINAPI FileMonikerImpl_Load(IMoniker* iface,IStream* pStm) * this function locates and reads from the stream the filePath string
* written by FileMonikerImpl_Save
*/
static HRESULT WINAPI
FileMonikerImpl_Load(IMoniker* iface,IStream* pStm)
{ {
HRESULT res; HRESULT res;
CHAR* filePathA; CHAR* filePathA;
...@@ -263,8 +188,6 @@ HRESULT WINAPI FileMonikerImpl_Load(IMoniker* iface,IStream* pStm) ...@@ -263,8 +188,6 @@ HRESULT WINAPI FileMonikerImpl_Load(IMoniker* iface,IStream* pStm)
TRACE("(%p,%p)\n",iface,pStm); TRACE("(%p,%p)\n",iface,pStm);
/* this function locates and reads from the stream the filePath string written by FileMonikerImpl_Save */
/* first WORD is non significative */ /* first WORD is non significative */
res=IStream_Read(pStm,&wbuffer,sizeof(WORD),&bread); res=IStream_Read(pStm,&wbuffer,sizeof(WORD),&bread);
if (bread!=sizeof(WORD) || wbuffer!=0) if (bread!=sizeof(WORD) || wbuffer!=0)
...@@ -334,12 +257,8 @@ HRESULT WINAPI FileMonikerImpl_Load(IMoniker* iface,IStream* pStm) ...@@ -334,12 +257,8 @@ HRESULT WINAPI FileMonikerImpl_Load(IMoniker* iface,IStream* pStm)
/****************************************************************************** /******************************************************************************
* FileMoniker_Save * FileMoniker_Save
******************************************************************************/ *
HRESULT WINAPI FileMonikerImpl_Save(IMoniker* iface, * This function saves data of this object. In the beginning I thougth
IStream* pStm,/* pointer to the stream where the object is to be saved */
BOOL fClearDirty)/* Specifies whether to clear the dirty flag */
{
/* this function saves data of this object. In the beginning I thougth
* that I have just to write the filePath string on Stream. But, when I * that I have just to write the filePath string on Stream. But, when I
* tested this function whith windows programs samples, I noticed that it * tested this function whith windows programs samples, I noticed that it
* was not the case. So I analysed data written by this function on * was not the case. So I analysed data written by this function on
...@@ -357,7 +276,9 @@ HRESULT WINAPI FileMonikerImpl_Save(IMoniker* iface, ...@@ -357,7 +276,9 @@ HRESULT WINAPI FileMonikerImpl_Save(IMoniker* iface,
* 8) filePath unicode string. * 8) filePath unicode string.
* if the length(filePath) > 8 or length(filePath) == 8 stop at step 5) * if the length(filePath) > 8 or length(filePath) == 8 stop at step 5)
*/ */
static HRESULT WINAPI
FileMonikerImpl_Save(IMoniker* iface, IStream* pStm, BOOL fClearDirty)
{
FileMonikerImpl *This = (FileMonikerImpl *)iface; FileMonikerImpl *This = (FileMonikerImpl *)iface;
HRESULT res; HRESULT res;
...@@ -426,9 +347,9 @@ HRESULT WINAPI FileMonikerImpl_Save(IMoniker* iface, ...@@ -426,9 +347,9 @@ HRESULT WINAPI FileMonikerImpl_Save(IMoniker* iface,
/****************************************************************************** /******************************************************************************
* FileMoniker_GetSizeMax * FileMoniker_GetSizeMax
******************************************************************************/ */
HRESULT WINAPI FileMonikerImpl_GetSizeMax(IMoniker* iface, static HRESULT WINAPI
ULARGE_INTEGER* pcbSize)/* Pointer to size of stream needed to save object */ FileMonikerImpl_GetSizeMax(IMoniker* iface, ULARGE_INTEGER* pcbSize)
{ {
FileMonikerImpl *This = (FileMonikerImpl *)iface; FileMonikerImpl *This = (FileMonikerImpl *)iface;
DWORD len=lstrlenW(This->filePathName); DWORD len=lstrlenW(This->filePathName);
...@@ -462,77 +383,6 @@ HRESULT WINAPI FileMonikerImpl_GetSizeMax(IMoniker* iface, ...@@ -462,77 +383,6 @@ HRESULT WINAPI FileMonikerImpl_GetSizeMax(IMoniker* iface,
} }
/****************************************************************************** /******************************************************************************
* FileMoniker_Construct (local function)
*******************************************************************************/
HRESULT WINAPI FileMonikerImpl_Construct(FileMonikerImpl* This, LPCOLESTR lpszPathName)
{
int nb=0,i;
int sizeStr=lstrlenW(lpszPathName);
LPOLESTR *tabStr=0;
static const WCHAR twoPoint[]={'.','.',0};
static const WCHAR bkSlash[]={'\\',0};
BYTE addBkSlash;
TRACE("(%p,%s)\n",This,debugstr_w(lpszPathName));
/* Initialize the virtual fgunction table. */
This->lpvtbl1 = &VT_FileMonikerImpl;
This->lpvtbl2 = &VT_ROTDataImpl;
This->ref = 0;
This->filePathName=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(sizeStr+1));
if (This->filePathName==NULL)
return E_OUTOFMEMORY;
strcpyW(This->filePathName,lpszPathName);
nb=FileMonikerImpl_DecomposePath(This->filePathName,&tabStr);
if (nb > 0 ){
addBkSlash=1;
if (lstrcmpW(tabStr[0],twoPoint)!=0)
addBkSlash=0;
else
for(i=0;i<nb;i++){
if ( (lstrcmpW(tabStr[i],twoPoint)!=0) && (lstrcmpW(tabStr[i],bkSlash)!=0) ){
addBkSlash=0;
break;
}
else
if (lstrcmpW(tabStr[i],bkSlash)==0 && i<nb-1 && lstrcmpW(tabStr[i+1],bkSlash)==0){
*tabStr[i]=0;
sizeStr--;
addBkSlash=0;
break;
}
}
if (lstrcmpW(tabStr[nb-1],bkSlash)==0)
addBkSlash=0;
This->filePathName=HeapReAlloc(GetProcessHeap(),0,This->filePathName,(sizeStr+1)*sizeof(WCHAR));
*This->filePathName=0;
for(i=0;tabStr[i]!=NULL;i++)
strcatW(This->filePathName,tabStr[i]);
if (addBkSlash)
strcatW(This->filePathName,bkSlash);
}
for(i=0; tabStr[i]!=NULL;i++)
CoTaskMemFree(tabStr[i]);
CoTaskMemFree(tabStr);
return S_OK;
}
/******************************************************************************
* FileMoniker_Destroy (local function) * FileMoniker_Destroy (local function)
*******************************************************************************/ *******************************************************************************/
HRESULT WINAPI FileMonikerImpl_Destroy(FileMonikerImpl* This) HRESULT WINAPI FileMonikerImpl_Destroy(FileMonikerImpl* This)
...@@ -547,12 +397,10 @@ HRESULT WINAPI FileMonikerImpl_Destroy(FileMonikerImpl* This) ...@@ -547,12 +397,10 @@ HRESULT WINAPI FileMonikerImpl_Destroy(FileMonikerImpl* This)
/****************************************************************************** /******************************************************************************
* FileMoniker_BindToObject * FileMoniker_BindToObject
******************************************************************************/ */
HRESULT WINAPI FileMonikerImpl_BindToObject(IMoniker* iface, static HRESULT WINAPI
IBindCtx* pbc, FileMonikerImpl_BindToObject(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft,
IMoniker* pmkToLeft, REFIID riid, VOID** ppvResult)
REFIID riid,
VOID** ppvResult)
{ {
HRESULT res=E_FAIL; HRESULT res=E_FAIL;
CLSID clsID; CLSID clsID;
...@@ -662,12 +510,10 @@ HRESULT WINAPI FileMonikerImpl_BindToObject(IMoniker* iface, ...@@ -662,12 +510,10 @@ HRESULT WINAPI FileMonikerImpl_BindToObject(IMoniker* iface,
/****************************************************************************** /******************************************************************************
* FileMoniker_BindToStorage * FileMoniker_BindToStorage
******************************************************************************/ */
HRESULT WINAPI FileMonikerImpl_BindToStorage(IMoniker* iface, static HRESULT WINAPI
IBindCtx* pbc, FileMonikerImpl_BindToStorage(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft,
IMoniker* pmkToLeft, REFIID riid, VOID** ppvObject)
REFIID riid,
VOID** ppvObject)
{ {
LPOLESTR filePath=0; LPOLESTR filePath=0;
IStorage *pstg=0; IStorage *pstg=0;
...@@ -680,7 +526,7 @@ HRESULT WINAPI FileMonikerImpl_BindToStorage(IMoniker* iface, ...@@ -680,7 +526,7 @@ HRESULT WINAPI FileMonikerImpl_BindToStorage(IMoniker* iface,
if (IsEqualIID(&IID_IStorage, riid)){ if (IsEqualIID(&IID_IStorage, riid)){
/* get the file name */ /* get the file name */
FileMonikerImpl_GetDisplayName(iface,pbc,pmkToLeft,&filePath); IMoniker_GetDisplayName(iface,pbc,pmkToLeft,&filePath);
/* verifie if the file contains a storage object */ /* verifie if the file contains a storage object */
res=StgIsStorageFile(filePath); res=StgIsStorageFile(filePath);
...@@ -718,30 +564,28 @@ HRESULT WINAPI FileMonikerImpl_BindToStorage(IMoniker* iface, ...@@ -718,30 +564,28 @@ HRESULT WINAPI FileMonikerImpl_BindToStorage(IMoniker* iface,
/****************************************************************************** /******************************************************************************
* FileMoniker_Reduce * FileMoniker_Reduce
******************************************************************************/ ******************************************************************************/
HRESULT WINAPI FileMonikerImpl_Reduce(IMoniker* iface, static HRESULT WINAPI
IBindCtx* pbc, FileMonikerImpl_Reduce(IMoniker* iface, IBindCtx* pbc, DWORD dwReduceHowFar,
DWORD dwReduceHowFar, IMoniker** ppmkToLeft, IMoniker** ppmkReduced)
IMoniker** ppmkToLeft,
IMoniker** ppmkReduced)
{ {
TRACE("(%p,%p,%ld,%p,%p)\n",iface,pbc,dwReduceHowFar,ppmkToLeft,ppmkReduced); TRACE("(%p,%p,%ld,%p,%p)\n",iface,pbc,dwReduceHowFar,ppmkToLeft,ppmkReduced);
if (ppmkReduced==NULL) if (ppmkReduced==NULL)
return E_POINTER; return E_POINTER;
FileMonikerImpl_AddRef(iface); IMoniker_AddRef(iface);
*ppmkReduced=iface; *ppmkReduced=iface;
return MK_S_REDUCED_TO_SELF; return MK_S_REDUCED_TO_SELF;
} }
/****************************************************************************** /******************************************************************************
* FileMoniker_ComposeWith * FileMoniker_ComposeWith
******************************************************************************/ */
HRESULT WINAPI FileMonikerImpl_ComposeWith(IMoniker* iface, static HRESULT WINAPI
IMoniker* pmkRight, FileMonikerImpl_ComposeWith(IMoniker* iface, IMoniker* pmkRight,
BOOL fOnlyIfNotGeneric, BOOL fOnlyIfNotGeneric, IMoniker** ppmkComposite)
IMoniker** ppmkComposite)
{ {
HRESULT res; HRESULT res;
LPOLESTR str1=0,str2=0,*strDec1=0,*strDec2=0,newStr=0; LPOLESTR str1=0,str2=0,*strDec1=0,*strDec2=0,newStr=0;
...@@ -768,7 +612,7 @@ HRESULT WINAPI FileMonikerImpl_ComposeWith(IMoniker* iface, ...@@ -768,7 +612,7 @@ HRESULT WINAPI FileMonikerImpl_ComposeWith(IMoniker* iface,
CreateBindCtx(0,&bind); CreateBindCtx(0,&bind);
FileMonikerImpl_GetDisplayName(iface,bind,NULL,&str1); IMoniker_GetDisplayName(iface,bind,NULL,&str1);
IMoniker_GetDisplayName(pmkRight,bind,NULL,&str2); IMoniker_GetDisplayName(pmkRight,bind,NULL,&str2);
/* decompose pathnames of the two monikers : (to prepare the path merge operation ) */ /* decompose pathnames of the two monikers : (to prepare the path merge operation ) */
...@@ -838,8 +682,9 @@ HRESULT WINAPI FileMonikerImpl_ComposeWith(IMoniker* iface, ...@@ -838,8 +682,9 @@ HRESULT WINAPI FileMonikerImpl_ComposeWith(IMoniker* iface,
/****************************************************************************** /******************************************************************************
* FileMoniker_Enum * FileMoniker_Enum
******************************************************************************/ */
HRESULT WINAPI FileMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker) static HRESULT WINAPI
FileMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker)
{ {
TRACE("(%p,%d,%p)\n",iface,fForward,ppenumMoniker); TRACE("(%p,%d,%p)\n",iface,fForward,ppenumMoniker);
...@@ -853,8 +698,9 @@ HRESULT WINAPI FileMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker* ...@@ -853,8 +698,9 @@ HRESULT WINAPI FileMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker*
/****************************************************************************** /******************************************************************************
* FileMoniker_IsEqual * FileMoniker_IsEqual
******************************************************************************/ */
HRESULT WINAPI FileMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker) static HRESULT WINAPI
FileMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker)
{ {
FileMonikerImpl *This = (FileMonikerImpl *)iface; FileMonikerImpl *This = (FileMonikerImpl *)iface;
CLSID clsid; CLSID clsid;
...@@ -886,8 +732,9 @@ HRESULT WINAPI FileMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker ...@@ -886,8 +732,9 @@ HRESULT WINAPI FileMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker
/****************************************************************************** /******************************************************************************
* FileMoniker_Hash * FileMoniker_Hash
******************************************************************************/ */
HRESULT WINAPI FileMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash) static HRESULT WINAPI
FileMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash)
{ {
FileMonikerImpl *This = (FileMonikerImpl *)iface; FileMonikerImpl *This = (FileMonikerImpl *)iface;
...@@ -920,10 +767,9 @@ HRESULT WINAPI FileMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash) ...@@ -920,10 +767,9 @@ HRESULT WINAPI FileMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash)
/****************************************************************************** /******************************************************************************
* FileMoniker_IsRunning * FileMoniker_IsRunning
******************************************************************************/ */
HRESULT WINAPI FileMonikerImpl_IsRunning(IMoniker* iface, static HRESULT WINAPI
IBindCtx* pbc, FileMonikerImpl_IsRunning(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft,
IMoniker* pmkToLeft,
IMoniker* pmkNewlyRunning) IMoniker* pmkNewlyRunning)
{ {
IRunningObjectTable* rot; IRunningObjectTable* rot;
...@@ -952,10 +798,9 @@ HRESULT WINAPI FileMonikerImpl_IsRunning(IMoniker* iface, ...@@ -952,10 +798,9 @@ HRESULT WINAPI FileMonikerImpl_IsRunning(IMoniker* iface,
/****************************************************************************** /******************************************************************************
* FileMoniker_GetTimeOfLastChange * FileMoniker_GetTimeOfLastChange
******************************************************************************/ ******************************************************************************/
HRESULT WINAPI FileMonikerImpl_GetTimeOfLastChange(IMoniker* iface, static HRESULT WINAPI
IBindCtx* pbc, FileMonikerImpl_GetTimeOfLastChange(IMoniker* iface, IBindCtx* pbc,
IMoniker* pmkToLeft, IMoniker* pmkToLeft, FILETIME* pFileTime)
FILETIME* pFileTime)
{ {
FileMonikerImpl *This = (FileMonikerImpl *)iface; FileMonikerImpl *This = (FileMonikerImpl *)iface;
IRunningObjectTable* rot; IRunningObjectTable* rot;
...@@ -990,10 +835,10 @@ HRESULT WINAPI FileMonikerImpl_GetTimeOfLastChange(IMoniker* iface, ...@@ -990,10 +835,10 @@ HRESULT WINAPI FileMonikerImpl_GetTimeOfLastChange(IMoniker* iface,
/****************************************************************************** /******************************************************************************
* FileMoniker_Inverse * FileMoniker_Inverse
******************************************************************************/ */
HRESULT WINAPI FileMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk) static HRESULT WINAPI
FileMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk)
{ {
TRACE("(%p,%p)\n",iface,ppmk); TRACE("(%p,%p)\n",iface,ppmk);
return CreateAntiMoniker(ppmk); return CreateAntiMoniker(ppmk);
...@@ -1001,8 +846,9 @@ HRESULT WINAPI FileMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk) ...@@ -1001,8 +846,9 @@ HRESULT WINAPI FileMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk)
/****************************************************************************** /******************************************************************************
* FileMoniker_CommonPrefixWith * FileMoniker_CommonPrefixWith
******************************************************************************/ */
HRESULT WINAPI FileMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** ppmkPrefix) static HRESULT WINAPI
FileMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** ppmkPrefix)
{ {
LPOLESTR pathThis,pathOther,*stringTable1,*stringTable2,commonPath; LPOLESTR pathThis,pathOther,*stringTable1,*stringTable2,commonPath;
...@@ -1089,8 +935,8 @@ HRESULT WINAPI FileMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOth ...@@ -1089,8 +935,8 @@ HRESULT WINAPI FileMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOth
/****************************************************************************** /******************************************************************************
* DecomposePath (local function) * DecomposePath (local function)
******************************************************************************/ */
int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable) int FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable)
{ {
static const WCHAR bSlash[] = {'\\',0}; static const WCHAR bSlash[] = {'\\',0};
WCHAR word[MAX_PATH]; WCHAR word[MAX_PATH];
...@@ -1144,8 +990,9 @@ int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable) ...@@ -1144,8 +990,9 @@ int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable)
/****************************************************************************** /******************************************************************************
* FileMoniker_RelativePathTo * FileMoniker_RelativePathTo
******************************************************************************/ */
HRESULT WINAPI FileMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath) static HRESULT WINAPI
FileMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath)
{ {
IBindCtx *bind; IBindCtx *bind;
HRESULT res; HRESULT res;
...@@ -1219,11 +1066,10 @@ HRESULT WINAPI FileMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, ...@@ -1219,11 +1066,10 @@ HRESULT WINAPI FileMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther,
/****************************************************************************** /******************************************************************************
* FileMoniker_GetDisplayName * FileMoniker_GetDisplayName
******************************************************************************/ */
HRESULT WINAPI FileMonikerImpl_GetDisplayName(IMoniker* iface, static HRESULT WINAPI
IBindCtx* pbc, FileMonikerImpl_GetDisplayName(IMoniker* iface, IBindCtx* pbc,
IMoniker* pmkToLeft, IMoniker* pmkToLeft, LPOLESTR *ppszDisplayName)
LPOLESTR *ppszDisplayName)
{ {
FileMonikerImpl *This = (FileMonikerImpl *)iface; FileMonikerImpl *This = (FileMonikerImpl *)iface;
...@@ -1250,13 +1096,10 @@ HRESULT WINAPI FileMonikerImpl_GetDisplayName(IMoniker* iface, ...@@ -1250,13 +1096,10 @@ HRESULT WINAPI FileMonikerImpl_GetDisplayName(IMoniker* iface,
/****************************************************************************** /******************************************************************************
* FileMoniker_ParseDisplayName * FileMoniker_ParseDisplayName
******************************************************************************/ */
HRESULT WINAPI FileMonikerImpl_ParseDisplayName(IMoniker* iface, static HRESULT WINAPI
IBindCtx* pbc, FileMonikerImpl_ParseDisplayName(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft,
IMoniker* pmkToLeft, LPOLESTR pszDisplayName, ULONG* pchEaten, IMoniker** ppmkOut)
LPOLESTR pszDisplayName,
ULONG* pchEaten,
IMoniker** ppmkOut)
{ {
FIXME("(%p,%p,%p,%p,%p,%p),stub!\n",iface,pbc,pmkToLeft,pszDisplayName,pchEaten,ppmkOut); FIXME("(%p,%p,%p,%p,%p,%p),stub!\n",iface,pbc,pmkToLeft,pszDisplayName,pchEaten,ppmkOut);
return E_NOTIMPL; return E_NOTIMPL;
...@@ -1264,8 +1107,9 @@ HRESULT WINAPI FileMonikerImpl_ParseDisplayName(IMoniker* iface, ...@@ -1264,8 +1107,9 @@ HRESULT WINAPI FileMonikerImpl_ParseDisplayName(IMoniker* iface,
/****************************************************************************** /******************************************************************************
* FileMoniker_IsSystemMoniker * FileMoniker_IsSystemMoniker
******************************************************************************/ */
HRESULT WINAPI FileMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys) static HRESULT WINAPI
FileMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys)
{ {
TRACE("(%p,%p)\n",iface,pwdMksys); TRACE("(%p,%p)\n",iface,pwdMksys);
...@@ -1279,8 +1123,9 @@ HRESULT WINAPI FileMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys) ...@@ -1279,8 +1123,9 @@ HRESULT WINAPI FileMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys)
/******************************************************************************* /*******************************************************************************
* FileMonikerIROTData_QueryInterface * FileMonikerIROTData_QueryInterface
*******************************************************************************/ */
HRESULT WINAPI FileMonikerROTDataImpl_QueryInterface(IROTData *iface,REFIID riid,VOID** ppvObject) static HRESULT WINAPI
FileMonikerROTDataImpl_QueryInterface(IROTData *iface,REFIID riid,VOID** ppvObject)
{ {
ICOM_THIS_From_IROTData(IMoniker, iface); ICOM_THIS_From_IROTData(IMoniker, iface);
...@@ -1293,19 +1138,21 @@ HRESULT WINAPI FileMonikerROTDataImpl_QueryInterface(IROTData *iface,REFIID riid ...@@ -1293,19 +1138,21 @@ HRESULT WINAPI FileMonikerROTDataImpl_QueryInterface(IROTData *iface,REFIID riid
/*********************************************************************** /***********************************************************************
* FileMonikerIROTData_AddRef * FileMonikerIROTData_AddRef
*/ */
ULONG WINAPI FileMonikerROTDataImpl_AddRef(IROTData *iface) static ULONG WINAPI
FileMonikerROTDataImpl_AddRef(IROTData *iface)
{ {
ICOM_THIS_From_IROTData(IMoniker, iface); ICOM_THIS_From_IROTData(IMoniker, iface);
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
return FileMonikerImpl_AddRef(This); return IMoniker_AddRef(This);
} }
/*********************************************************************** /***********************************************************************
* FileMonikerIROTData_Release * FileMonikerIROTData_Release
*/ */
ULONG WINAPI FileMonikerROTDataImpl_Release(IROTData* iface) static ULONG WINAPI
FileMonikerROTDataImpl_Release(IROTData* iface)
{ {
ICOM_THIS_From_IROTData(IMoniker, iface); ICOM_THIS_From_IROTData(IMoniker, iface);
...@@ -1316,16 +1163,127 @@ ULONG WINAPI FileMonikerROTDataImpl_Release(IROTData* iface) ...@@ -1316,16 +1163,127 @@ ULONG WINAPI FileMonikerROTDataImpl_Release(IROTData* iface)
/****************************************************************************** /******************************************************************************
* FileMonikerIROTData_GetComparaisonData * FileMonikerIROTData_GetComparaisonData
******************************************************************************/ */
HRESULT WINAPI FileMonikerROTDataImpl_GetComparaisonData(IROTData* iface, static HRESULT WINAPI
BYTE* pbData, FileMonikerROTDataImpl_GetComparaisonData(IROTData* iface, BYTE* pbData,
ULONG cbMax, ULONG cbMax, ULONG* pcbData)
ULONG* pcbData)
{ {
FIXME("(),stub!\n"); FIXME("(),stub!\n");
return E_NOTIMPL; return E_NOTIMPL;
} }
/*
* Virtual function table for the FileMonikerImpl class which include IPersist,
* IPersistStream and IMoniker functions.
*/
static IMonikerVtbl VT_FileMonikerImpl =
{
FileMonikerImpl_QueryInterface,
FileMonikerImpl_AddRef,
FileMonikerImpl_Release,
FileMonikerImpl_GetClassID,
FileMonikerImpl_IsDirty,
FileMonikerImpl_Load,
FileMonikerImpl_Save,
FileMonikerImpl_GetSizeMax,
FileMonikerImpl_BindToObject,
FileMonikerImpl_BindToStorage,
FileMonikerImpl_Reduce,
FileMonikerImpl_ComposeWith,
FileMonikerImpl_Enum,
FileMonikerImpl_IsEqual,
FileMonikerImpl_Hash,
FileMonikerImpl_IsRunning,
FileMonikerImpl_GetTimeOfLastChange,
FileMonikerImpl_Inverse,
FileMonikerImpl_CommonPrefixWith,
FileMonikerImpl_RelativePathTo,
FileMonikerImpl_GetDisplayName,
FileMonikerImpl_ParseDisplayName,
FileMonikerImpl_IsSystemMoniker
};
/* Virtual function table for the IROTData class. */
static IROTDataVtbl VT_ROTDataImpl =
{
FileMonikerROTDataImpl_QueryInterface,
FileMonikerROTDataImpl_AddRef,
FileMonikerROTDataImpl_Release,
FileMonikerROTDataImpl_GetComparaisonData
};
/******************************************************************************
* FileMoniker_Construct (local function)
*/
static HRESULT WINAPI
FileMonikerImpl_Construct(FileMonikerImpl* This, LPCOLESTR lpszPathName)
{
int nb=0,i;
int sizeStr=lstrlenW(lpszPathName);
LPOLESTR *tabStr=0;
static const WCHAR twoPoint[]={'.','.',0};
static const WCHAR bkSlash[]={'\\',0};
BYTE addBkSlash;
TRACE("(%p,%s)\n",This,debugstr_w(lpszPathName));
/* Initialize the virtual fgunction table. */
This->lpvtbl1 = &VT_FileMonikerImpl;
This->lpvtbl2 = &VT_ROTDataImpl;
This->ref = 0;
This->filePathName=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(sizeStr+1));
if (This->filePathName==NULL)
return E_OUTOFMEMORY;
strcpyW(This->filePathName,lpszPathName);
nb=FileMonikerImpl_DecomposePath(This->filePathName,&tabStr);
if (nb > 0 ){
addBkSlash=1;
if (lstrcmpW(tabStr[0],twoPoint)!=0)
addBkSlash=0;
else
for(i=0;i<nb;i++){
if ( (lstrcmpW(tabStr[i],twoPoint)!=0) && (lstrcmpW(tabStr[i],bkSlash)!=0) ){
addBkSlash=0;
break;
}
else
if (lstrcmpW(tabStr[i],bkSlash)==0 && i<nb-1 && lstrcmpW(tabStr[i+1],bkSlash)==0){
*tabStr[i]=0;
sizeStr--;
addBkSlash=0;
break;
}
}
if (lstrcmpW(tabStr[nb-1],bkSlash)==0)
addBkSlash=0;
This->filePathName=HeapReAlloc(GetProcessHeap(),0,This->filePathName,(sizeStr+1)*sizeof(WCHAR));
*This->filePathName=0;
for(i=0;tabStr[i]!=NULL;i++)
strcatW(This->filePathName,tabStr[i]);
if (addBkSlash)
strcatW(This->filePathName,bkSlash);
}
for(i=0; tabStr[i]!=NULL;i++)
CoTaskMemFree(tabStr[i]);
CoTaskMemFree(tabStr);
return S_OK;
}
/****************************************************************************** /******************************************************************************
* CreateFileMoniker (OLE32.@) * CreateFileMoniker (OLE32.@)
******************************************************************************/ ******************************************************************************/
......
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