Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
912ffd6a
Commit
912ffd6a
authored
May 12, 2005
by
Mike McCormack
Committed by
Alexandre Julliard
May 12, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary declarations and make functions static.
parent
8a0f9898
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
240 additions
and
282 deletions
+240
-282
compobj_private.h
dlls/ole32/compobj_private.h
+1
-1
filemoniker.c
dlls/ole32/filemoniker.c
+239
-281
No files found.
dlls/ole32/compobj_private.h
View file @
912ffd6a
...
...
@@ -203,7 +203,7 @@ HRESULT WINAPI RunningObjectTableImpl_Initialize(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 */
int
WINAPI
FileMonikerImpl_DecomposePath
(
LPCOLESTR
str
,
LPOLESTR
**
stringTable
);
int
FileMonikerImpl_DecomposePath
(
LPCOLESTR
str
,
LPOLESTR
**
stringTable
);
/* Apartment Functions */
...
...
dlls/ole32/filemoniker.c
View file @
912ffd6a
/*
**************************************************************************************
*
FileMonikers implementation
/*
* FileMonikers implementation
*
*
Copyright 1999 Noomen Hamza
* Copyright 1999 Noomen Hamza
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -16,7 +16,7 @@
* 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
*
**************************************************************************************
/
*/
#include <assert.h>
#include <stdarg.h>
...
...
@@ -59,112 +59,29 @@ typedef struct 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 */
static
HRESULT
WINAPI
FileMonikerROTDataImpl_GetComparaisonData
(
IROTData
*
iface
,
BYTE
*
pbData
,
ULONG
cbMax
,
ULONG
*
pcbData
);
/* Local function used by filemoniker implementation */
HRESULT
WINAPI
FileMonikerImpl_Construct
(
FileMonikerImpl
*
iface
,
LPCOLESTR
lpszPathName
);
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
};
static
HRESULT
WINAPI
FileMonikerImpl_Construct
(
FileMonikerImpl
*
iface
,
LPCOLESTR
lpszPathName
);
static
HRESULT
WINAPI
FileMonikerImpl_Destroy
(
FileMonikerImpl
*
iface
);
/*******************************************************************************
* 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
;
TRACE
(
"(%p,%s,%p)
\n
"
,
This
,
debugstr_guid
(
riid
),
ppvObject
);
TRACE
(
"(%p,%s,%p)
\n
"
,
This
,
debugstr_guid
(
riid
),
ppvObject
);
/* Perform a sanity check on the parameters.*/
if
(
(
This
==
0
)
||
(
ppvObject
==
0
)
)
return
E_INVALIDARG
;
/* Initialize the return parameter */
*
ppvObject
=
0
;
*
ppvObject
=
0
;
/* Compare the riid with the interface IDs implemented by this object.*/
if
(
IsEqualIID
(
&
IID_IUnknown
,
riid
)
||
...
...
@@ -182,15 +99,16 @@ HRESULT WINAPI FileMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void**
return
E_NOINTERFACE
;
/* Query Interface always increases the reference count by one when it is successful */
FileMonikerImpl
_AddRef
(
iface
);
IMoniker
_AddRef
(
iface
);
return
S_OK
;
}
/******************************************************************************
* FileMoniker_AddRef
******************************************************************************/
ULONG
WINAPI
FileMonikerImpl_AddRef
(
IMoniker
*
iface
)
*/
static
ULONG
WINAPI
FileMonikerImpl_AddRef
(
IMoniker
*
iface
)
{
FileMonikerImpl
*
This
=
(
FileMonikerImpl
*
)
iface
;
...
...
@@ -201,8 +119,9 @@ ULONG WINAPI FileMonikerImpl_AddRef(IMoniker* iface)
/******************************************************************************
* FileMoniker_Release
******************************************************************************/
ULONG
WINAPI
FileMonikerImpl_Release
(
IMoniker
*
iface
)
*/
static
ULONG
WINAPI
FileMonikerImpl_Release
(
IMoniker
*
iface
)
{
FileMonikerImpl
*
This
=
(
FileMonikerImpl
*
)
iface
;
ULONG
ref
;
...
...
@@ -219,9 +138,9 @@ ULONG WINAPI FileMonikerImpl_Release(IMoniker* iface)
/******************************************************************************
* FileMoniker_GetClassID
*
*****************************************************************************
/
HRESULT
WINAPI
FileMonikerImpl_GetClassID
(
IMoniker
*
iface
,
CLSID
*
pClassID
)
/* Pointer to CLSID of object */
*/
static
HRESULT
WINAPI
FileMonikerImpl_GetClassID
(
IMoniker
*
iface
,
CLSID
*
pClassID
)
{
TRACE
(
"(%p,%p)
\n
"
,
iface
,
pClassID
);
...
...
@@ -235,12 +154,14 @@ HRESULT WINAPI FileMonikerImpl_GetClassID(IMoniker* iface,
/******************************************************************************
* 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
);
...
...
@@ -249,8 +170,12 @@ HRESULT WINAPI FileMonikerImpl_IsDirty(IMoniker* iface)
/******************************************************************************
* 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
;
CHAR
*
filePathA
;
...
...
@@ -263,8 +188,6 @@ HRESULT WINAPI FileMonikerImpl_Load(IMoniker* iface,IStream* 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 */
res
=
IStream_Read
(
pStm
,
&
wbuffer
,
sizeof
(
WORD
),
&
bread
);
if
(
bread
!=
sizeof
(
WORD
)
||
wbuffer
!=
0
)
...
...
@@ -334,30 +257,28 @@ HRESULT WINAPI FileMonikerImpl_Load(IMoniker* iface,IStream* pStm)
/******************************************************************************
* FileMoniker_Save
******************************************************************************/
HRESULT
WINAPI
FileMonikerImpl_Save
(
IMoniker
*
iface
,
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
* tested this function whith windows programs samples, I noticed that it
* was not the case. So I analysed data written by this function on
* Windows and what this did function exactly ! But I have no idea about
* its logic !
* I guessed data which must be written on stream is:
* 1) WORD constant:zero
* 2) length of the path string ("\0" included)
* 3) path string type A
* 4) DWORD constant : 0xDEADFFFF
* 5) ten WORD constant: zero
* 6) DWORD: double-length of the the path string type W ("\0" not
* included)
* 7) WORD constant: 0x3
* 8) filePath unicode string.
* if the length(filePath) > 8 or length(filePath) == 8 stop at step 5)
*/
static
HRESULT
WINAPI
FileMonikerImpl_Save
(
IMoniker
*
iface
,
IStream
*
pStm
,
BOOL
fClearDirty
)
{
/* 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
* tested this function whith windows programs samples, I noticed that it
* was not the case. So I analysed data written by this function on
* Windows and what this did function exactly ! But I have no idea about
* its logic !
* I guessed data which must be written on stream is:
* 1) WORD constant:zero
* 2) length of the path string ("\0" included)
* 3) path string type A
* 4) DWORD constant : 0xDEADFFFF
* 5) ten WORD constant: zero
* 6) DWORD: double-length of the the path string type W ("\0" not
* included)
* 7) WORD constant: 0x3
* 8) filePath unicode string.
* if the length(filePath) > 8 or length(filePath) == 8 stop at step 5)
*/
FileMonikerImpl
*
This
=
(
FileMonikerImpl
*
)
iface
;
HRESULT
res
;
...
...
@@ -426,9 +347,9 @@ HRESULT WINAPI FileMonikerImpl_Save(IMoniker* iface,
/******************************************************************************
* FileMoniker_GetSizeMax
*
*****************************************************************************
/
HRESULT
WINAPI
FileMonikerImpl_GetSizeMax
(
IMoniker
*
iface
,
ULARGE_INTEGER
*
pcbSize
)
/* Pointer to size of stream needed to save object */
*/
static
HRESULT
WINAPI
FileMonikerImpl_GetSizeMax
(
IMoniker
*
iface
,
ULARGE_INTEGER
*
pcbSize
)
{
FileMonikerImpl
*
This
=
(
FileMonikerImpl
*
)
iface
;
DWORD
len
=
lstrlenW
(
This
->
filePathName
);
...
...
@@ -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)
*******************************************************************************/
HRESULT
WINAPI
FileMonikerImpl_Destroy
(
FileMonikerImpl
*
This
)
...
...
@@ -547,12 +397,10 @@ HRESULT WINAPI FileMonikerImpl_Destroy(FileMonikerImpl* This)
/******************************************************************************
* FileMoniker_BindToObject
******************************************************************************/
HRESULT
WINAPI
FileMonikerImpl_BindToObject
(
IMoniker
*
iface
,
IBindCtx
*
pbc
,
IMoniker
*
pmkToLeft
,
REFIID
riid
,
VOID
**
ppvResult
)
*/
static
HRESULT
WINAPI
FileMonikerImpl_BindToObject
(
IMoniker
*
iface
,
IBindCtx
*
pbc
,
IMoniker
*
pmkToLeft
,
REFIID
riid
,
VOID
**
ppvResult
)
{
HRESULT
res
=
E_FAIL
;
CLSID
clsID
;
...
...
@@ -662,12 +510,10 @@ HRESULT WINAPI FileMonikerImpl_BindToObject(IMoniker* iface,
/******************************************************************************
* FileMoniker_BindToStorage
******************************************************************************/
HRESULT
WINAPI
FileMonikerImpl_BindToStorage
(
IMoniker
*
iface
,
IBindCtx
*
pbc
,
IMoniker
*
pmkToLeft
,
REFIID
riid
,
VOID
**
ppvObject
)
*/
static
HRESULT
WINAPI
FileMonikerImpl_BindToStorage
(
IMoniker
*
iface
,
IBindCtx
*
pbc
,
IMoniker
*
pmkToLeft
,
REFIID
riid
,
VOID
**
ppvObject
)
{
LPOLESTR
filePath
=
0
;
IStorage
*
pstg
=
0
;
...
...
@@ -680,7 +526,7 @@ HRESULT WINAPI FileMonikerImpl_BindToStorage(IMoniker* iface,
if
(
IsEqualIID
(
&
IID_IStorage
,
riid
)){
/* get the file name */
FileMonikerImpl
_GetDisplayName
(
iface
,
pbc
,
pmkToLeft
,
&
filePath
);
IMoniker
_GetDisplayName
(
iface
,
pbc
,
pmkToLeft
,
&
filePath
);
/* verifie if the file contains a storage object */
res
=
StgIsStorageFile
(
filePath
);
...
...
@@ -718,30 +564,28 @@ HRESULT WINAPI FileMonikerImpl_BindToStorage(IMoniker* iface,
/******************************************************************************
* FileMoniker_Reduce
******************************************************************************/
HRESULT
WINAPI
FileMonikerImpl_Reduce
(
IMoniker
*
iface
,
IBindCtx
*
pbc
,
DWORD
dwReduceHowFar
,
IMoniker
**
ppmkToLeft
,
IMoniker
**
ppmkReduced
)
static
HRESULT
WINAPI
FileMonikerImpl_Reduce
(
IMoniker
*
iface
,
IBindCtx
*
pbc
,
DWORD
dwReduceHowFar
,
IMoniker
**
ppmkToLeft
,
IMoniker
**
ppmkReduced
)
{
TRACE
(
"(%p,%p,%ld,%p,%p)
\n
"
,
iface
,
pbc
,
dwReduceHowFar
,
ppmkToLeft
,
ppmkReduced
);
if
(
ppmkReduced
==
NULL
)
return
E_POINTER
;
FileMonikerImpl
_AddRef
(
iface
);
IMoniker
_AddRef
(
iface
);
*
ppmkReduced
=
iface
;
return
MK_S_REDUCED_TO_SELF
;
}
/******************************************************************************
* FileMoniker_ComposeWith
******************************************************************************/
HRESULT
WINAPI
FileMonikerImpl_ComposeWith
(
IMoniker
*
iface
,
IMoniker
*
pmkRight
,
BOOL
fOnlyIfNotGeneric
,
IMoniker
**
ppmkComposite
)
*/
static
HRESULT
WINAPI
FileMonikerImpl_ComposeWith
(
IMoniker
*
iface
,
IMoniker
*
pmkRight
,
BOOL
fOnlyIfNotGeneric
,
IMoniker
**
ppmkComposite
)
{
HRESULT
res
;
LPOLESTR
str1
=
0
,
str2
=
0
,
*
strDec1
=
0
,
*
strDec2
=
0
,
newStr
=
0
;
...
...
@@ -768,7 +612,7 @@ HRESULT WINAPI FileMonikerImpl_ComposeWith(IMoniker* iface,
CreateBindCtx
(
0
,
&
bind
);
FileMonikerImpl
_GetDisplayName
(
iface
,
bind
,
NULL
,
&
str1
);
IMoniker
_GetDisplayName
(
iface
,
bind
,
NULL
,
&
str1
);
IMoniker_GetDisplayName
(
pmkRight
,
bind
,
NULL
,
&
str2
);
/* decompose pathnames of the two monikers : (to prepare the path merge operation ) */
...
...
@@ -838,8 +682,9 @@ HRESULT WINAPI FileMonikerImpl_ComposeWith(IMoniker* iface,
/******************************************************************************
* 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
);
...
...
@@ -853,8 +698,9 @@ HRESULT WINAPI FileMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker*
/******************************************************************************
* FileMoniker_IsEqual
******************************************************************************/
HRESULT
WINAPI
FileMonikerImpl_IsEqual
(
IMoniker
*
iface
,
IMoniker
*
pmkOtherMoniker
)
*/
static
HRESULT
WINAPI
FileMonikerImpl_IsEqual
(
IMoniker
*
iface
,
IMoniker
*
pmkOtherMoniker
)
{
FileMonikerImpl
*
This
=
(
FileMonikerImpl
*
)
iface
;
CLSID
clsid
;
...
...
@@ -886,8 +732,9 @@ HRESULT WINAPI FileMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker
/******************************************************************************
* FileMoniker_Hash
******************************************************************************/
HRESULT
WINAPI
FileMonikerImpl_Hash
(
IMoniker
*
iface
,
DWORD
*
pdwHash
)
*/
static
HRESULT
WINAPI
FileMonikerImpl_Hash
(
IMoniker
*
iface
,
DWORD
*
pdwHash
)
{
FileMonikerImpl
*
This
=
(
FileMonikerImpl
*
)
iface
;
...
...
@@ -920,11 +767,10 @@ HRESULT WINAPI FileMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash)
/******************************************************************************
* FileMoniker_IsRunning
******************************************************************************/
HRESULT
WINAPI
FileMonikerImpl_IsRunning
(
IMoniker
*
iface
,
IBindCtx
*
pbc
,
IMoniker
*
pmkToLeft
,
IMoniker
*
pmkNewlyRunning
)
*/
static
HRESULT
WINAPI
FileMonikerImpl_IsRunning
(
IMoniker
*
iface
,
IBindCtx
*
pbc
,
IMoniker
*
pmkToLeft
,
IMoniker
*
pmkNewlyRunning
)
{
IRunningObjectTable
*
rot
;
HRESULT
res
;
...
...
@@ -952,10 +798,9 @@ HRESULT WINAPI FileMonikerImpl_IsRunning(IMoniker* iface,
/******************************************************************************
* FileMoniker_GetTimeOfLastChange
******************************************************************************/
HRESULT
WINAPI
FileMonikerImpl_GetTimeOfLastChange
(
IMoniker
*
iface
,
IBindCtx
*
pbc
,
IMoniker
*
pmkToLeft
,
FILETIME
*
pFileTime
)
static
HRESULT
WINAPI
FileMonikerImpl_GetTimeOfLastChange
(
IMoniker
*
iface
,
IBindCtx
*
pbc
,
IMoniker
*
pmkToLeft
,
FILETIME
*
pFileTime
)
{
FileMonikerImpl
*
This
=
(
FileMonikerImpl
*
)
iface
;
IRunningObjectTable
*
rot
;
...
...
@@ -990,10 +835,10 @@ HRESULT WINAPI FileMonikerImpl_GetTimeOfLastChange(IMoniker* iface,
/******************************************************************************
* 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
);
return
CreateAntiMoniker
(
ppmk
);
...
...
@@ -1001,8 +846,9 @@ HRESULT WINAPI FileMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk)
/******************************************************************************
* 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
;
...
...
@@ -1089,8 +935,8 @@ HRESULT WINAPI FileMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOth
/******************************************************************************
* DecomposePath (local function)
*
*****************************************************************************
/
int
WINAPI
FileMonikerImpl_DecomposePath
(
LPCOLESTR
str
,
LPOLESTR
**
stringTable
)
*/
int
FileMonikerImpl_DecomposePath
(
LPCOLESTR
str
,
LPOLESTR
**
stringTable
)
{
static
const
WCHAR
bSlash
[]
=
{
'\\'
,
0
};
WCHAR
word
[
MAX_PATH
];
...
...
@@ -1144,8 +990,9 @@ int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable)
/******************************************************************************
* 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
;
HRESULT
res
;
...
...
@@ -1219,11 +1066,10 @@ HRESULT WINAPI FileMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther,
/******************************************************************************
* FileMoniker_GetDisplayName
******************************************************************************/
HRESULT
WINAPI
FileMonikerImpl_GetDisplayName
(
IMoniker
*
iface
,
IBindCtx
*
pbc
,
IMoniker
*
pmkToLeft
,
LPOLESTR
*
ppszDisplayName
)
*/
static
HRESULT
WINAPI
FileMonikerImpl_GetDisplayName
(
IMoniker
*
iface
,
IBindCtx
*
pbc
,
IMoniker
*
pmkToLeft
,
LPOLESTR
*
ppszDisplayName
)
{
FileMonikerImpl
*
This
=
(
FileMonikerImpl
*
)
iface
;
...
...
@@ -1250,13 +1096,10 @@ HRESULT WINAPI FileMonikerImpl_GetDisplayName(IMoniker* iface,
/******************************************************************************
* FileMoniker_ParseDisplayName
******************************************************************************/
HRESULT
WINAPI
FileMonikerImpl_ParseDisplayName
(
IMoniker
*
iface
,
IBindCtx
*
pbc
,
IMoniker
*
pmkToLeft
,
LPOLESTR
pszDisplayName
,
ULONG
*
pchEaten
,
IMoniker
**
ppmkOut
)
*/
static
HRESULT
WINAPI
FileMonikerImpl_ParseDisplayName
(
IMoniker
*
iface
,
IBindCtx
*
pbc
,
IMoniker
*
pmkToLeft
,
LPOLESTR
pszDisplayName
,
ULONG
*
pchEaten
,
IMoniker
**
ppmkOut
)
{
FIXME
(
"(%p,%p,%p,%p,%p,%p),stub!
\n
"
,
iface
,
pbc
,
pmkToLeft
,
pszDisplayName
,
pchEaten
,
ppmkOut
);
return
E_NOTIMPL
;
...
...
@@ -1264,8 +1107,9 @@ HRESULT WINAPI FileMonikerImpl_ParseDisplayName(IMoniker* iface,
/******************************************************************************
* 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
);
...
...
@@ -1279,8 +1123,9 @@ HRESULT WINAPI FileMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys)
/*******************************************************************************
* 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
);
...
...
@@ -1293,19 +1138,21 @@ HRESULT WINAPI FileMonikerROTDataImpl_QueryInterface(IROTData *iface,REFIID riid
/***********************************************************************
* FileMonikerIROTData_AddRef
*/
ULONG
WINAPI
FileMonikerROTDataImpl_AddRef
(
IROTData
*
iface
)
static
ULONG
WINAPI
FileMonikerROTDataImpl_AddRef
(
IROTData
*
iface
)
{
ICOM_THIS_From_IROTData
(
IMoniker
,
iface
);
TRACE
(
"(%p)
\n
"
,
This
);
return
FileMonikerImpl
_AddRef
(
This
);
return
IMoniker
_AddRef
(
This
);
}
/***********************************************************************
* FileMonikerIROTData_Release
*/
ULONG
WINAPI
FileMonikerROTDataImpl_Release
(
IROTData
*
iface
)
static
ULONG
WINAPI
FileMonikerROTDataImpl_Release
(
IROTData
*
iface
)
{
ICOM_THIS_From_IROTData
(
IMoniker
,
iface
);
...
...
@@ -1316,16 +1163,127 @@ ULONG WINAPI FileMonikerROTDataImpl_Release(IROTData* iface)
/******************************************************************************
* FileMonikerIROTData_GetComparaisonData
******************************************************************************/
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
)
{
FIXME
(
"(),stub!
\n
"
);
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.@)
******************************************************************************/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment