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
2514c014
Commit
2514c014
authored
Mar 26, 2007
by
Rob Shearman
Committed by
Alexandre Julliard
Mar 27, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Move GetClassFile to moniker.c and move OleRun to ole2.c.
parent
8e014524
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
173 additions
and
173 deletions
+173
-173
compobj.c
dlls/ole32/compobj.c
+0
-102
moniker.c
dlls/ole32/moniker.c
+145
-71
ole2.c
dlls/ole32/ole2.c
+28
-0
No files found.
dlls/ole32/compobj.c
View file @
2514c014
...
@@ -2001,108 +2001,6 @@ HRESULT WINAPI CoResumeClassObjects(void)
...
@@ -2001,108 +2001,6 @@ HRESULT WINAPI CoResumeClassObjects(void)
}
}
/***********************************************************************
/***********************************************************************
* GetClassFile (OLE32.@)
*
* Retrieves the class ID associated with the given filename.
*
* PARAMS
* filePathName [I] Filename to retrieve the class ID for.
* pclsid [O] Address that receives the class ID for the file.
*
* RETURNS
* Success: S_OK.
* Failure: Any HRESULT code.
*/
HRESULT
WINAPI
GetClassFile
(
LPCOLESTR
filePathName
,
CLSID
*
pclsid
)
{
IStorage
*
pstg
=
0
;
HRESULT
res
;
int
nbElm
,
length
,
i
;
LONG
sizeProgId
;
LPOLESTR
*
pathDec
=
0
,
absFile
=
0
,
progId
=
0
;
LPWSTR
extension
;
static
const
WCHAR
bkslashW
[]
=
{
'\\'
,
0
};
static
const
WCHAR
dotW
[]
=
{
'.'
,
0
};
TRACE
(
"%s, %p
\n
"
,
debugstr_w
(
filePathName
),
pclsid
);
/* if the file contain a storage object the return the CLSID written 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,&r,NULL);
if (memcmp(buf&pat.mask,pat.pattern.pat.size)==0){
*pclsid=ReadCLSIDFromRegistry(i);
return S_OK;
}
}
*/
/* if the above 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
,
bkslashW
))
return
MK_E_INVALIDEXTENSION
;
/* get the extension of the file */
extension
=
NULL
;
length
=
lstrlenW
(
absFile
);
for
(
i
=
length
-
1
;
(
i
>=
0
)
&&
*
(
extension
=
&
absFile
[
i
])
!=
'.'
;
i
--
)
/* nothing */
;
if
(
!
extension
||
!
lstrcmpW
(
extension
,
dotW
))
return
MK_E_INVALIDEXTENSION
;
res
=
RegQueryValueW
(
HKEY_CLASSES_ROOT
,
extension
,
NULL
,
&
sizeProgId
);
/* get the progId associated to the extension */
progId
=
CoTaskMemAlloc
(
sizeProgId
);
res
=
RegQueryValueW
(
HKEY_CLASSES_ROOT
,
extension
,
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
;
}
/***********************************************************************
* CoCreateInstance [OLE32.@]
* CoCreateInstance [OLE32.@]
*
*
* Creates an instance of the specified class.
* Creates an instance of the specified class.
...
...
dlls/ole32/moniker.c
View file @
2514c014
...
@@ -734,6 +734,66 @@ RunningObjectTableImpl_EnumRunning(IRunningObjectTable* iface,
...
@@ -734,6 +734,66 @@ RunningObjectTableImpl_EnumRunning(IRunningObjectTable* iface,
return
hr
;
return
hr
;
}
}
/* Virtual function table for the IRunningObjectTable class. */
static
const
IRunningObjectTableVtbl
VT_RunningObjectTableImpl
=
{
RunningObjectTableImpl_QueryInterface
,
RunningObjectTableImpl_AddRef
,
RunningObjectTableImpl_Release
,
RunningObjectTableImpl_Register
,
RunningObjectTableImpl_Revoke
,
RunningObjectTableImpl_IsRunning
,
RunningObjectTableImpl_GetObject
,
RunningObjectTableImpl_NoteChangeTime
,
RunningObjectTableImpl_GetTimeOfLastChange
,
RunningObjectTableImpl_EnumRunning
};
/***********************************************************************
* RunningObjectTable_Initialize
*/
HRESULT
WINAPI
RunningObjectTableImpl_Initialize
(
void
)
{
TRACE
(
"
\n
"
);
/* create the unique instance of the RunningObjectTableImpl structure */
runningObjectTableInstance
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
RunningObjectTableImpl
));
if
(
!
runningObjectTableInstance
)
return
E_OUTOFMEMORY
;
/* initialize the virtual table function */
runningObjectTableInstance
->
lpVtbl
=
&
VT_RunningObjectTableImpl
;
/* the initial reference is set to "1" ! because if set to "0" it will be not practis when */
/* the ROT referred many times not in the same time (all the objects in the ROT will */
/* be removed every time the ROT is removed ) */
runningObjectTableInstance
->
ref
=
1
;
list_init
(
&
runningObjectTableInstance
->
rot
);
InitializeCriticalSection
(
&
runningObjectTableInstance
->
lock
);
DEBUG_SET_CRITSEC_NAME
(
&
runningObjectTableInstance
->
lock
,
"RunningObjectTableImpl.lock"
);
return
S_OK
;
}
/***********************************************************************
* RunningObjectTable_UnInitialize
*/
HRESULT
WINAPI
RunningObjectTableImpl_UnInitialize
(
void
)
{
TRACE
(
"
\n
"
);
if
(
runningObjectTableInstance
==
NULL
)
return
E_POINTER
;
RunningObjectTableImpl_Release
((
IRunningObjectTable
*
)
runningObjectTableInstance
);
RunningObjectTableImpl_Destroy
();
return
S_OK
;
}
/***********************************************************************
/***********************************************************************
* GetRunningObjectTable (OLE32.@)
* GetRunningObjectTable (OLE32.@)
*
*
...
@@ -767,105 +827,119 @@ GetRunningObjectTable(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot)
...
@@ -767,105 +827,119 @@ GetRunningObjectTable(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot)
}
}
/******************************************************************************
/******************************************************************************
* OleRun [OLE32.@]
* MkParseDisplayName [OLE32.@]
*/
HRESULT
WINAPI
MkParseDisplayName
(
LPBC
pbc
,
LPCOLESTR
szUserName
,
LPDWORD
pchEaten
,
LPMONIKER
*
ppmk
)
{
FIXME
(
"(%p, %s, %p, %p): stub.
\n
"
,
pbc
,
debugstr_w
(
szUserName
),
pchEaten
,
*
ppmk
);
if
(
!
(
IsValidInterface
((
LPUNKNOWN
)
pbc
)))
return
E_INVALIDARG
;
return
MK_E_SYNTAX
;
}
/***********************************************************************
* GetClassFile (OLE32.@)
*
*
*
Set the OLE object to the running stat
e.
*
Retrieves the class ID associated with the given filenam
e.
*
*
* PARAMS
* PARAMS
* pUnknown [I] OLE object to run.
* filePathName [I] Filename to retrieve the class ID for.
* pclsid [O] Address that receives the class ID for the file.
*
*
* RETURNS
* RETURNS
* Success: S_OK.
* Success: S_OK.
* Failure: Any HRESULT code.
* Failure: Any HRESULT code.
*/
*/
HRESULT
WINAPI
OleRun
(
LPUNKNOWN
pUnknown
)
HRESULT
WINAPI
GetClassFile
(
LPCOLESTR
filePathName
,
CLSID
*
pclsid
)
{
{
IRunnableObject
*
runable
;
IStorage
*
pstg
=
0
;
HRESULT
hres
;
HRESULT
res
;
int
nbElm
,
length
,
i
;
LONG
sizeProgId
;
LPOLESTR
*
pathDec
=
0
,
absFile
=
0
,
progId
=
0
;
LPWSTR
extension
;
static
const
WCHAR
bkslashW
[]
=
{
'\\'
,
0
};
static
const
WCHAR
dotW
[]
=
{
'.'
,
0
};
TRACE
(
"
(%p)
\n
"
,
pUnknown
);
TRACE
(
"
%s, %p
\n
"
,
debugstr_w
(
filePathName
),
pclsid
);
hres
=
IUnknown_QueryInterface
(
pUnknown
,
&
IID_IRunnableObject
,
(
void
**
)
&
runable
);
/* if the file contain a storage object the return the CLSID written by IStorage_SetClass method*/
if
(
FAILED
(
hres
))
if
((
StgIsStorageFile
(
filePathName
))
==
S_OK
){
return
S_OK
;
/* Appears to return no error. */
hres
=
IRunnableObject_Run
(
runable
,
NULL
);
res
=
StgOpenStorage
(
filePathName
,
NULL
,
STGM_READ
|
STGM_SHARE_DENY_WRITE
,
NULL
,
0
,
&
pstg
);
IRunnableObject_Release
(
runable
);
return
hres
;
}
/******************************************************************************
if
(
SUCCEEDED
(
res
))
* MkParseDisplayName [OLE32.@]
res
=
ReadClassStg
(
pstg
,
pclsid
);
*/
HRESULT
WINAPI
MkParseDisplayName
(
LPBC
pbc
,
LPCOLESTR
szUserName
,
LPDWORD
pchEaten
,
LPMONIKER
*
ppmk
)
{
FIXME
(
"(%p, %s, %p, %p): stub.
\n
"
,
pbc
,
debugstr_w
(
szUserName
),
pchEaten
,
*
ppmk
);
if
(
!
(
IsValidInterface
((
LPUNKNOWN
)
pbc
)))
IStorage_Release
(
pstg
);
return
E_INVALIDARG
;
return
MK_E_SYNTAX
;
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
/* Virtual function table for the IRunningObjectTable class. */
for(i=0;i<nFileTypes;i++)
static
const
IRunningObjectTableVtbl
VT_RunningObjectTableImpl
=
{
RunningObjectTableImpl_QueryInterface
,
RunningObjectTableImpl_AddRef
,
RunningObjectTableImpl_Release
,
RunningObjectTableImpl_Register
,
RunningObjectTableImpl_Revoke
,
RunningObjectTableImpl_IsRunning
,
RunningObjectTableImpl_GetObject
,
RunningObjectTableImpl_NoteChangeTime
,
RunningObjectTableImpl_GetTimeOfLastChange
,
RunningObjectTableImpl_EnumRunning
};
/***********************************************************************
for(i=0;j<nPatternsForType;j++){
* RunningObjectTable_Initialize
*/
HRESULT
WINAPI
RunningObjectTableImpl_Initialize
(
void
)
{
TRACE
(
"
\n
"
);
/* create the unique instance of the RunningObjectTableImpl structure */
PATTERN pat;
runningObjectTableInstance
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
RunningObjectTableImpl
))
;
HANDLE hFile
;
if
(
!
runningObjectTableInstance
)
pat=ReadPatternFromRegistry(i,j);
return
E_OUTOFMEMORY
;
hFile=CreateFileW(filePathName,,,,,,hFile);
SetFilePosition(hFile,pat.offset);
ReadFile(hFile,buf,pat.size,&r,NULL);
if (memcmp(buf&pat.mask,pat.pattern.pat.size)==0){
/* initialize the virtual table function */
*pclsid=ReadCLSIDFromRegistry(i);
runningObjectTableInstance
->
lpVtbl
=
&
VT_RunningObjectTableImpl
;
return S_OK;
}
}
*/
/* the initial reference is set to "1" ! because if set to "0" it will be not practis when */
/* if the above strategies fail then search for the extension key in the registry */
/* the ROT referred many times not in the same time (all the objects in the ROT will */
/* be removed every time the ROT is removed ) */
runningObjectTableInstance
->
ref
=
1
;
list_init
(
&
runningObjectTableInstance
->
rot
);
/* get the last element (absolute file) in the path name */
InitializeCriticalSection
(
&
runningObjectTableInstance
->
lock
);
nbElm
=
FileMonikerImpl_DecomposePath
(
filePathName
,
&
pathDec
);
DEBUG_SET_CRITSEC_NAME
(
&
runningObjectTableInstance
->
lock
,
"RunningObjectTableImpl.lock"
)
;
absFile
=
pathDec
[
nbElm
-
1
]
;
return
S_OK
;
/* failed if the path represente a directory and not an absolute file name*/
}
if
(
!
lstrcmpW
(
absFile
,
bkslashW
))
return
MK_E_INVALIDEXTENSION
;
/***********************************************************************
/* get the extension of the file */
* RunningObjectTable_UnInitialize
extension
=
NULL
;
*/
length
=
lstrlenW
(
absFile
);
HRESULT
WINAPI
RunningObjectTableImpl_UnInitialize
(
void
)
for
(
i
=
length
-
1
;
(
i
>=
0
)
&&
*
(
extension
=
&
absFile
[
i
])
!=
'.'
;
i
--
)
{
/* nothing */
;
TRACE
(
"
\n
"
);
if
(
runningObjectTableInstance
==
NULL
)
if
(
!
extension
||
!
lstrcmpW
(
extension
,
dotW
)
)
return
E_POINTER
;
return
MK_E_INVALIDEXTENSION
;
RunningObjectTableImpl_Release
((
IRunningObjectTable
*
)
runningObjectTableInstance
);
res
=
RegQueryValueW
(
HKEY_CLASSES_ROOT
,
extension
,
NULL
,
&
sizeProgId
);
RunningObjectTableImpl_Destroy
();
/* get the progId associated to the extension */
progId
=
CoTaskMemAlloc
(
sizeProgId
);
res
=
RegQueryValueW
(
HKEY_CLASSES_ROOT
,
extension
,
progId
,
&
sizeProgId
);
return
S_OK
;
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
;
}
}
/***********************************************************************
/***********************************************************************
...
...
dlls/ole32/ole2.c
View file @
2514c014
...
@@ -934,6 +934,34 @@ HRESULT WINAPI OleSetContainedObject(
...
@@ -934,6 +934,34 @@ HRESULT WINAPI OleSetContainedObject(
}
}
/******************************************************************************
/******************************************************************************
* OleRun [OLE32.@]
*
* Set the OLE object to the running state.
*
* PARAMS
* pUnknown [I] OLE object to run.
*
* RETURNS
* Success: S_OK.
* Failure: Any HRESULT code.
*/
HRESULT
WINAPI
OleRun
(
LPUNKNOWN
pUnknown
)
{
IRunnableObject
*
runable
;
HRESULT
hres
;
TRACE
(
"(%p)
\n
"
,
pUnknown
);
hres
=
IUnknown_QueryInterface
(
pUnknown
,
&
IID_IRunnableObject
,
(
void
**
)
&
runable
);
if
(
FAILED
(
hres
))
return
S_OK
;
/* Appears to return no error. */
hres
=
IRunnableObject_Run
(
runable
,
NULL
);
IRunnableObject_Release
(
runable
);
return
hres
;
}
/******************************************************************************
* OleLoad [OLE32.@]
* OleLoad [OLE32.@]
*/
*/
HRESULT
WINAPI
OleLoad
(
HRESULT
WINAPI
OleLoad
(
...
...
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