Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
f0b0c7f4
Commit
f0b0c7f4
authored
Jun 06, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Jun 15, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpcrt4: Don't use GetProcAddress for ole32 functions.
It's more elegant to put ole32 in the DELAYIMPORTS.
parent
8e3f316c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
50 deletions
+14
-50
Makefile.in
dlls/rpcrt4/Makefile.in
+1
-1
ndr_ole.c
dlls/rpcrt4/ndr_ole.c
+13
-49
No files found.
dlls/rpcrt4/Makefile.in
View file @
f0b0c7f4
...
...
@@ -2,7 +2,7 @@ EXTRADEFS = -D_RPCRT4_ -DMSWMSG
MODULE
=
rpcrt4.dll
IMPORTLIB
=
rpcrt4
IMPORTS
=
uuid advapi32
DELAYIMPORTS
=
iphlpapi wininet secur32 user32 ws2_32 oleaut32
DELAYIMPORTS
=
iphlpapi wininet secur32 user32 ws2_32 ole
32 ole
aut32
ndr_types_EXTRAIDLFLAGS
=
-Oicf
...
...
dlls/rpcrt4/ndr_ole.c
View file @
f0b0c7f4
...
...
@@ -44,33 +44,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
ole
);
static
HMODULE
hOLE
;
static
HRESULT
(
WINAPI
*
COM_GetMarshalSizeMax
)(
ULONG
*
,
REFIID
,
LPUNKNOWN
,
DWORD
,
LPVOID
,
DWORD
);
static
HRESULT
(
WINAPI
*
COM_MarshalInterface
)(
LPSTREAM
,
REFIID
,
LPUNKNOWN
,
DWORD
,
LPVOID
,
DWORD
);
static
HRESULT
(
WINAPI
*
COM_UnmarshalInterface
)(
LPSTREAM
,
REFIID
,
LPVOID
*
);
static
HRESULT
(
WINAPI
*
COM_ReleaseMarshalData
)(
LPSTREAM
);
static
HRESULT
(
WINAPI
*
COM_GetClassObject
)(
REFCLSID
,
DWORD
,
COSERVERINFO
*
,
REFIID
,
LPVOID
*
);
static
HRESULT
(
WINAPI
*
COM_GetPSClsid
)(
REFIID
,
CLSID
*
);
static
LPVOID
(
WINAPI
*
COM_MemAlloc
)(
ULONG
);
static
void
(
WINAPI
*
COM_MemFree
)(
LPVOID
);
static
HMODULE
LoadCOM
(
void
)
{
if
(
hOLE
)
return
hOLE
;
hOLE
=
LoadLibraryA
(
"OLE32.DLL"
);
if
(
!
hOLE
)
return
0
;
COM_GetMarshalSizeMax
=
(
LPVOID
)
GetProcAddress
(
hOLE
,
"CoGetMarshalSizeMax"
);
COM_MarshalInterface
=
(
LPVOID
)
GetProcAddress
(
hOLE
,
"CoMarshalInterface"
);
COM_UnmarshalInterface
=
(
LPVOID
)
GetProcAddress
(
hOLE
,
"CoUnmarshalInterface"
);
COM_ReleaseMarshalData
=
(
LPVOID
)
GetProcAddress
(
hOLE
,
"CoReleaseMarshalData"
);
COM_GetClassObject
=
(
LPVOID
)
GetProcAddress
(
hOLE
,
"CoGetClassObject"
);
COM_GetPSClsid
=
(
LPVOID
)
GetProcAddress
(
hOLE
,
"CoGetPSClsid"
);
COM_MemAlloc
=
(
LPVOID
)
GetProcAddress
(
hOLE
,
"CoTaskMemAlloc"
);
COM_MemFree
=
(
LPVOID
)
GetProcAddress
(
hOLE
,
"CoTaskMemFree"
);
return
hOLE
;
}
/* CoMarshalInterface/CoUnmarshalInterface works on streams,
* so implement a simple stream on top of the RPC buffer
* (which also implements the MInterfacePointer structure) */
...
...
@@ -313,14 +286,13 @@ unsigned char * WINAPI NdrInterfacePointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
TRACE
(
"(%p,%p,%p)
\n
"
,
pStubMsg
,
pMemory
,
pFormat
);
pStubMsg
->
MaxCount
=
0
;
if
(
!
LoadCOM
())
return
NULL
;
if
(
pStubMsg
->
Buffer
+
sizeof
(
DWORD
)
<=
(
unsigned
char
*
)
pStubMsg
->
RpcMsg
->
Buffer
+
pStubMsg
->
BufferLength
)
{
hr
=
RpcStream_Create
(
pStubMsg
,
TRUE
,
NULL
,
&
stream
);
if
(
hr
==
S_OK
)
{
if
(
pMemory
)
hr
=
C
OM_MarshalInterface
(
stream
,
riid
,
(
LPUNKNOWN
)
pMemory
,
pStubMsg
->
dwDestContext
,
pStubMsg
->
pvDestContext
,
MSHLFLAGS_NORMAL
);
hr
=
C
oMarshalInterface
(
stream
,
riid
,
(
IUnknown
*
)
pMemory
,
pStubMsg
->
dwDestContext
,
pStubMsg
->
pvDestContext
,
MSHLFLAGS_NORMAL
);
IStream_Release
(
stream
);
}
...
...
@@ -343,7 +315,6 @@ unsigned char * WINAPI NdrInterfacePointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg
HRESULT
hr
;
TRACE
(
"(%p,%p,%p,%d)
\n
"
,
pStubMsg
,
ppMemory
,
pFormat
,
fMustAlloc
);
if
(
!
LoadCOM
())
return
NULL
;
/* Avoid reference leaks for [in, out] pointers. */
if
(
pStubMsg
->
IsClient
&&
*
unk
)
...
...
@@ -356,7 +327,7 @@ unsigned char * WINAPI NdrInterfacePointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg
hr
=
RpcStream_Create
(
pStubMsg
,
FALSE
,
&
size
,
&
stream
);
if
(
hr
==
S_OK
)
{
if
(
size
!=
0
)
hr
=
C
OM_
UnmarshalInterface
(
stream
,
&
IID_NULL
,
(
void
**
)
unk
);
hr
=
C
o
UnmarshalInterface
(
stream
,
&
IID_NULL
,
(
void
**
)
unk
);
IStream_Release
(
stream
);
}
...
...
@@ -378,10 +349,9 @@ void WINAPI NdrInterfacePointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
ULONG
size
=
0
;
TRACE
(
"(%p,%p,%p)
\n
"
,
pStubMsg
,
pMemory
,
pFormat
);
if
(
!
LoadCOM
())
return
;
COM_GetMarshalSizeMax
(
&
size
,
riid
,
(
LPUNKNOWN
)
pMemory
,
pStubMsg
->
dwDestContext
,
pStubMsg
->
pvDestContext
,
MSHLFLAGS_NORMAL
);
CoGetMarshalSizeMax
(
&
size
,
riid
,
(
IUnknown
*
)
pMemory
,
pStubMsg
->
dwDestContext
,
pStubMsg
->
pvDestContext
,
MSHLFLAGS_NORMAL
);
TRACE
(
"size=%ld
\n
"
,
size
);
pStubMsg
->
BufferLength
+=
sizeof
(
DWORD
)
+
size
;
}
...
...
@@ -422,8 +392,7 @@ void WINAPI NdrInterfacePointerFree(PMIDL_STUB_MESSAGE pStubMsg,
*/
void
*
WINAPI
NdrOleAllocate
(
SIZE_T
Size
)
{
if
(
!
LoadCOM
())
return
NULL
;
return
COM_MemAlloc
(
Size
);
return
CoTaskMemAlloc
(
Size
);
}
/***********************************************************************
...
...
@@ -431,8 +400,7 @@ void * WINAPI NdrOleAllocate(SIZE_T Size)
*/
void
WINAPI
NdrOleFree
(
void
*
NodeToFree
)
{
if
(
!
LoadCOM
())
return
;
COM_MemFree
(
NodeToFree
);
CoTaskMemFree
(
NodeToFree
);
}
/***********************************************************************
...
...
@@ -445,12 +413,10 @@ HRESULT create_proxy(REFIID iid, IUnknown *pUnkOuter, IRpcProxyBuffer **pproxy,
IPSFactoryBuffer
*
psfac
;
HRESULT
r
;
if
(
!
LoadCOM
())
return
E_FAIL
;
r
=
COM_GetPSClsid
(
iid
,
&
clsid
);
r
=
CoGetPSClsid
(
iid
,
&
clsid
);
if
(
FAILED
(
r
))
return
r
;
r
=
C
OM_GetClassObject
(
&
clsid
,
CLSCTX_INPROC_SERVER
,
NULL
,
&
IID_IPSFactoryBuffer
,
(
void
**
)
&
psfac
);
r
=
C
oGetClassObject
(
&
clsid
,
CLSCTX_INPROC_SERVER
,
NULL
,
&
IID_IPSFactoryBuffer
,
(
void
**
)
&
psfac
);
if
(
FAILED
(
r
))
return
r
;
r
=
IPSFactoryBuffer_CreateProxy
(
psfac
,
pUnkOuter
,
iid
,
pproxy
,
ppv
);
...
...
@@ -469,12 +435,10 @@ HRESULT create_stub(REFIID iid, IUnknown *pUnk, IRpcStubBuffer **ppstub)
IPSFactoryBuffer
*
psfac
;
HRESULT
r
;
if
(
!
LoadCOM
())
return
E_FAIL
;
r
=
COM_GetPSClsid
(
iid
,
&
clsid
);
r
=
CoGetPSClsid
(
iid
,
&
clsid
);
if
(
FAILED
(
r
))
return
r
;
r
=
C
OM_GetClassObject
(
&
clsid
,
CLSCTX_INPROC_SERVER
,
NULL
,
&
IID_IPSFactoryBuffer
,
(
void
**
)
&
psfac
);
r
=
C
oGetClassObject
(
&
clsid
,
CLSCTX_INPROC_SERVER
,
NULL
,
&
IID_IPSFactoryBuffer
,
(
void
**
)
&
psfac
);
if
(
FAILED
(
r
))
return
r
;
r
=
IPSFactoryBuffer_CreateStub
(
psfac
,
iid
,
pUnk
,
ppstub
);
...
...
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