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
1218aff9
Commit
1218aff9
authored
Sep 15, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Create an explicit structure for the function frame of all generated functions.
Store _StubMsg in the frame structure since it's needed for exception handling.
parent
af78a7bf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
106 additions
and
96 deletions
+106
-96
client.c
tools/widl/client.c
+17
-12
proxy.c
tools/widl/proxy.c
+43
-39
server.c
tools/widl/server.c
+21
-20
typegen.c
tools/widl/typegen.c
+25
-25
No files found.
tools/widl/client.c
View file @
1218aff9
...
...
@@ -115,6 +115,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
/* write the functions body */
fprintf
(
client
,
"{
\n
"
);
indent
++
;
print_client
(
"struct __client_frame __f, * const __frame = &__f;
\n
"
);
/* declare return value '_RetVal' */
if
(
!
is_void
(
get_func_return_type
(
func
)))
...
...
@@ -128,7 +129,6 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
print_client
(
"RPC_BINDING_HANDLE _Handle = 0;
\n
"
);
print_client
(
"RPC_MESSAGE _RpcMessage;
\n
"
);
print_client
(
"MIDL_STUB_MESSAGE _StubMsg;
\n
"
);
if
(
!
is_void
(
get_func_return_type
(
func
))
&&
decl_indirect
(
get_func_return_type
(
func
)))
{
print_client
(
"void *_p_%s = &%s;
\n
"
,
...
...
@@ -149,7 +149,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
print_client
(
"NdrClientInitializeNew(
\n
"
);
indent
++
;
print_client
(
"(PRPC_MESSAGE)&_RpcMessage,
\n
"
);
print_client
(
"(PMIDL_STUB_MESSAGE)&_StubMsg,
\n
"
);
print_client
(
"(PMIDL_STUB_MESSAGE)&_
_frame->_
StubMsg,
\n
"
);
print_client
(
"(PMIDL_STUB_DESC)&%s_StubDesc,
\n
"
,
iface
->
name
);
print_client
(
"%d);
\n
"
,
method_count
);
indent
--
;
...
...
@@ -207,8 +207,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
print_client
(
"NdrGetBuffer(
\n
"
);
indent
++
;
print_client
(
"(PMIDL_STUB_MESSAGE)&_StubMsg,
\n
"
);
print_client
(
"_StubMsg.BufferLength,
\n
"
);
print_client
(
"(PMIDL_STUB_MESSAGE)&_
_frame->_
StubMsg,
\n
"
);
print_client
(
"_
_frame->_
StubMsg.BufferLength,
\n
"
);
if
(
implicit_handle
||
explicit_handle_var
||
explicit_generic_handle_var
||
context_handle_var
)
print_client
(
"_Handle);
\n
"
);
else
...
...
@@ -221,16 +221,16 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
/* send/receive message */
/* print_client("NdrNsSendReceive(\n"); */
/* print_client("(unsigned char *)_StubMsg.Buffer,\n"); */
/* print_client("(unsigned char *)_
_frame->_
StubMsg.Buffer,\n"); */
/* print_client("(RPC_BINDING_HANDLE *) &%s__MIDL_AutoBindHandle);\n", iface->name); */
print_client
(
"NdrSendReceive(
\n
"
);
indent
++
;
print_client
(
"(PMIDL_STUB_MESSAGE)&_StubMsg,
\n
"
);
print_client
(
"(unsigned char *)_StubMsg.Buffer);
\n\n
"
);
print_client
(
"(PMIDL_STUB_MESSAGE)&_
_frame->_
StubMsg,
\n
"
);
print_client
(
"(unsigned char *)_
_frame->_
StubMsg.Buffer);
\n\n
"
);
indent
--
;
print_client
(
"_StubMsg.BufferStart = (unsigned char *)_RpcMessage.Buffer;
\n
"
);
print_client
(
"_
StubMsg.BufferEnd =
_StubMsg.BufferStart + _RpcMessage.BufferLength;
\n
"
);
print_client
(
"_
_frame->_
StubMsg.BufferStart = (unsigned char *)_RpcMessage.Buffer;
\n
"
);
print_client
(
"_
_frame->_StubMsg.BufferEnd = __frame->
_StubMsg.BufferStart + _RpcMessage.BufferLength;
\n
"
);
if
(
has_out_arg_or_return
(
func
))
{
...
...
@@ -240,7 +240,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
indent
++
;
print_client
(
"NdrConvert(
\n
"
);
indent
++
;
print_client
(
"(PMIDL_STUB_MESSAGE)&_StubMsg,
\n
"
);
print_client
(
"(PMIDL_STUB_MESSAGE)&_
_frame->_
StubMsg,
\n
"
);
print_client
(
"(PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);
\n
"
,
*
proc_offset
);
indent
-=
2
;
}
...
...
@@ -282,7 +282,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
if
(
has_full_pointer
)
write_full_pointer_free
(
client
,
indent
,
func
);
print_client
(
"NdrFreeBuffer((PMIDL_STUB_MESSAGE)&_StubMsg);
\n
"
);
print_client
(
"NdrFreeBuffer((PMIDL_STUB_MESSAGE)&_
_frame->_
StubMsg);
\n
"
);
if
(
!
implicit_handle
&&
explicit_generic_handle_var
)
{
...
...
@@ -434,7 +434,12 @@ static void init_client(void)
print_client
(
"#endif
\n
"
);
fprintf
(
client
,
"
\n
"
);
print_client
(
"#include
\"
%s
\"\n
"
,
header_name
);
fprintf
(
client
,
"
\n
"
);
print_client
(
"
\n
"
);
print_client
(
"struct __client_frame
\n
"
);
print_client
(
"{
\n
"
);
print_client
(
" MIDL_STUB_MESSAGE _StubMsg;
\n
"
);
print_client
(
"};
\n
"
);
print_client
(
"
\n
"
);
}
...
...
tools/widl/proxy.c
View file @
1218aff9
...
...
@@ -125,15 +125,15 @@ static void init_proxy(const statement_list_t *stmts)
print_proxy
(
" EXCEPTION_REGISTRATION_RECORD frame;
\n
"
);
print_proxy
(
" sigjmp_buf jmp;
\n
"
);
print_proxy
(
" DWORD code;
\n
"
);
print_proxy
(
" MIDL_STUB_MESSAGE
*stub
;
\n
"
);
print_proxy
(
" MIDL_STUB_MESSAGE
_StubMsg
;
\n
"
);
print_proxy
(
" void *this;
\n
"
);
print_proxy
(
" int fullptr;
\n
"
);
print_proxy
(
"};
\n
"
);
print_proxy
(
"
\n
"
);
print_proxy
(
"static void __proxy_finally_handler( struct __proxy_frame *frame )
\n
"
);
print_proxy
(
"{
\n
"
);
print_proxy
(
" if (frame->fullptr) NdrFullPointerXlatFree( frame->
stub->
FullPtrXlatTables );
\n
"
);
print_proxy
(
" if (frame->this) NdrProxyFreeBuffer( frame->this,
frame->stub
);
\n
"
);
print_proxy
(
" if (frame->fullptr) NdrFullPointerXlatFree( frame->
_StubMsg.
FullPtrXlatTables );
\n
"
);
print_proxy
(
" if (frame->this) NdrProxyFreeBuffer( frame->this,
&frame->_StubMsg
);
\n
"
);
print_proxy
(
"}
\n\n
"
);
print_proxy
(
"static DWORD __proxy_exception_handler( EXCEPTION_RECORD *record,
\n
"
);
print_proxy
(
" EXCEPTION_REGISTRATION_RECORD *frame,
\n
"
);
...
...
@@ -148,7 +148,7 @@ static void init_proxy(const statement_list_t *stmts)
print_proxy
(
" __proxy_finally_handler( proxy_frame );
\n
"
);
print_proxy
(
" return ExceptionContinueSearch;
\n
"
);
print_proxy
(
" }
\n
"
);
print_proxy
(
" if (proxy_frame->
stub->
dwStubPhase == PROXY_SENDRECEIVE)
\n
"
);
print_proxy
(
" if (proxy_frame->
_StubMsg.
dwStubPhase == PROXY_SENDRECEIVE)
\n
"
);
print_proxy
(
" return ExceptionContinueSearch;
\n
"
);
print_proxy
(
"
\n
"
);
print_proxy
(
" proxy_frame->code = record->ExceptionCode;
\n
"
);
...
...
@@ -159,35 +159,29 @@ static void init_proxy(const statement_list_t *stmts)
print_proxy
(
"}
\n
"
);
print_proxy
(
"
\n
"
);
print_proxy
(
"#define RpcTryExcept
\\\n
"
);
print_proxy
(
" do {
\\\n
"
);
print_proxy
(
" struct __proxy_frame __proxy_frame;
\\\n
"
);
print_proxy
(
" __proxy_frame.frame.Handler = __proxy_exception_handler;
\\\n
"
);
print_proxy
(
" __proxy_frame.stub = &_StubMsg;
\\\n
"
);
print_proxy
(
" if (!sigsetjmp( __proxy_frame.jmp, 0 ))
\\\n
"
);
print_proxy
(
" __frame->frame.Handler = __proxy_exception_handler;
\\\n
"
);
print_proxy
(
" if (!sigsetjmp( __frame->jmp, 0 ))
\\\n
"
);
print_proxy
(
" {
\\\n
"
);
print_proxy
(
" __wine_push_frame( &__
proxy_frame.
frame );
\\\n
"
);
print_proxy
(
" __wine_push_frame( &__
frame->
frame );
\\\n
"
);
print_proxy
(
" {
\n
"
);
print_proxy
(
"
\n
"
);
print_proxy
(
"#define RpcExcept(expr)
\\\n
"
);
print_proxy
(
" }
\\\n
"
);
print_proxy
(
" __wine_pop_frame( &__
proxy_frame.
frame );
\\\n
"
);
print_proxy
(
" __wine_pop_frame( &__
frame->
frame );
\\\n
"
);
print_proxy
(
" }
\\\n
"
);
print_proxy
(
" else
\\\n
"
);
print_proxy
(
" {
\n
"
);
print_proxy
(
" else
\n
"
);
print_proxy
(
"
\n
"
);
print_proxy
(
"#define RpcEndExcept
\\\n
"
);
print_proxy
(
" }
\\\n
"
);
print_proxy
(
" } while(0);
\n
"
);
print_proxy
(
"#define RpcEndExcept
\n
"
);
print_proxy
(
"
\n
"
);
print_proxy
(
"#define RpcExceptionCode() (__
proxy_frame.
code)
\n
"
);
print_proxy
(
"#define RpcExceptionCode() (__
frame->
code)
\n
"
);
print_proxy
(
"
\n
"
);
print_proxy
(
"#define RpcTryFinallyProxy(ptr)
\\\n
"
);
print_proxy
(
" __
proxy_frame.
this = This;
\\\n
"
);
print_proxy
(
" __
proxy_frame.
fullptr = ptr;
\n
"
);
print_proxy
(
" __
frame->
this = This;
\\\n
"
);
print_proxy
(
" __
frame->
fullptr = ptr;
\n
"
);
print_proxy
(
"
\n
"
);
print_proxy
(
"#define RpcFinallyProxy
\\\n
"
);
print_proxy
(
" __
proxy_frame.
this = 0;
\\\n
"
);
print_proxy
(
" __
proxy_frame.
fullptr = 0;
\n
"
);
print_proxy
(
" __
frame->
this = 0;
\\\n
"
);
print_proxy
(
" __
frame->
fullptr = 0;
\n
"
);
print_proxy
(
"
\n
"
);
print_proxy
(
"#define RpcTryFinallyStub
\n
"
);
print_proxy
(
"
\n
"
);
...
...
@@ -202,8 +196,18 @@ static void init_proxy(const statement_list_t *stmts)
print_proxy
(
"#define RpcFinallyProxy RpcFinally
\n
"
);
print_proxy
(
"#define RpcFinallyStub RpcFinally
\n
"
);
print_proxy
(
"
\n
"
);
print_proxy
(
"struct __proxy_frame
\n
"
);
print_proxy
(
"{
\n
"
);
print_proxy
(
" MIDL_STUB_MESSAGE _StubMsg;
\n
"
);
print_proxy
(
"};
\n
"
);
print_proxy
(
"
\n
"
);
print_proxy
(
"#endif /* USE_COMPILER_EXCEPTIONS */
\n
"
);
print_proxy
(
"
\n
"
);
print_proxy
(
"struct __stub_frame
\n
"
);
print_proxy
(
"{
\n
"
);
print_proxy
(
" MIDL_STUB_MESSAGE _StubMsg;
\n
"
);
print_proxy
(
"};
\n
"
);
print_proxy
(
"
\n
"
);
write_formatstringsdecl
(
proxy
,
indent
,
stmts
,
need_proxy
);
write_stubdescproto
();
}
...
...
@@ -293,10 +297,10 @@ static void free_variable( const var_t *arg )
if
(
size
)
{
print_proxy
(
"_StubMsg.MaxCount = "
);
print_proxy
(
"_
_frame->_
StubMsg.MaxCount = "
);
write_expr
(
proxy
,
size
,
0
,
1
,
NULL
,
NULL
);
fprintf
(
proxy
,
";
\n\n
"
);
print_proxy
(
"NdrClearOutParameters( &_StubMsg, "
);
print_proxy
(
"NdrClearOutParameters( &_
_frame->_
StubMsg, "
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%u], "
,
type_offset
);
fprintf
(
proxy
,
"(void*)%s );
\n
"
,
arg
->
name
);
return
;
...
...
@@ -321,11 +325,11 @@ static void free_variable( const var_t *arg )
iid
=
get_attrp
(
arg
->
attrs
,
ATTR_IIDIS
);
if
(
iid
)
{
print_proxy
(
"_StubMsg.MaxCount = (unsigned long) "
);
print_proxy
(
"_
_frame->_
StubMsg.MaxCount = (unsigned long) "
);
write_expr
(
proxy
,
iid
,
1
,
1
,
NULL
,
NULL
);
print_proxy
(
";
\n\n
"
);
}
print_proxy
(
"NdrClearOutParameters( &_StubMsg, "
);
print_proxy
(
"NdrClearOutParameters( &_
_frame->_
StubMsg, "
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%u], "
,
type_offset
);
fprintf
(
proxy
,
"(void*)%s );
\n
"
,
arg
->
name
);
break
;
...
...
@@ -364,6 +368,7 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx,
print_proxy
(
")
\n
"
);
print_proxy
(
"{
\n
"
);
indent
++
;
print_proxy
(
"struct __proxy_frame __f, * const __frame = &__f;
\n
"
);
/* local variables */
if
(
has_ret
)
{
print_proxy
(
""
);
...
...
@@ -371,7 +376,6 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx,
print_proxy
(
" _RetVal;
\n
"
);
}
print_proxy
(
"RPC_MESSAGE _RpcMessage;
\n
"
);
print_proxy
(
"MIDL_STUB_MESSAGE _StubMsg;
\n
"
);
if
(
has_ret
)
{
if
(
decl_indirect
(
get_func_return_type
(
cur
)))
print_proxy
(
"void *_p_%s = &%s;
\n
"
,
...
...
@@ -388,7 +392,7 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx,
print_proxy
(
"RpcTryExcept
\n
"
);
print_proxy
(
"{
\n
"
);
indent
++
;
print_proxy
(
"NdrProxyInitialize(This, &_RpcMessage, &_StubMsg, &Object_StubDesc, %d);
\n
"
,
idx
);
print_proxy
(
"NdrProxyInitialize(This, &_RpcMessage, &_
_frame->_
StubMsg, &Object_StubDesc, %d);
\n
"
,
idx
);
proxy_check_pointers
(
cur
->
args
);
print_proxy
(
"RpcTryFinallyProxy(%d)
\n
"
,
has_full_pointer
);
...
...
@@ -397,18 +401,18 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx,
write_remoting_arguments
(
proxy
,
indent
,
cur
,
PASS_IN
,
PHASE_BUFFERSIZE
);
print_proxy
(
"NdrProxyGetBuffer(This, &_StubMsg);
\n
"
);
print_proxy
(
"NdrProxyGetBuffer(This, &_
_frame->_
StubMsg);
\n
"
);
write_remoting_arguments
(
proxy
,
indent
,
cur
,
PASS_IN
,
PHASE_MARSHAL
);
print_proxy
(
"NdrProxySendReceive(This, &_StubMsg);
\n
"
);
print_proxy
(
"NdrProxySendReceive(This, &_
_frame->_
StubMsg);
\n
"
);
fprintf
(
proxy
,
"
\n
"
);
print_proxy
(
"_StubMsg.BufferStart = _RpcMessage.Buffer;
\n
"
);
print_proxy
(
"_
StubMsg.BufferEnd =
_StubMsg.BufferStart + _RpcMessage.BufferLength;
\n\n
"
);
print_proxy
(
"_
_frame->_
StubMsg.BufferStart = _RpcMessage.Buffer;
\n
"
);
print_proxy
(
"_
_frame->_StubMsg.BufferEnd = __frame->
_StubMsg.BufferStart + _RpcMessage.BufferLength;
\n\n
"
);
print_proxy
(
"if ((_RpcMessage.DataRepresentation & 0xffff) != NDR_LOCAL_DATA_REPRESENTATION)
\n
"
);
indent
++
;
print_proxy
(
"NdrConvert( &_StubMsg, &__MIDL_ProcFormatString.Format[%u]);
\n
"
,
proc_offset
);
print_proxy
(
"NdrConvert( &_
_frame->_
StubMsg, &__MIDL_ProcFormatString.Format[%u]);
\n
"
,
proc_offset
);
indent
--
;
fprintf
(
proxy
,
"
\n
"
);
...
...
@@ -430,13 +434,13 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx,
indent
++
;
if
(
has_full_pointer
)
write_full_pointer_free
(
proxy
,
indent
,
cur
);
print_proxy
(
"NdrProxyFreeBuffer(This, &_StubMsg);
\n
"
);
print_proxy
(
"NdrProxyFreeBuffer(This, &_
_frame->_
StubMsg);
\n
"
);
indent
--
;
print_proxy
(
"}
\n
"
);
print_proxy
(
"RpcEndFinally
\n
"
);
indent
--
;
print_proxy
(
"}
\n
"
);
print_proxy
(
"RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
\n
"
);
print_proxy
(
"RpcExcept(_
_frame->_
StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
\n
"
);
print_proxy
(
"{
\n
"
);
if
(
has_ret
)
{
indent
++
;
...
...
@@ -473,14 +477,14 @@ static void gen_stub(type_t *iface, const func_t *cur, const char *cas,
indent
--
;
print_proxy
(
"{
\n
"
);
indent
++
;
print_proxy
(
"struct __stub_frame __f, * const __frame = &__f;
\n
"
);
print_proxy
(
"%s * _This = (%s*)((CStdStubBuffer*)This)->pvServerObject;
\n
"
,
iface
->
name
,
iface
->
name
);
print_proxy
(
"MIDL_STUB_MESSAGE _StubMsg;
\n
"
);
declare_stub_args
(
proxy
,
indent
,
cur
);
fprintf
(
proxy
,
"
\n
"
);
/* FIXME: trace */
print_proxy
(
"NdrStubInitialize(_pRpcMessage, &_StubMsg, &Object_StubDesc, _pRpcChannelBuffer);
\n
"
);
print_proxy
(
"NdrStubInitialize(_pRpcMessage, &_
_frame->_
StubMsg, &Object_StubDesc, _pRpcChannelBuffer);
\n
"
);
fprintf
(
proxy
,
"
\n
"
);
write_parameters_init
(
proxy
,
indent
,
cur
);
...
...
@@ -492,7 +496,7 @@ static void gen_stub(type_t *iface, const func_t *cur, const char *cas,
write_full_pointer_init
(
proxy
,
indent
,
cur
,
TRUE
);
print_proxy
(
"if ((_pRpcMessage->DataRepresentation & 0xffff) != NDR_LOCAL_DATA_REPRESENTATION)
\n
"
);
indent
++
;
print_proxy
(
"NdrConvert( &_StubMsg, &__MIDL_ProcFormatString.Format[%u]);
\n
"
,
proc_offset
);
print_proxy
(
"NdrConvert( &_
_frame->_
StubMsg, &__MIDL_ProcFormatString.Format[%u]);
\n
"
,
proc_offset
);
indent
--
;
fprintf
(
proxy
,
"
\n
"
);
...
...
@@ -524,7 +528,7 @@ static void gen_stub(type_t *iface, const func_t *cur, const char *cas,
if
(
!
is_void
(
get_func_return_type
(
cur
)))
write_remoting_arguments
(
proxy
,
indent
,
cur
,
PASS_RETURN
,
PHASE_BUFFERSIZE
);
print_proxy
(
"NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
\n
"
);
print_proxy
(
"NdrStubGetBuffer(This, _pRpcChannelBuffer, &_
_frame->_
StubMsg);
\n
"
);
write_remoting_arguments
(
proxy
,
indent
,
cur
,
PASS_OUT
,
PHASE_MARSHAL
);
fprintf
(
proxy
,
"
\n
"
);
...
...
@@ -546,7 +550,7 @@ static void gen_stub(type_t *iface, const func_t *cur, const char *cas,
print_proxy
(
"}
\n
"
);
print_proxy
(
"RpcEndFinally
\n
"
);
print_proxy
(
"_pRpcMessage->BufferLength = _StubMsg.Buffer - (unsigned char *)_pRpcMessage->Buffer;
\n
"
);
print_proxy
(
"_pRpcMessage->BufferLength = _
_frame->_
StubMsg.Buffer - (unsigned char *)_pRpcMessage->Buffer;
\n
"
);
indent
--
;
print_proxy
(
"}
\n
"
);
...
...
tools/widl/server.c
View file @
1218aff9
...
...
@@ -68,11 +68,11 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
/* write the functions body */
fprintf
(
server
,
"{
\n
"
);
indent
++
;
print_server
(
"struct __server_frame __f, * const __frame = &__f;
\n
"
);
/* Declare arguments */
declare_stub_args
(
server
,
indent
,
func
);
print_server
(
"MIDL_STUB_MESSAGE _StubMsg;
\n
"
);
print_server
(
"RPC_STATUS _Status;
\n
"
);
fprintf
(
server
,
"
\n
"
);
...
...
@@ -81,7 +81,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
print_server
(
"NdrServerInitializeNew(
\n
"
);
indent
++
;
print_server
(
"_pRpcMessage,
\n
"
);
print_server
(
"&_StubMsg,
\n
"
);
print_server
(
"&_
_frame->_
StubMsg,
\n
"
);
print_server
(
"&%s_StubDesc);
\n
"
,
iface
->
name
);
indent
--
;
fprintf
(
server
,
"
\n
"
);
...
...
@@ -110,7 +110,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
indent
++
;
print_server
(
"NdrConvert(
\n
"
);
indent
++
;
print_server
(
"(PMIDL_STUB_MESSAGE)&_StubMsg,
\n
"
);
print_server
(
"(PMIDL_STUB_MESSAGE)&_
_frame->_
StubMsg,
\n
"
);
print_server
(
"(PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);
\n
"
,
*
proc_offset
);
indent
-=
2
;
fprintf
(
server
,
"
\n
"
);
...
...
@@ -119,7 +119,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
write_remoting_arguments
(
server
,
indent
,
func
,
PASS_IN
,
PHASE_UNMARSHAL
);
}
print_server
(
"if (_
StubMsg.Buffer >
_StubMsg.BufferEnd)
\n
"
);
print_server
(
"if (_
_frame->_StubMsg.Buffer > __frame->
_StubMsg.BufferEnd)
\n
"
);
print_server
(
"{
\n
"
);
indent
++
;
print_server
(
"RpcRaiseException(RPC_X_BAD_STUB_DATA);
\n
"
);
...
...
@@ -188,7 +188,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
if
(
!
is_void
(
get_func_return_type
(
func
)))
write_remoting_arguments
(
server
,
indent
,
func
,
PASS_RETURN
,
PHASE_BUFFERSIZE
);
print_server
(
"_pRpcMessage->BufferLength = _StubMsg.BufferLength;
\n
"
);
print_server
(
"_pRpcMessage->BufferLength = _
_frame->_
StubMsg.BufferLength;
\n
"
);
fprintf
(
server
,
"
\n
"
);
print_server
(
"_Status = I_RpcGetBuffer(_pRpcMessage);
\n
"
);
print_server
(
"if (_Status)
\n
"
);
...
...
@@ -196,7 +196,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
print_server
(
"RpcRaiseException(_Status);
\n
"
);
indent
--
;
fprintf
(
server
,
"
\n
"
);
print_server
(
"_StubMsg.Buffer = (unsigned char *)_pRpcMessage->Buffer;
\n
"
);
print_server
(
"_
_frame->_
StubMsg.Buffer = (unsigned char *)_pRpcMessage->Buffer;
\n
"
);
fprintf
(
server
,
"
\n
"
);
}
...
...
@@ -226,7 +226,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
fprintf
(
server
,
"
\n
"
);
print_server
(
"_pRpcMessage->BufferLength =
\n
"
);
indent
++
;
print_server
(
"(unsigned int)(_StubMsg.Buffer - (unsigned char *)_pRpcMessage->Buffer);
\n
"
);
print_server
(
"(unsigned int)(_
_frame->_
StubMsg.Buffer - (unsigned char *)_pRpcMessage->Buffer);
\n
"
);
indent
--
;
indent
--
;
fprintf
(
server
,
"}
\n
"
);
...
...
@@ -382,6 +382,7 @@ static void init_server(void)
print_server
(
"{
\n
"
);
print_server
(
" EXCEPTION_REGISTRATION_RECORD frame;
\n
"
);
print_server
(
" sigjmp_buf jmp;
\n
"
);
print_server
(
" MIDL_STUB_MESSAGE _StubMsg;
\n
"
);
print_server
(
"};
\n
"
);
print_server
(
"
\n
"
);
print_server
(
"static DWORD __server_exception_handler( EXCEPTION_RECORD *record,
\n
"
);
...
...
@@ -405,25 +406,25 @@ static void init_server(void)
print_server
(
" siglongjmp( server_frame->jmp, 1 );
\n
"
);
print_server
(
"}
\n
"
);
print_server
(
"#define RpcTryExcept
\\\n
"
);
print_server
(
" do {
\\\n
"
);
print_server
(
" struct __server_frame __server_frame;
\\\n
"
);
print_server
(
" __server_frame.frame.Handler = __server_exception_handler;
\\\n
"
);
print_server
(
" if (!sigsetjmp( __server_frame.jmp, 0 ))
\\\n
"
);
print_server
(
" __frame->frame.Handler = __server_exception_handler;
\\\n
"
);
print_server
(
" if (!sigsetjmp( __frame->jmp, 0 ))
\\\n
"
);
print_server
(
" {
\\\n
"
);
print_server
(
" __wine_push_frame( &__server_frame.frame );
\\\n
"
);
print_server
(
" {
\n
"
);
print_server
(
" __wine_push_frame( &__frame->frame );
\n
"
);
print_server
(
"
\n
"
);
print_server
(
"#define RpcExcept(expr)
\\\n
"
);
print_server
(
" }
\\\n
"
);
print_server
(
" __wine_pop_frame( &__server_frame.frame );
\\\n
"
);
print_server
(
" __wine_pop_frame( &__frame->frame );
\\\n
"
);
print_server
(
" }
\\\n
"
);
print_server
(
" else
\\\n
"
);
print_server
(
" {
\n
"
);
print_server
(
" else
\n
"
);
print_server
(
"
\n
"
);
print_server
(
"#define RpcEndExcept
\\\n
"
);
print_server
(
" }
\\\n
"
);
print_server
(
" } while(0);
\n
"
);
print_server
(
"#define RpcEndExcept
\n
"
);
print_server
(
"
\n
"
);
print_server
(
"#else /* USE_COMPILER_EXCEPTIONS */
\n
"
);
print_server
(
"
\n
"
);
print_server
(
"struct __server_frame
\n
"
);
print_server
(
"{
\n
"
);
print_server
(
" MIDL_STUB_MESSAGE _StubMsg;
\n
"
);
print_server
(
"};
\n
"
);
print_server
(
"
\n
"
);
print_server
(
"#endif /* USE_COMPILER_EXCEPTIONS */
\n
"
);
print_server
(
"
\n
"
);
}
...
...
tools/widl/typegen.c
View file @
1218aff9
...
...
@@ -897,14 +897,14 @@ int is_full_pointer_function(const func_t *func)
void
write_full_pointer_init
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
,
int
is_server
)
{
print_file
(
file
,
indent
,
"_StubMsg.FullPtrXlatTables = NdrFullPointerXlatInit(0,%s);
\n
"
,
print_file
(
file
,
indent
,
"_
_frame->_
StubMsg.FullPtrXlatTables = NdrFullPointerXlatInit(0,%s);
\n
"
,
is_server
?
"XLAT_SERVER"
:
"XLAT_CLIENT"
);
fprintf
(
file
,
"
\n
"
);
}
void
write_full_pointer_free
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
)
{
print_file
(
file
,
indent
,
"NdrFullPointerXlatFree(_StubMsg.FullPtrXlatTables);
\n
"
);
print_file
(
file
,
indent
,
"NdrFullPointerXlatFree(_
_frame->_
StubMsg.FullPtrXlatTables);
\n
"
);
fprintf
(
file
,
"
\n
"
);
}
...
...
@@ -2656,7 +2656,7 @@ static void print_phase_function(FILE *file, int indent, const char *type,
print_file
(
file
,
indent
,
"Ndr%s%s(
\n
"
,
type
,
function
);
indent
++
;
print_file
(
file
,
indent
,
"&_StubMsg,
\n
"
);
print_file
(
file
,
indent
,
"&_
_frame->_
StubMsg,
\n
"
);
print_file
(
file
,
indent
,
"%s%s%s%s,
\n
"
,
(
phase
==
PHASE_UNMARSHAL
)
?
"(unsigned char **)"
:
"(unsigned char *)"
,
(
phase
==
PHASE_UNMARSHAL
||
decl_indirect
(
var
->
type
))
?
"&"
:
""
,
...
...
@@ -2728,8 +2728,8 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase,
}
if
(
phase
==
PHASE_MARSHAL
)
print_file
(
file
,
indent
,
"MIDL_memset(_
StubMsg.Buffer, 0, (0x%x - (long)
_StubMsg.Buffer) & 0x%x);
\n
"
,
alignment
,
alignment
-
1
);
print_file
(
file
,
indent
,
"_
StubMsg.Buffer = (unsigned char *)(((long)
_StubMsg.Buffer + %u) & ~0x%x);
\n
"
,
print_file
(
file
,
indent
,
"MIDL_memset(_
_frame->_StubMsg.Buffer, 0, (0x%x - (long)__frame->
_StubMsg.Buffer) & 0x%x);
\n
"
,
alignment
,
alignment
-
1
);
print_file
(
file
,
indent
,
"_
_frame->_StubMsg.Buffer = (unsigned char *)(((long)__frame->
_StubMsg.Buffer + %u) & ~0x%x);
\n
"
,
alignment
-
1
,
alignment
-
1
);
if
(
phase
==
PHASE_MARSHAL
)
...
...
@@ -2737,17 +2737,17 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase,
print_file
(
file
,
indent
,
"*("
);
write_type_decl
(
file
,
is_ptr
(
type
)
?
type
->
ref
:
type
,
NULL
);
if
(
is_ptr
(
type
))
fprintf
(
file
,
" *)_StubMsg.Buffer = *"
);
fprintf
(
file
,
" *)_
_frame->_
StubMsg.Buffer = *"
);
else
fprintf
(
file
,
" *)_StubMsg.Buffer = "
);
fprintf
(
file
,
" *)_
_frame->_
StubMsg.Buffer = "
);
fprintf
(
file
,
"%s"
,
varname
);
fprintf
(
file
,
";
\n
"
);
}
else
if
(
phase
==
PHASE_UNMARSHAL
)
{
print_file
(
file
,
indent
,
"if (_StubMsg.Buffer + sizeof("
);
print_file
(
file
,
indent
,
"if (_
_frame->_
StubMsg.Buffer + sizeof("
);
write_type_decl
(
file
,
is_ptr
(
type
)
?
type
->
ref
:
type
,
NULL
);
fprintf
(
file
,
") > _StubMsg.BufferEnd)
\n
"
);
fprintf
(
file
,
") > _
_frame->_
StubMsg.BufferEnd)
\n
"
);
print_file
(
file
,
indent
,
"{
\n
"
);
print_file
(
file
,
indent
+
1
,
"RpcRaiseException(RPC_X_BAD_STUB_DATA);
\n
"
);
print_file
(
file
,
indent
,
"}
\n
"
);
...
...
@@ -2761,10 +2761,10 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase,
else
fprintf
(
file
,
" = *("
);
write_type_decl
(
file
,
is_ptr
(
type
)
?
type
->
ref
:
type
,
NULL
);
fprintf
(
file
,
" *)_StubMsg.Buffer;
\n
"
);
fprintf
(
file
,
" *)_
_frame->_
StubMsg.Buffer;
\n
"
);
}
print_file
(
file
,
indent
,
"_StubMsg.Buffer += sizeof("
);
print_file
(
file
,
indent
,
"_
_frame->_
StubMsg.Buffer += sizeof("
);
write_type_decl
(
file
,
var
->
type
,
NULL
);
fprintf
(
file
,
");
\n
"
);
}
...
...
@@ -2812,14 +2812,14 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent,
{
if
(
type
->
size_is
)
{
print_file
(
file
,
indent
,
"_StubMsg.MaxCount = (unsigned long)"
);
print_file
(
file
,
indent
,
"_
_frame->_
StubMsg.MaxCount = (unsigned long)"
);
write_expr
(
file
,
type
->
size_is
,
1
,
1
,
NULL
,
NULL
);
fprintf
(
file
,
";
\n\n
"
);
}
if
(
type
->
length_is
)
{
print_file
(
file
,
indent
,
"_StubMsg.Offset = (unsigned long)0;
\n
"
);
/* FIXME */
print_file
(
file
,
indent
,
"_StubMsg.ActualCount = (unsigned long)"
);
print_file
(
file
,
indent
,
"_
_frame->_
StubMsg.Offset = (unsigned long)0;
\n
"
);
/* FIXME */
print_file
(
file
,
indent
,
"_
_frame->_
StubMsg.ActualCount = (unsigned long)"
);
write_expr
(
file
,
type
->
length_is
,
1
,
1
,
NULL
,
NULL
);
fprintf
(
file
,
";
\n\n
"
);
}
...
...
@@ -2830,7 +2830,7 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent,
{
if
(
is_conformance_needed_for_phase
(
phase
))
{
print_file
(
file
,
indent
,
"_StubMsg.MaxCount = (unsigned long)"
);
print_file
(
file
,
indent
,
"_
_frame->_
StubMsg.MaxCount = (unsigned long)"
);
write_expr
(
file
,
get_attrp
(
var
->
attrs
,
ATTR_SWITCHIS
),
1
,
1
,
NULL
,
NULL
);
fprintf
(
file
,
";
\n\n
"
);
}
...
...
@@ -2842,7 +2842,7 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent,
if
(
is_conformance_needed_for_phase
(
phase
)
&&
(
iid
=
get_attrp
(
var
->
attrs
,
ATTR_IIDIS
)))
{
print_file
(
file
,
indent
,
"_StubMsg.MaxCount = (unsigned long) "
);
print_file
(
file
,
indent
,
"_
_frame->_
StubMsg.MaxCount = (unsigned long) "
);
write_expr
(
file
,
iid
,
1
,
1
,
NULL
,
NULL
);
fprintf
(
file
,
";
\n\n
"
);
}
...
...
@@ -2900,14 +2900,14 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
* be direct, otherwise it is a pointer */
int
is_ch_ptr
=
is_aliaschain_attr
(
type
,
ATTR_CONTEXTHANDLE
)
?
FALSE
:
TRUE
;
print_file
(
file
,
indent
,
"NdrClientContextMarshall(
\n
"
);
print_file
(
file
,
indent
+
1
,
"&_StubMsg,
\n
"
);
print_file
(
file
,
indent
+
1
,
"&_
_frame->_
StubMsg,
\n
"
);
print_file
(
file
,
indent
+
1
,
"(NDR_CCONTEXT)%s%s,
\n
"
,
is_ch_ptr
?
"*"
:
""
,
var
->
name
);
print_file
(
file
,
indent
+
1
,
"%s);
\n
"
,
in_attr
&&
out_attr
?
"1"
:
"0"
);
}
else
{
print_file
(
file
,
indent
,
"NdrServerContextNewMarshall(
\n
"
);
print_file
(
file
,
indent
+
1
,
"&_StubMsg,
\n
"
);
print_file
(
file
,
indent
+
1
,
"&_
_frame->_
StubMsg,
\n
"
);
print_file
(
file
,
indent
+
1
,
"(NDR_SCONTEXT)%s,
\n
"
,
var
->
name
);
print_file
(
file
,
indent
+
1
,
"(NDR_RUNDOWN)%s_rundown,
\n
"
,
get_context_handle_type_name
(
var
->
type
));
print_file
(
file
,
indent
+
1
,
"(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
start_offset
);
...
...
@@ -2920,14 +2920,14 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
if
(
!
in_attr
)
print_file
(
file
,
indent
,
"*%s = 0;
\n
"
,
var
->
name
);
print_file
(
file
,
indent
,
"NdrClientContextUnmarshall(
\n
"
);
print_file
(
file
,
indent
+
1
,
"&_StubMsg,
\n
"
);
print_file
(
file
,
indent
+
1
,
"&_
_frame->_
StubMsg,
\n
"
);
print_file
(
file
,
indent
+
1
,
"(NDR_CCONTEXT *)%s,
\n
"
,
var
->
name
);
print_file
(
file
,
indent
+
1
,
"_Handle);
\n
"
);
}
else
{
print_file
(
file
,
indent
,
"%s = NdrServerContextNewUnmarshall(
\n
"
,
var
->
name
);
print_file
(
file
,
indent
+
1
,
"&_StubMsg,
\n
"
);
print_file
(
file
,
indent
+
1
,
"&_
_frame->_
StubMsg,
\n
"
);
print_file
(
file
,
indent
+
1
,
"(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
start_offset
);
}
}
...
...
@@ -2989,7 +2989,7 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
{
print_file
(
file
,
indent
,
"if (%s)
\n
"
,
var
->
name
);
indent
++
;
print_file
(
file
,
indent
,
"_StubMsg.pfnFree(%s);
\n
"
,
var
->
name
);
print_file
(
file
,
indent
,
"_
_frame->_
StubMsg.pfnFree(%s);
\n
"
,
var
->
name
);
}
}
}
...
...
@@ -3031,7 +3031,7 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
expr_t
*
iid
;
if
((
iid
=
get_attrp
(
var
->
attrs
,
ATTR_IIDIS
)))
{
print_file
(
file
,
indent
,
"_StubMsg.MaxCount = (unsigned long) "
);
print_file
(
file
,
indent
,
"_
_frame->_
StubMsg.MaxCount = (unsigned long) "
);
write_expr
(
file
,
iid
,
1
,
1
,
NULL
,
NULL
);
fprintf
(
file
,
";
\n\n
"
);
}
...
...
@@ -3071,7 +3071,7 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func,
if
(
phase
==
PHASE_BUFFERSIZE
&&
pass
!=
PASS_RETURN
)
{
unsigned
int
size
=
get_function_buffer_size
(
func
,
pass
);
print_file
(
file
,
indent
,
"_StubMsg.BufferLength = %u;
\n
"
,
size
);
print_file
(
file
,
indent
,
"_
_frame->_
StubMsg.BufferLength = %u;
\n
"
,
size
);
}
if
(
pass
==
PASS_RETURN
)
...
...
@@ -3234,7 +3234,7 @@ void assign_stub_out_args( FILE *file, int indent, const func_t *func )
if
(
is_context_handle
(
var
->
type
))
{
fprintf
(
file
,
" = NdrContextHandleInitialize(
\n
"
);
print_file
(
file
,
indent
+
1
,
"&_StubMsg,
\n
"
);
print_file
(
file
,
indent
+
1
,
"&_
_frame->_
StubMsg,
\n
"
);
print_file
(
file
,
indent
+
1
,
"(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
var
->
type
->
typestring_offset
);
}
...
...
@@ -3243,7 +3243,7 @@ void assign_stub_out_args( FILE *file, int indent, const func_t *func )
unsigned
int
size
,
align
=
0
;
type_t
*
type
=
var
->
type
;
fprintf
(
file
,
" = NdrAllocate(&_StubMsg, "
);
fprintf
(
file
,
" = NdrAllocate(&_
_frame->_
StubMsg, "
);
for
(
;
type
->
size_is
;
type
=
type
->
ref
)
{
write_expr
(
file
,
type
->
size_is
,
TRUE
,
TRUE
,
NULL
,
NULL
);
...
...
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