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
d1d89a64
Commit
d1d89a64
authored
Feb 27, 2004
by
Robert Shearman
Committed by
Alexandre Julliard
Feb 27, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Fix a bad use of HeapRealloc.
- Fix error return codes. - Improve traces.
parent
766fc7cc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
27 deletions
+45
-27
rpc_binding.c
dlls/rpcrt4/rpc_binding.c
+12
-9
rpc_message.c
dlls/rpcrt4/rpc_message.c
+31
-17
rpc_server.c
dlls/rpcrt4/rpc_server.c
+2
-1
No files found.
dlls/rpcrt4/rpc_binding.c
View file @
d1d89a64
...
...
@@ -212,12 +212,12 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection)
memset
(
&
Connection
->
ovl
,
0
,
sizeof
(
Connection
->
ovl
));
Connection
->
ovl
.
hEvent
=
CreateEventA
(
NULL
,
TRUE
,
FALSE
,
NULL
);
if
(
!
ConnectNamedPipe
(
Connection
->
conn
,
&
Connection
->
ovl
))
{
DWORD
err
=
GetLastError
(
);
if
(
err
==
ERROR_PIPE_CONNECTED
)
{
WARN
(
"Couldn't ConnectNamedPipe (error was %ld)
\n
"
,
GetLastError
()
);
if
(
GetLastError
()
==
ERROR_PIPE_CONNECTED
)
{
SetEvent
(
Connection
->
ovl
.
hEvent
);
return
RPC_S_OK
;
}
return
err
;
return
RPC_S_SERVER_UNAVAILABLE
;
}
}
/* protseq=ncacn_np: named pipes */
...
...
@@ -233,12 +233,12 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection)
memset
(
&
Connection
->
ovl
,
0
,
sizeof
(
Connection
->
ovl
));
Connection
->
ovl
.
hEvent
=
CreateEventA
(
NULL
,
TRUE
,
FALSE
,
NULL
);
if
(
!
ConnectNamedPipe
(
Connection
->
conn
,
&
Connection
->
ovl
))
{
DWORD
err
=
GetLastError
(
);
if
(
err
==
ERROR_PIPE_CONNECTED
)
{
WARN
(
"Couldn't ConnectNamedPipe (error was %ld)
\n
"
,
GetLastError
()
);
if
(
GetLastError
()
==
ERROR_PIPE_CONNECTED
)
{
SetEvent
(
Connection
->
ovl
.
hEvent
);
return
RPC_S_OK
;
}
return
err
;
return
RPC_S_SERVER_UNAVAILABLE
;
}
}
else
{
...
...
@@ -267,12 +267,12 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection)
if
(
err
==
ERROR_PIPE_BUSY
)
continue
;
TRACE
(
"connection failed, error=%lx
\n
"
,
err
);
HeapFree
(
GetProcessHeap
(),
0
,
pname
);
return
err
;
return
RPC_S_SERVER_TOO_BUSY
;
}
else
{
err
=
GetLastError
();
TRACE
(
"connection failed, error=%lx
\n
"
,
err
);
HeapFree
(
GetProcessHeap
(),
0
,
pname
);
return
err
;
return
RPC_S_SERVER_UNAVAILABLE
;
}
}
...
...
@@ -300,7 +300,10 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection)
* the doc says that it is returned to the app */
TRACE
(
"connection failed, error=%lx
\n
"
,
err
);
HeapFree
(
GetProcessHeap
(),
0
,
pname
);
return
err
;
if
(
err
==
ERROR_PIPE_BUSY
)
return
RPC_S_SERVER_TOO_BUSY
;
else
return
RPC_S_SERVER_UNAVAILABLE
;
}
/* success */
...
...
dlls/rpcrt4/rpc_message.c
View file @
d1d89a64
...
...
@@ -49,7 +49,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
RPC_STATUS
WINAPI
I_RpcGetBuffer
(
PRPC_MESSAGE
pMsg
)
{
RpcBinding
*
bind
=
(
RpcBinding
*
)
pMsg
->
Handle
;
void
*
buf
;
TRACE
(
"(%p): BufferLength=%d
\n
"
,
pMsg
,
pMsg
->
BufferLength
);
/* FIXME: pfnAllocate? */
...
...
@@ -57,14 +56,15 @@ RPC_STATUS WINAPI I_RpcGetBuffer(PRPC_MESSAGE pMsg)
/* it turns out that the original buffer data must still be available
* while the RPC server is marshalling a reply, so we should not deallocate
* it, we'll leave deallocating the original buffer to the RPC server */
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
pMsg
->
BufferLength
);
pMsg
->
Buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
pMsg
->
BufferLength
);
}
else
{
buf
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
pMsg
->
Buffer
,
pMsg
->
BufferLength
);
if
(
pMsg
->
Buffer
)
HeapFree
(
GetProcessHeap
(),
0
,
pMsg
->
Buffer
);
pMsg
->
Buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
pMsg
->
BufferLength
);
}
TRACE
(
"Buffer=%p
\n
"
,
buf
);
if
(
buf
)
pMsg
->
Buffer
=
buf
;
TRACE
(
"Buffer=%p
\n
"
,
pMsg
->
Buffer
);
/* FIXME: which errors to return? */
return
buf
?
S_OK
:
E_OUTOFMEMORY
;
return
pMsg
->
Buffer
?
S_OK
:
E_OUTOFMEMORY
;
}
/***********************************************************************
...
...
@@ -132,11 +132,20 @@ RPC_STATUS WINAPI I_RpcSend(PRPC_MESSAGE pMsg)
/* transmit packet */
if
(
!
WriteFile
(
conn
->
conn
,
&
hdr
,
sizeof
(
hdr
),
NULL
,
NULL
))
{
status
=
GetLastError
();
WARN
(
"WriteFile failed with error %ld
\n
"
,
GetLastError
());
status
=
RPC_S_PROTOCOL_ERROR
;
goto
fail
;
}
if
(
pMsg
->
BufferLength
&&
!
WriteFile
(
conn
->
conn
,
pMsg
->
Buffer
,
pMsg
->
BufferLength
,
NULL
,
NULL
))
{
status
=
GetLastError
();
if
(
!
pMsg
->
BufferLength
)
{
status
=
RPC_S_OK
;
goto
fail
;
}
if
(
!
WriteFile
(
conn
->
conn
,
pMsg
->
Buffer
,
pMsg
->
BufferLength
,
NULL
,
NULL
))
{
WARN
(
"WriteFile failed with error %ld
\n
"
,
GetLastError
());
status
=
RPC_S_PROTOCOL_ERROR
;
goto
fail
;
}
...
...
@@ -184,17 +193,20 @@ RPC_STATUS WINAPI I_RpcReceive(PRPC_MESSAGE pMsg)
if
(
!
ReadFile
(
conn
->
conn
,
&
hdr
,
sizeof
(
hdr
),
&
dwRead
,
&
conn
->
ovl
))
{
DWORD
err
=
GetLastError
();
if
(
err
!=
ERROR_IO_PENDING
)
{
status
=
err
;
WARN
(
"ReadFile failed with error %ld
\n
"
,
err
);
status
=
RPC_S_PROTOCOL_ERROR
;
goto
fail
;
}
if
(
!
GetOverlappedResult
(
conn
->
conn
,
&
conn
->
ovl
,
&
dwRead
,
TRUE
))
{
status
=
GetLastError
();
WARN
(
"ReadFile failed with error %ld
\n
"
,
GetLastError
());
status
=
RPC_S_PROTOCOL_ERROR
;
goto
fail
;
}
}
#else
if
(
!
ReadFile
(
conn
->
conn
,
&
hdr
,
sizeof
(
hdr
),
&
dwRead
,
NULL
))
{
status
=
GetLastError
();
WARN
(
"ReadFile failed with error %ld
\n
"
,
GetLastError
());
status
=
RPC_S_PROTOCOL_ERROR
;
goto
fail
;
}
#endif
...
...
@@ -210,19 +222,21 @@ RPC_STATUS WINAPI I_RpcReceive(PRPC_MESSAGE pMsg)
if
(
!
pMsg
->
BufferLength
)
dwRead
=
0
;
else
#ifdef OVERLAPPED_WORKS
if
(
!
ReadFile
(
conn
->
conn
,
pMsg
->
Buffer
,
hdr
.
len
,
&
dwRead
,
&
conn
->
ovl
))
{
DWORD
err
=
GetLastError
();
if
(
err
!=
ERROR_IO_PENDING
)
{
status
=
err
;
if
(
GetLastError
()
!=
ERROR_IO_PENDING
)
{
WARN
(
"ReadFile failed with error %ld
\n
"
,
GetLastError
());
status
=
RPC_S_PROTOCOL_ERROR
;
goto
fail
;
}
if
(
!
GetOverlappedResult
(
conn
->
conn
,
&
conn
->
ovl
,
&
dwRead
,
TRUE
))
{
status
=
GetLastError
();
WARN
(
"ReadFile failed with error %ld
\n
"
,
GetLastError
());
status
=
RPC_S_PROTOCOL_ERROR
;
goto
fail
;
}
}
#else
if
(
!
ReadFile
(
conn
->
conn
,
pMsg
->
Buffer
,
hdr
.
len
,
&
dwRead
,
NULL
))
{
status
=
GetLastError
();
WARN
(
"ReadFile failed with error %ld
\n
"
,
GetLastError
());
status
=
RPC_S_PROTOCOL_ERROR
;
goto
fail
;
}
#endif
...
...
dlls/rpcrt4/rpc_server.c
View file @
d1d89a64
...
...
@@ -194,6 +194,8 @@ static WINE_EXCEPTION_FILTER(rpc_filter)
msg
->
BufferLength
=
sizeof
(
DWORD
);
I_RpcGetBuffer
(
msg
);
*
(
DWORD
*
)
msg
->
Buffer
=
GetExceptionCode
();
WARN
(
"exception caught with code 0x%08lx = %ld
\n
"
,
*
(
DWORD
*
)
msg
->
Buffer
,
*
(
DWORD
*
)
msg
->
Buffer
);
TRACE
(
"returning failure packet
\n
"
);
return
EXCEPTION_EXECUTE_HANDLER
;
}
...
...
@@ -249,7 +251,6 @@ static void RPCRT4_process_packet(RpcConnection* conn, RpcPktHdr* hdr, void* buf
if
(
func
)
func
(
&
msg
);
}
__EXCEPT
(
rpc_filter
)
{
/* failure packet was created in rpc_filter */
TRACE
(
"exception caught, returning failure packet
\n
"
);
}
__ENDTRY
/* send response packet */
...
...
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