[RPCRT4] Sync to WineStaging 10.0-rc2

[WINESYNC] include: Use __has_declspec_attribute in basetsd.h.

wine commit id 8c4ccad0ab3206a0edbe1ed8a7f906d9c1efcd09 by Jacek Caban <[email protected]>

[WINESYNC] include: Add DECLSPEC_UUID/DECLSPEC_NOVTABLE to MIDL_INTERFACE.

wine commit id 5b87af399d5ca69a8740d068321b9723b1f8200c by Rémi Bernon <[email protected]>

[WINESYNC] include: Use winnt.h DECLSPEC_NOVTABLE definition in rpcndr.h.

wine commit id e14f129ac7169a5feca310101867e288ed8cd356 by Rémi Bernon <[email protected]>

[WINESYNC] include: Use winnt.h DECLSPEC_UUID definition in rpcndr.h.

wine commit id 6a9ce35e7bfb2cc8e91983eb44366f086934f571 by Rémi Bernon <[email protected]>

[WINESYNC] rpcrt4/tests: Allocate stub buffers with NdrOleAllocate.

This fixes crashes on Windows 7-10.

wine commit id e280366e146c58118bd8785c079881738ad55935 by Alex Henrie <[email protected]>

[WINESYNC] rpcrt4/tests: Test whether Ndr(Get|Free)Buffer calls StubMsg.pfn(Allocate|Free).

wine commit id 05453b10761486b7efe9dde41367be416ce6c28a by Alex Henrie <[email protected]>

[WINESYNC] rpcrt4/tests: Correct a comment in test_pointer_marshal.

NdrFree is an internal Wine function.

wine commit id 0ca04e1959ca89d99366d9d66a58fde6b8b20525 by Alex Henrie <[email protected]>

[WINESYNC] rpcrt4: Move call_server_func() to a separate file.

And build it as x86-64 code on ARM64EC.

wine commit id 6647987edc71209731399a1025a576cc80188169 by Alexandre Julliard <[email protected]>

WIP (move all to thunks-msvc.s) [WINESYNC] rpcrt4: Move call_server_func() to a separate file.

And build it as x86-64 code on ARM64EC.

wine commit id 6647987edc71209731399a1025a576cc80188169 by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Move the stubless delegating thunks to a separate file.

And build them as x86-64 code on ARM64EC.

wine commit id fb8ae8ca35b5ce77cdbce5c60b900fafddcc35cb by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Move the stubless client thunks to a separate file.

And build them as x86-64 code on ARM64EC.

wine commit id d28f4fd0ecf5818d542dcd6fe5ca7d3d65f1b8f1 by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Extend 8- and 16-bit parameters on ARM.

wine commit id 28cb539ef9b2ea4a262d3994a0a077c4b4a26296 by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Generate the parameter extension data for typelibs on ARM platforms.

wine commit id 00756efcfbf07c80373b7a82fdcc6253e48e555e by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Fix stack alignment and by-value parameters for typelibs on ARM platforms.

wine commit id 486068560eb23a70061f4d383919a19d0f671e5e by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Stop passing the actual FPU regs pointer to client call functions.

wine commit id e4b7eeaad4b0d6c2b9a024d14fe10a25a28630d5 by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Remap registers to the stack for stubless proxies on ARM platforms.

wine commit id 889767ce35ab1e26e5a910d670db37c143043f9a by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Move the FPU register conversion to the stubless proxy wrapper.

wine commit id d9067a8ae45190b1195efbae352a2015d8af48f3 by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Add a wrapper for client calls from stubless proxies.

wine commit id a8ad671baed45325f6c6987f37e872767ed8f59f by Alexandre Julliard <[email protected]>

[WINESYNC] include: Update a couple of RPC structures.

wine commit id 522cecf67cd81496bc56a35fc60a799f3f8b79de by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Leave some space on the stack for varargs when called from ARM64EC code.

wine commit id 3c8fc4927d7253c06aeb7147da759a2f3d5ff171 by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Support calling server functions with floating point arguments on ARM platforms.

wine commit id b684bd24d2544180813ca396bf4fe72beffd1183 by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Implement Ndr64AsyncClientCall in assembly on all platforms.

wine commit id b2564ffcd928ff2da6cfea3bbaeffdb5f33e1118 by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Implement NdrAsyncClientCall in assembly on all platforms.

wine commit id 8980dc0fd5d54492fe5ff14ed2e248367d839858 by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Implement NdrClientCall3 in assembly on all platforms.

wine commit id 19548ad5124593daaa43ca351b5c9f02ee2e2bd2 by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Implement NdrClientCall2 in assembly on all platforms.

wine commit id e994c8ef741ce28ac6971ea5ff6a131c483f0fd7 by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Export NdrpClientCall2.

wine commit id 2fff2c6b4a5bde69f9438e11191a24fb5439d8b9 by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4/tests: Add some more parameter passing tests.

wine commit id 4fc1591fc6f78e5e2bb8ecd9ad0f89ffee6a8084 by Alexandre Julliard <[email protected]>

[WINESYNC] widl: Add /robust flags in correlation descriptors.

wine commit id 4d8ee6bb18f42e125ffd51a28348687e55b56776 by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Make sure that the stack is set when catching an exception.

Fixes a test crash in interpreted mode.

wine commit id 8bac669056d2e810e6969ad7339fdc572b0ce93b by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Return the correct failure for a NULL binding handle.

Fixes a test crash in interpreted mode.

wine commit id 2d801c46c76bbf6fa9fed9988222aa5cfb249b57 by Alexandre Julliard <[email protected]>

[WINESYNC] widl: Don't skip a pointer level for pointers to pointers to strings.

wine commit id 69849bd2ee7bd2f180f3a9199fccf2a2c76d9751 by Alexandre Julliard <[email protected]>

[WINESYNC] include: Annotate NdrGetBuffer with __WINE_(ALLOC_SIZE|MALLOC).

It would be nice to annotate it with __WINE_DEALLOC(NdrFreeBuffer) too,
but that causes a bunch of spurious -Wfree-nonheap-object warnings.

wine commit id e7364e2165924c393055cc3f9f910aa347556bd6 by Alex Henrie <[email protected]>

[WINESYNC] rpcrt4/tests: Fix some malloc/HeapAlloc mismatches.

Fixes regressions caused by a38e05636df9596ff3e41301c771fe93523808f1.

wine commit id 18bdd435f12714859794da49ba52806f37a120f2 by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Force debug info in critical sections.

wine commit id 139d624787a2c629cf640a413c4faabfc2bf40b4 by Paul Gofman <[email protected]>

WIP reduce diff CONST_VTABLE

[WINESYNC] rpcrt4/tests: Use CRT allocation functions.

wine commit id a38e05636df9596ff3e41301c771fe93523808f1 by Alex Henrie <[email protected]>

[WINESYNC]: rpcrt4 is now in sync with wine-staging wine-9.0

[WINESYNC] rpcrt4/tests: Test explicit_handle.

wine commit id 6b6aff83221d38167488b48adf4f8e12e0039f07 by Haoyang Chen <[email protected]>

[WINESYNC] rpcrt4: Support for explicit handle passing.

If explicit_handle is defined in the idl file, c/s use explicit handles,
then an explicit handle must be passed in to the server-side  interface

wine commit id 9a4de1b727cf7b8226f23e056932f99c53246572 by Haoyang Chen <[email protected]>

[WINESYNC] include: Make strict prototypes the default.

wine commit id 240e4387e81e0b139138ee2631ac6822acddffbc by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Remove DECLSPEC_HIDDEN usage.

wine commit id 9b26ea16a3fc13118c4c4eaab6ea46d3828ea503 by Alistair Leslie-Hughes <[email protected]>

[WINESYNC] rpcrt4: Generate vtbl delegating thunks at compile time.

wine commit id 00fb82c315342b87be5aca97f63927acf85b4df8 by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Generate stubless thunks at compile time.

wine commit id 439ce3a3aed17fcb41013e7e3e0271e36e5df321 by Alexandre Julliard <[email protected]>

[WINESYNC] include: Remove DECLSPEC_HIDDEN from GUID definitions.

wine commit id 19cc2439ede6562613d03d75305ddbbe03d11152 by Alexandre Julliard <[email protected]>

[WINESYNC] include: Remove DECLSPEC_HIDDEN from GUID definitions.

wine commit id 19cc2439ede6562613d03d75305ddbbe03d11152 by Alexandre Julliard <[email protected]>

[WINESYNC] include: Remove DECLSPEC_HIDDEN from RPC functions.

wine commit id 30ce97dd20ef3876eafa40a85994ddaba1194a9c by Alexandre Julliard <[email protected]>

[WINESYNC] include: Remove DECLSPEC_HIDDEN from winecrt0 functions.

wine commit id d597d04924a79e67e49d63ce5790fb1fe3e39d5e by Alexandre Julliard <[email protected]>

[WINESYNC] include: Annotate MIDL_user_allocate with __WINE_(ALLOC_SIZE|DEALLOC|MALLOC).

wine commit id f27ac1bb777aa74c82d91203a06591299e6fef3d by Alex Henrie <[email protected]>

[WINESYNC] rpcrt4: Add SEH annotations to ARM64 assembly code.

wine commit id 3acb058a558ee687ca9c67175bf1490bddf34016 by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4/tests: Use nameless unions/structs.

wine commit id a345f985c0ef46aac6e2a7a01b6950f39ba08a6a by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Use nameless union/structs.

wine commit id d8e35c51c9be00cf549044d2299d43edb98dbf3a by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Don't use GetProcAddress for ole32 functions.

It's more elegant to put ole32 in the DELAYIMPORTS.

wine commit id f0b0c7f4641d129e6b306534084e77cc4cfd1e94 by Alex Henrie <[email protected]>

[WINESYNC] rpcrt4: Replace RPCRT4_strndupA with strdup.

wine commit id 3fd8c85fd19ec7498f1151e0a504a637f462221f by Alex Henrie <[email protected]>

[WINESYNC] rpcrt4: Avoid casting an object to IUnknown.

Cast its interface member to IUnknown instead.

wine commit id 70a847248feb7008b994588574a4aff320af93c1 by Dmitry Timoshkov <[email protected]>

[WINESYNC] rpcrt4: Mark the buffer as invalid in NdrProxyFreeBuffer().

wine commit id 4ec4bdff7365193f71806f7fc0c31c0cbf724a57 by Dmitry Timoshkov <[email protected]>

[WINESYNC] rpcrt4/tests: Remove a failing test.

wine commit id fc6af061faf1dadeb4193a91a0d7145d10bbb54f by Huw Davies <[email protected]>

[WINESYNC] rpcrt4: Use CONTAINING_RECORD in release_delegating_vtbl().

wine commit id fe8f63ce729db45f5dd05699540b0e3778a8e17d by Zebediah Figura <[email protected]>

[WINESYNC] rpcrt4: Use a flexible array member in struct delegating_vtbl.

wine commit id 10bbf79d53ae4c668b1737655b5fbe299d4f9d0d by Zebediah Figura <[email protected]>

[WINESYNC] rpcrt4: Rename "ref_counted_vtbl" to "struct delegating_vtbl".

Get rid of the typedef, and give it a slightly more salient name (and one that
matches more of the surrounding code).

wine commit id e85afda3b5212a0398cb2dd105e232cfdbfc1329 by Zebediah Figura <[email protected]>

[WINESYNC] rpcrt4: Use a CONTAINING_RECORD helper to retrieve CInterfaceStubHeader from CStdStubBuffer.

wine commit id 4ad5de28419228868b734e29d915e450de83c1b2 by Zebediah Figura <[email protected]>

[WINESYNC] rpcrt4: Use a CONTAINING_RECORD helper to retrieve CStdStubBuffer from IRpcStubBuffer.

wine commit id 180edc5a4f31e1e2846c25fd9788dbda1648e659 by Zebediah Figura <[email protected]>

[WINESYNC]: rpcrt4 is now in sync with wine-staging wine-8.0

[WINESYNC] rpcrt4/tests: Avoid invalid free of static string.

wine commit id 3356ba6810513cd19e87b4d773458f1894e6d6f1 by Rémi Bernon <[email protected]>

[WINESYNC] rpcrt4: Fix GCC12.2 warnings.

GCC12.2 warns about dereferencing a pointer to RpcPktHdr
while it has been allocated to the size of one of the packet
(hence smaller in some cases).

/home/eric/work/wine/dlls/rpcrt4/rpc_message.c:111:26: warning: array subscript 'RpcPktHdr[0]' is partly outside array bounds of 'unsigned char[24]' [-Warray-bounds]
  111 |   Header->common.rpc_ver = RPC_VER_MAJOR;

This patch fixes the warnings by accessing the created object
through a pointer to their type (and not through the union).

Signed-off-by: Eric Pouech <[email protected]>

wine commit id 7ffcd6609f5e8524caff214147ec683a59ed473b by Eric Pouech <[email protected]>

[WINESYNC] rpcrt4: Pass a common header to RPCRT4_BuildCommonHeader.

Signed-off-by: Eric Pouech <[email protected]>

wine commit id 5d2547cef492e337830dffb1a96827ea0e95612c by Eric Pouech <[email protected]>

[WINESYNC] include: Use proper dllimports for rpcrt4 functions.

wine commit id 9fc9c91bf47948f2f35699fe2956955d609198d5 by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Use standard C functions for memory allocation.

wine commit id 3bfc4493cb886d767e48b2677b07fef409a2db11 by Alex Henrie <[email protected]>

[WINESYNC] rpcrt4/tests: Don't use an array of pointers in test_conf_complex_struct.

An array of pointers isn't conformant on 64-bit and will overrun the
destination buffer when unmarshalling. Since the purpose of this
function is to test a conformant FC_BOGUS_STRUCT, use one that is
conformant on both 32-bit and 64-bit.

The revised test coincidentally reveals that there is a problem with the
padding or alignment after a marshalled 16-bit enum, which will need to
be addressed separately.

Co-authored-by: Zebediah Figura <[email protected]>

wine commit id e09c93de7bd4f27b41f572a4a79d9df190c63c6f by Alex Henrie <[email protected]>

[WINESYNC] rpcrt4: Fix unexpected exception in ndr_marshal tests.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52909
Signed-off-by: Eric Pouech <[email protected]>

wine commit id c5e23886b2290304c78101d7927898700974b84a by Eric Pouech <[email protected]>

[WINESYNC] rpcrt4/tests: Fix the spelling of a couple of comments.

wine commit id e7be6ae2f1d85c380098350cff3ed1c2fb25e5bc by Francois Gouget <[email protected]>

[WINESYNC] rpcrt4: Add a refcount owned by MIDL_STUB_MESSAGE.

In cases where this could have been use-after-free, exceptions were
caught/hidden by RpcTryFinally, but still lead to leaks since
NdrProxyFreeBuffer wasn't able to call IRPCChannelBuffer::FreeBuffer.

StdProxy_GetChannel() now AddRef() on its return value (used to set
__proxy_frame::_StubMsg::pRpcChannelBuffer), and NdrProxyFreeBuffer()
calls the corresponding Release() and clears the now-weak pointer.
This makes the behavior of these function match the observed test
results, and fixes the crash/leak when a proxy is released mid-Invoke.

wine commit id a7be4256f6081684e8fb0258564f9358eb36cfcf by Kevin Puetz <[email protected]>

[WINESYNC] rpcrt4/tests: Add tests for lifetime of IRpcChannelBuffer.

It's possible for a proxy to be released during the middle of an Invoke.
E.g. a specific case where this happened was a single-shot event sink
which, upon receiving the event it was waiting for, would immediately
call DispEventUnadvise. This removed the proxy pointing to that sink
from the connection point's list of subscribers and released the last
refcount on the proxy itself.

Therefore, all state used to complete an RPC call must be on the stack;
once NdrProxySendReceive pumps STA messages and permits reentrancy,
the proxy cannot be accessed or relied on to own anything.

Add test showing MIDL_STUB_MESSAGE::pRpcChannelBuffer owns a refcount
(to ensure it can read [out] parameters from the channel)

wine commit id 59f39b325d2d90c09c8b346ba241dab182084c7b by Kevin Puetz <[email protected]>

[WINESYNC] rpcrt4: Set the name of internal threads.

wine commit id 3f0166fa89616e409e0381415e23302479100d3a by Brendan Shanks <[email protected]>

[KERNEL32_VISTA] Import SetThreadDescription from wine-10.0

[WINESYNC] rpcrt4: Add SEH annotations to NdrClientCall2().

wine commit id bad509227aa534f152a17316bdcf221436f03284 by Zebediah Figura <[email protected]>

[WINESYNC] rpcrt4: Make NdrClientCall2() SEH-compatible.

wine commit id a5322fc94fa7333a09456a551d70eb1bf5a8fdbd by Zebediah Figura <[email protected]>

[WINESYNC] rpcrt4: Add SEH annotations to NdrClientCall3().

wine commit id 5d01faed777fadf6cb7882d8c8dc3bdfd26dd2e3 by Zebediah Figura <[email protected]>

[WINESYNC] rpcrt4: Make NdrClientCall3() SEH-compatible.

wine commit id abe75a5f22d82d0b35d67ae9d531d49a3d67d09f by Zebediah Figura <[email protected]>

[WINESYNC] rpcrt4: Add SEH annotations to Ndr64AsyncClientCall().

wine commit id 37ae068773677a35342a594448d1bbabf9feb94a by Zebediah Figura <[email protected]>

[WINESYNC] rpcrt4: Make Ndr64AsyncClientCall() SEH-compatible.

wine commit id 16713f52456d86c34eb5f0268468e044ada9d162 by Zebediah Figura <[email protected]>

[WINESYNC] rpcrt4: Implement I_RpcBindingInqLocalClientPID().

Signed-off-by: Zhiyi Zhang <[email protected]>

wine commit id a0301f7db6b58cb8aedd2bd0e862f89cbdb984c5 by Zhiyi Zhang <[email protected]>

[KERNEL32_VISTA] Import GetNamedPipeClientProcessId from wine 10.0

[WINESYNC] rpcrt4/tests: Add I_RpcBindingInqLocalClientPID() tests.

Signed-off-by: Zhiyi Zhang <[email protected]>

wine commit id 056dbb04dea4d0b990e0177f63475165f56ba8da by Zhiyi Zhang <[email protected]>

[WINESYNC] include: Add __WINE_DEALLOC attribute and use it for allocation functions.

Signed-off-by: Brendan Shanks <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id eb55f64d525e7e10c3ac178becd3ae7565560011 by Brendan Shanks <[email protected]>

[WINESYNC] include: Add __WINE_MALLOC attribute and use it for allocation functions.

Signed-off-by: Brendan Shanks <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id fd1b9afc1d4ce4f0401b15aa2a498e33ea74cc1c by Brendan Shanks <[email protected]>

[WINESYNC] rpcrt4: Don't cast ptrdiff_t to ULONG in traces, use %I instead.

Signed-off-by: Eric Pouech <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id ed5ade575b9035b610d1f1857c0ad5fcb1a33000 by Eric Pouech <[email protected]>

[WINESYNC] rpcrt4/tests: Enable compilation with long types.

Signed-off-by: Eric Pouech <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id c5a5143234b3fcbc3377f47cf77440c178d89517 by Eric Pouech <[email protected]>

[WINESYNC] rpcrt4: Enable compilation with long types.

Signed-off-by: Eric Pouech <[email protected]>
Signed-off-by: Huw Davies <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id b67a843c1a25b3dcce653b14d213b904f883c009 by Eric Pouech <[email protected]>

[SDK] Improve GUID hack

[WINESYNC] include/msvcrt: Add attribute((format)) to printf and scanf -like APIs.

Fix a bunch of warnings generated by this patch and the migration of
GUID.Data1 to long in ae2693e2c4079edcc719c08abed5ad58ba7aace7

Signed-off-by: Eric Pouech <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id bb1fc33570098543e2ec8b6b43fa155adfea2182 by Eric Pouech <[email protected]>

[WINESYNC] rpcrt4/tests: Avoid "misleading indentation" warnings.

Signed-off-by: Fabian Maurer <[email protected]>
Signed-off-by: Huw Davies <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 0d7f7bec9d1387f916b32895fcc6dd82733245a2 by Fabian Maurer <[email protected]>

[WINESYNC]: rpcrt4 is now in sync with wine-staging wine-7.0

[WINESYNC] rpcrt4: Fix TowerConstruct spec file entry.

Signed-off-by: André Zwing <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 70ec0c8ccf6e5ab271dd9ce99c6ef7b4beae041e by André Zwing <[email protected]>

[WINESYNC] rpcrt4/tests: Use the correct scanf format for a handle.

Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 8e0b337df1fe64b4a0d27e9cded611faff61c29d by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Use the standard va_list instead of __ms_va_list.

Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 348336b8cd6fe9f62bbf0886dbc70cbc59601afa by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4/tests: Always run tests that don't require special permissions.

Signed-off-by: Nikolay Sivov <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 54f9b3347612cbf368e28fd53bef298819082d64 by Nikolay Sivov <[email protected]>

[WINESYNC] winecrt0: Determine the registration module handle directly in __wine_register_resources().

Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 1331a8ea0fd4f19b80b3fd434c5e8b2a3b6e0fd4 by Alexandre Julliard <[email protected]>

[WINESYNC] winecrt0: Add a default implementation DllRegisterServer()/DllUnregisterServer().

Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 5d82baf9747b7b133cad3be77c0cc9e24cc09582 by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Avoid gai_strerror().

It's not thread-safe.

Signed-off-by: Zebediah Figura <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id be101103dbee37d0b382032c2a8bc1d53f333a65 by Zebediah Figura <[email protected]>

[WINESYNC] rpcrt4: Make inline asm compatible with Thumb-2.

Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 621c06a082a5507885f2c98815f411718415a53b by Alexandre Julliard <[email protected]>

[WINESYNC]: rpcrt4 is now in sync with wine-staging wine-6.0

[WINESYNC] winapi: Use __alignof__ on clang.

Signed-off-by: Jacek Caban <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id fcf545f449e286118c0d1b8ee8d620a81aa22114 by Jacek Caban <[email protected]>

[WINESYNC] rpcrt4/tests: Avoid a printf format warning.

Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id b61cfa88235d77cee4878837afd9f65d025e4a3f by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Use wide-char string literals.

Signed-off-by: Michael Stefaniuc <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id d452c7574ffc9fef983980f09fd57c5ad04910a3 by Michael Stefaniuc <[email protected]>

[WINESYNC] rpcrt4: Fix ARM64 stack corruption in call_server_func.

calls with stack_size > 16 pop argument values into x3, overwriting
the number of 16-byte stack octwords. This breaks the checks for popping
x4..x7 and potentially unbalances sp (based on the vaue of args[16..23]).

Use a scratch register (x9) for this count so its lifetime does not
conflict with preparing the parameter/result registers.

Signed-off-by: Kevin Puetz <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id e4e7be6bd9e8a70329f5ceb4f6d66f50e3170ae2 by Kevin Puetz <[email protected]>

[WINESYNC] winapi_test: Update generated.c files.

Signed-off-by: Serge Gautherie <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 743ed29af51f2dfa3afbe97e94b95fe71cea0de5 by Serge Gautherie <[email protected]>

[WINESYNC] winapi_test: Restore horizontal alignment of macro defines.

Signed-off-by: Serge Gautherie <[email protected]>
Signed-off-by: Francois Gouget <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 99c0ab2ea1f912ee699e307a77f26822dfef7b06 by Serge Gautherie <[email protected]>

[WINESYNC] winapi_test: Remove MIDL_STUB_MESSAGE field exclusions.

Signed-off-by: Serge Gautherie <[email protected]>
Signed-off-by: Francois Gouget <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 151af8c04249bdd90e095c456e45ef416fcbfe97 by Serge Gautherie <[email protected]>

[WINESYNC] rpcrt4/tests: Add some tests for marshalling embedded conformant arrays.

Signed-off-by: Dmitry Timoshkov <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 59c0dbb642e788a8d28c2b653545566db6346cdb by Dmitry Timoshkov <[email protected]>

[WINESYNC] rpcrt4/tests: Fix compilation with MS VC.

Signed-off-by: Dmitry Timoshkov <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id bd995ea87100a167b021c142d63d569b336be00e by Dmitry Timoshkov <[email protected]>

[WINESYNC] rpcrt4: Implement RpcIfInqId().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49257
Signed-off-by: Zhiyi Zhang <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id d3a934be367e6b7bf7ba2ad127279fa8fc930fc4 by Zhiyi Zhang <[email protected]>

[WINESYNC] rpcndr.h: Avoid error_status_t redefinition.

Signed-off-by: Jacek Caban <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 4444d19ee37cfc20504dae2ea807458367410544 by Jacek Caban <[email protected]>

[WINESYNC] include: Get rid of Mac support in RPC headers.

Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 7bafeef595a50d1d90dfb42371144c4f285ac5c4 by Alexandre Julliard <[email protected]>

[WINESYNC] rpcrt4: Remove inexistent CreateServerInterfaceFromStub().

Signed-off-by: Serge Gautherie <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 98eaef3ad945eae570f92184725115613f6a3951 by Serge Gautherie <[email protected]>

[WINESYNC] rpcrt4: Don't use GetExceptionCode outside __except block.

Signed-off-by: Jacek Caban <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 7b0830c98d1af50e4a6199f83c3c412aaedccb33 by Jacek Caban <[email protected]>

[WINESYNC] rpcrt4: Bump the maximum accepted NDR version.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45699
Signed-off-by: Zebediah Figura <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 352a64cbbcee46eae0bca6184a8dd5db2d1da5fc by Zebediah Figura <[email protected]>

[WINESYNC] rpcrt4: Implement Ndr64AsyncClientCall().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45699
Signed-off-by: Zebediah Figura <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 36c5adca377dada3e86a765e4ba5b2fdb000eb19 by Zebediah Figura <[email protected]>

[WINESYNC] rpcrt4: Implement NdrClientCall3().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45699
Signed-off-by: Zebediah Figura <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 9369aea260e144f12d95c6b6386f095a58a031db by Zebediah Figura <[email protected]>

[WINESYNC] rpcrt4: Handle FC_NON_ENCAPSULATED_UNION in calc_arg_size().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45699
Signed-off-by: Zebediah Figura <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id ff7f92c0b076d7801274f2423dd44ddd10f895b1 by Zebediah Figura <[email protected]>

[WINESYNC] rpcrt4: Fix use after free in get_iface_info.

Signed-off-by: Jacek Caban <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id bfab009e67338d3f6b0142c55ec3383a5147f6a3 by Jacek Caban <[email protected]>

[WINESYNC] rpcrt4: Handle bare coclasses as top-level parameters.

Signed-off-by: Zebediah Figura <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 15e91ac2ce2d5d5f1a86a300552f921df838e792 by Zebediah Figura <[email protected]>

[WINESYNC] rpcrt4: Handle bare interfaces as top-level parameters.

Signed-off-by: Zebediah Figura <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id f4ee83c0ebf7d84ac46c9eac7f9c2eed07a32b3b by Zebediah Figura <[email protected]>

[WINESYNC] tests: Report all errors when failing to wait for a child process.

Report the line number where the test failed to wait for the child so
one can identify which child process did not behave as expected.
Also wait_child_process() is meant for the general case so report
all non-crash error cases as test failures so they are accounted for.
Omit the "winetest_" prefix to match the other Wine test functions and
so the underlying winetest_wait_child_process() function can be wrapped
with the usual line-capturing macros.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48651
Signed-off-by: Francois Gouget <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id a909baeb4e5ee8050a32832c28ff3ee79c54fbfa by Francois Gouget <[email protected]>

[WINESYNC] rpcrt4/tests: Remove now useless forced 0x0500 API versions.

Signed-off-by: Serge Gautherie <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 57f08ba5259e56ae681bab1e61f86d6e8ab96f37 by Serge Gautherie <[email protected]>

[WINESYNC] tools: Remove 0x0501 API versions forced by winapi_test.

Signed-off-by: Serge Gautherie <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id aa384d36429110970aa72acbc5043158de6aff03 by Serge Gautherie <[email protected]>

[WINESYNC] winecrt0: Make __wine_(un)register_resources() cdecl.

This fixes a bug where 64-bit winegstreamer.dll would fail to (un)register
CLSID_VideoProcessorMFT when run manually with regsvr32.

Signed-off-by: Zebediah Figura <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 5c414922b4ae04a34a90afebaf5177682b6826aa by Elizabeth Figura <[email protected]>

[WINESYNC] guiddef.h: Remove GUID_NULL declaration.

It's declared in cguid.h with proper extern "C".

Signed-off-by: Jacek Caban <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id c041605b0074e6b12e5ea1df0cc645e772a220a7 by Jacek Caban <[email protected]>

[WINESYNC] rpcrt4: Use MustFree for all non-base types in get_param_pointer_info.

Fixes a leak for VT_VARIANT.

Signed-off-by: Jacek Caban <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 1980fcafe111c5e6958bc01b121cfbd0a42a5abd by Jacek Caban <[email protected]>

[WINESYNC] rpcrt4: Use a critical section for the context handle lock.

Signed-off-by: Zebediah Figura <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 76238898fc4ef41b6eb57c5e2589a7579ee6e3c6 by Zebediah Figura <[email protected]>

[WINESYNC] rpcrt4: Fix ITypeInfo leak in get_iface_info.

Signed-off-by: Jacek Caban <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id a09c08f17a1ace1205e4c579c4f08b548258d539 by Kevin Puetz <[email protected]>

[WINESYNC]: rpcrt4 is now in sync with wine-staging wine-5.0

[WINESYNC] rpcrt4/tests: Pass the default maximum call limit to RpcServerListen().

The tests intermittently crash on 2008 with RPC_S_SERVER_TOO_BUSY.  I suspect
this is due to the server spawned in run_server having a call limit of 20 but
being expected to service 32 threads.  Use the default parameter in an attempt
to prevent this failure.

Signed-off-by: Zebediah Figura <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id c2b4d98f23f5007ad7da2083afd78ec411155a5f by Zebediah Figura <[email protected]>

[WINESYNC] rpcrt4: Support VT_BSTR in get_param_pointer_info.

Fixes a leak in typelib marshaller.
Based on patch by Kevin Puetz.

Signed-off-by: Jacek Caban <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id f64832fe6a4bb330d42f44b51cd5addb1f521291 by Jacek Caban <[email protected]>

[WINESYNC] rpcrt4: Fix implicit in attribute handling in write_param_fs.

Fixes regression caused by typelib marshaling rewrite.
Spotted by Kevin Puetz.

Signed-off-by: Jacek Caban <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 1aaf870039dfb8419ae060d8c67240df1366b953 by Jacek Caban <[email protected]>

[WINESYNC] rpcrt4: Fix ITypeInfo ref count handling.

Signed-off-by: Zebediah Figura <[email protected]>
Signed-off-by: Jacek Caban <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 53efccdb6589b2fbe8370d2216d1652bf53b984b by Zebediah Figura <[email protected]>

[WINESYNC] rpcrt4: Fix RpcNetworkIsProtseqValid[AW] spec file entries.

Signed-off-by: André Hentschel <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 6127c688eaa68b6adcc06f44bf41cb6f0c608d77 by André Hentschel <[email protected]>

[WINESYNC] rpcrt4/tests: Increase some timeouts.

These are too short when running under QEMU.

Signed-off-by: Alexandre Julliard <[email protected]>

wine commit id 822e2773d45544e3972c3d0e9dd60a6598d7a84f by Alexandre Julliard <[email protected]>

Add rpcrt4.cfg

[PSDK] Sync some rpc headers with wine-4.0

[RPCRT4] rpcrt4.spec: Add RpcExceptionFilter export

[RPCRT4] Reduce diff to wine-4.18

[RPCRT4] rpcrt4.spec: ordinals -> @

+rpcsal.h

WIP sync rpcndr.h with Wine

Update ndr_typelib.c
This commit is contained in:
Timo Kreuzer
2025-11-14 13:15:16 +02:00
parent 8608467b84
commit 7f1075986f
63 changed files with 5040 additions and 3465 deletions
+2 -1
View File
@@ -524,7 +524,7 @@
@ stub -version=0x600+ GetNamedPipeAttribute
@ stub -version=0x600+ GetNamedPipeClientComputerNameA
@ stub -version=0x600+ GetNamedPipeClientComputerNameW
@ stub -version=0x600+ GetNamedPipeClientProcessId
@ stdcall -version=0x600+ GetNamedPipeClientProcessId(ptr ptr)
@ stub -version=0x600+ GetNamedPipeClientSessionId
@ stdcall GetNamedPipeHandleStateA(long ptr ptr ptr ptr str long)
@ stdcall GetNamedPipeHandleStateW(long ptr ptr ptr ptr wstr long)
@@ -1104,6 +1104,7 @@
@ stdcall SetTermsrvAppInstallMode(long)
@ stdcall SetThreadAffinityMask(long long)
@ stdcall SetThreadContext(long ptr)
@ stdcall -version=0xA00+ SetThreadDescription(ptr wstr)
@ stdcall -stub -version=0x600+ SetThreadErrorMode(long ptr)
@ stdcall SetThreadExecutionState(long)
@ stdcall SetThreadIdealProcessor(long long)
@@ -12,12 +12,14 @@ list(APPEND SOURCE
GetLocaleInfoEx.c
GetFileInformationByHandleEx.c
GetFinalPathNameByHandle.c
GetNamedPipeClientProcessId.c
GetTickCount64.c
GetUserDefaultLocaleName.c
InitOnce.c
IsValidLocaleName.c
LCIDToLocaleName.c
LocaleNameToLCID.c
SetThreadDescription.c
sync.c
vista.c)
@@ -0,0 +1,22 @@
#include "k32_vista.h"
#define FSCTL_PIPE_GET_CONNECTION_ATTRIBUTE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 12, METHOD_BUFFERED, FILE_ANY_ACCESS)
static inline BOOL set_ntstatus( NTSTATUS status )
{
if (status) SetLastError( RtlNtStatusToDosError( status ));
return !status;
}
/***********************************************************************
* GetNamedPipeClientProcessId (KERNEL32.@)
*/
BOOL WINAPI GetNamedPipeClientProcessId( HANDLE pipe, ULONG *id )
{
IO_STATUS_BLOCK iosb;
return set_ntstatus( NtFsControlFile( pipe, NULL, NULL, NULL, &iosb,
FSCTL_PIPE_GET_CONNECTION_ATTRIBUTE, (void *)"ClientProcessId",
sizeof("ClientProcessId"), id, sizeof(*id) ));
}
@@ -0,0 +1,28 @@
#include "k32_vista.h"
#define NDEBUG
#include <debug.h>
#undef TRACE
#define TRACE DPRINT
/***********************************************************************
* SetThreadDescription (kernelbase.@)
*/
HRESULT WINAPI DECLSPEC_HOTPATCH SetThreadDescription( HANDLE thread, PCWSTR description )
{
THREAD_NAME_INFORMATION info;
int length;
TRACE( "(%p, %s)\n", thread, debugstr_w( description ));
length = description ? lstrlenW( description ) * sizeof(WCHAR) : 0;
if (length > USHRT_MAX)
return HRESULT_FROM_NT(STATUS_INVALID_PARAMETER);
info.ThreadName.Length = info.ThreadName.MaximumLength = length;
info.ThreadName.Buffer = (WCHAR *)description;
return HRESULT_FROM_NT(NtSetInformationThread( thread, ThreadNameInformation, &info, sizeof(info) ));
}
@@ -56,3 +56,6 @@
@ stdcall RegisterApplicationRestart(wstr long)
@ stdcall SetFileBandwidthReservation(ptr long long long ptr ptr)
@ stdcall SetThreadPreferredUILanguages(long wstr ptr)
@ stdcall GetNamedPipeClientProcessId(ptr ptr)
@ stdcall SetThreadDescription(ptr wstr) # Win 10
+6 -3
View File
@@ -28,6 +28,7 @@ list(APPEND SOURCE
ndr_marshall.c
ndr_ole.c
ndr_stubless.c
ros_extra.c
rpc_assoc.c
rpc_async.c
rpc_binding.c
@@ -36,15 +37,17 @@ list(APPEND SOURCE
rpcrt4_main.c
rpc_server.c
rpc_transport.c
thunks.c
unix_func.c
${CMAKE_CURRENT_BINARY_DIR}/epm_c.c)
if(MSVC)
add_asm_files(rpcrt4_asm msvc.S)
add_asm_files(rpcrt4_asm msvc.S thunks-msvc.s)
endif()
list(APPEND PCH_SKIP_SOURCE
ndr_typelib.c
thunks.c
${CMAKE_CURRENT_BINARY_DIR}/ndr_types_p.c
${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c
${CMAKE_CURRENT_BINARY_DIR}/rpcrt4_stubs.c)
@@ -62,8 +65,8 @@ if(MSVC)
endif()
set_module_type(rpcrt4 win32dll)
target_link_libraries(rpcrt4 wine uuid ${PSEH_LIB} oldnames)
add_delay_importlibs(rpcrt4 iphlpapi wininet secur32 user32 oleaut32)
target_link_libraries(rpcrt4 wine wine_dll_register uuid ${PSEH_LIB} oldnames)
add_delay_importlibs(rpcrt4 iphlpapi wininet secur32 user32 ole32 oleaut32)
add_importlibs(rpcrt4 advapi32 advapi32_vista kernel32_vista ws2_32 msvcrt kernel32 ntdll)
add_dependencies(rpcrt4 ndr_types_header)
add_pch(rpcrt4 precomp.h "${PCH_SKIP_SOURCE}")
+21 -248
View File
@@ -50,255 +50,23 @@ static inline StdProxyImpl *impl_from_proxy_obj( void *iface )
return CONTAINING_RECORD(iface, StdProxyImpl, PVtbl);
}
#ifdef __i386__
extern void call_stubless_func(void);
__ASM_GLOBAL_FUNC(call_stubless_func,
"movl 4(%esp),%ecx\n\t" /* This pointer */
"movl (%ecx),%ecx\n\t" /* This->lpVtbl */
"movl -8(%ecx),%ecx\n\t" /* MIDL_STUBLESS_PROXY_INFO */
"movl 8(%ecx),%edx\n\t" /* info->FormatStringOffset */
"movzwl (%edx,%eax,2),%edx\n\t" /* FormatStringOffset[index] */
"addl 4(%ecx),%edx\n\t" /* info->ProcFormatString + offset */
"movzbl 1(%edx),%eax\n\t" /* Oi_flags */
"andl $0x08,%eax\n\t" /* Oi_HAS_RPCFLAGS */
"shrl $1,%eax\n\t"
"movzwl 4(%edx,%eax),%eax\n\t" /* arguments size */
"pushl %eax\n\t"
__ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
"leal 8(%esp),%eax\n\t" /* &This */
"pushl %eax\n\t"
__ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
"pushl %edx\n\t" /* format string */
__ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
"pushl (%ecx)\n\t" /* info->pStubDesc */
__ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
"call " __ASM_NAME("ndr_client_call") "\n\t"
"leal 12(%esp),%esp\n\t"
__ASM_CFI(".cfi_adjust_cfa_offset -12\n\t")
"popl %edx\n\t" /* arguments size */
__ASM_CFI(".cfi_adjust_cfa_offset -4\n\t")
"movl (%esp),%ecx\n\t" /* return address */
"addl %edx,%esp\n\t"
"jmp *%ecx" );
#include "pshpack1.h"
struct thunk
{
BYTE mov_eax;
DWORD index;
BYTE jmp;
LONG handler;
};
#include "poppack.h"
static inline void init_thunk( struct thunk *thunk, unsigned int index )
{
thunk->mov_eax = 0xb8; /* movl $n,%eax */
thunk->index = index;
thunk->jmp = 0xe9; /* jmp */
thunk->handler = (char *)call_stubless_func - (char *)(&thunk->handler + 1);
}
#elif defined(__x86_64__)
extern void call_stubless_func(void);
__ASM_GLOBAL_FUNC(call_stubless_func,
"subq $0x38,%rsp\n\t"
__ASM_SEH(".seh_stackalloc 0x38\n\t")
__ASM_SEH(".seh_endprologue\n\t")
__ASM_CFI(".cfi_adjust_cfa_offset 0x38\n\t")
"movq %rcx,0x40(%rsp)\n\t"
"movq %rdx,0x48(%rsp)\n\t"
"movq %r8,0x50(%rsp)\n\t"
"movq %r9,0x58(%rsp)\n\t"
"leaq 0x40(%rsp),%r8\n\t" /* &This */
"movq (%rcx),%rcx\n\t" /* This->lpVtbl */
"movq -0x10(%rcx),%rcx\n\t" /* MIDL_STUBLESS_PROXY_INFO */
"movq 0x10(%rcx),%rdx\n\t" /* info->FormatStringOffset */
"movzwq (%rdx,%r10,2),%rdx\n\t" /* FormatStringOffset[index] */
"addq 8(%rcx),%rdx\n\t" /* info->ProcFormatString + offset */
"movq (%rcx),%rcx\n\t" /* info->pStubDesc */
"movq %xmm1,0x20(%rsp)\n\t"
"movq %xmm2,0x28(%rsp)\n\t"
"movq %xmm3,0x30(%rsp)\n\t"
"leaq 0x18(%rsp),%r9\n\t" /* fpu_args */
"call " __ASM_NAME("ndr_client_call") "\n\t"
"addq $0x38,%rsp\n\t"
__ASM_CFI(".cfi_adjust_cfa_offset -0x38\n\t")
"ret" );
#include "pshpack1.h"
struct thunk
{
BYTE mov_r10[3];
DWORD index;
BYTE mov_rax[2];
void *call_stubless;
BYTE jmp_rax[2];
};
#include "poppack.h"
static const struct thunk thunk_template =
{
{ 0x49, 0xc7, 0xc2 }, 0, /* movq $index,%r10 */
{ 0x48, 0xb8 }, 0, /* movq $call_stubless_func,%rax */
{ 0xff, 0xe0 } /* jmp *%rax */
};
static inline void init_thunk( struct thunk *thunk, unsigned int index )
{
*thunk = thunk_template;
thunk->index = index;
thunk->call_stubless = call_stubless_func;
}
#elif defined(__arm__)
extern void call_stubless_func(void);
__ASM_GLOBAL_FUNC(call_stubless_func,
"push {r0-r3}\n\t"
"mov r2, sp\n\t" /* stack_top */
"push {fp,lr}\n\t"
"mov fp, sp\n\t"
"ldr r0, [r0]\n\t" /* This->lpVtbl */
"ldr r0, [r0,#-8]\n\t" /* MIDL_STUBLESS_PROXY_INFO */
"ldr r1, [r0,#8]\n\t" /* info->FormatStringOffset */
"ldrh r1, [r1,ip]\n\t" /* info->FormatStringOffset[index] */
"ldr ip, [r0,#4]\n\t" /* info->ProcFormatString */
"add r1, ip\n\t" /* info->ProcFormatString + offset */
"ldr r0, [r0]\n\t" /* info->pStubDesc */
#ifdef __SOFTFP__
"mov r3, #0\n\t"
#else
"vpush {s0-s15}\n\t" /* store the s0-s15/d0-d7 arguments */
"mov r3, sp\n\t" /* fpu_stack */
#endif
"bl " __ASM_NAME("ndr_client_call") "\n\t"
"mov sp, fp\n\t"
"pop {fp,lr}\n\t"
"add sp, #16\n\t"
"bx lr" );
struct thunk
{
DWORD ldr_ip; /* ldr ip,[pc] */
DWORD ldr_pc; /* ldr pc,[pc] */
DWORD index;
void *func;
};
static inline void init_thunk( struct thunk *thunk, unsigned int index )
{
thunk->ldr_ip = 0xe59fc000; /* ldr ip,[pc] */
thunk->ldr_pc = 0xe59ff000; /* ldr pc,[pc] */
thunk->index = index * sizeof(unsigned short);
thunk->func = call_stubless_func;
}
#elif defined(__aarch64__)
extern void call_stubless_func(void);
__ASM_GLOBAL_FUNC( call_stubless_func,
"stp x29, x30, [sp, #-0x90]!\n\t"
"mov x29, sp\n\t"
"stp d0, d1, [sp, #0x10]\n\t"
"stp d2, d3, [sp, #0x20]\n\t"
"stp d4, d5, [sp, #0x30]\n\t"
"stp d6, d7, [sp, #0x40]\n\t"
"stp x0, x1, [sp, #0x50]\n\t"
"stp x2, x3, [sp, #0x60]\n\t"
"stp x4, x5, [sp, #0x70]\n\t"
"stp x6, x7, [sp, #0x80]\n\t"
"ldr x0, [x0]\n\t" /* This->lpVtbl */
"ldr x0, [x0, #-16]\n\t" /* MIDL_STUBLESS_PROXY_INFO */
"ldp x1, x4, [x0, #8]\n\t" /* info->ProcFormatString, FormatStringOffset */
"ldrh w4, [x4, x16, lsl #1]\n\t" /* info->FormatStringOffset[index] */
"add x1, x1, x4\n\t" /* info->ProcFormatString + offset */
"ldr x0, [x0]\n\t" /* info->pStubDesc */
"add x2, sp, #0x50\n\t" /* stack */
"add x3, sp, #0x10\n\t" /* fpu_stack */
"bl " __ASM_NAME("ndr_client_call") "\n\t"
"ldp x29, x30, [sp], #0x90\n\t"
"ret" )
struct thunk
{
DWORD ldr_index; /* ldr w16, index */
DWORD ldr_func; /* ldr x17, func */
DWORD br; /* br x17 */
DWORD index;
void *func;
};
static inline void init_thunk( struct thunk *thunk, unsigned int index )
{
thunk->ldr_index = 0x18000070; /* ldr w16,index */
thunk->ldr_func = 0x58000071; /* ldr x17,func */
thunk->br = 0xd61f0220; /* br x17 */
thunk->index = index;
thunk->func = call_stubless_func;
}
#else /* __i386__ */
#warning You must implement stubless proxies for your CPU
struct thunk
{
DWORD index;
};
static inline void init_thunk( struct thunk *thunk, unsigned int index )
{
thunk->index = index;
}
#endif /* __i386__ */
#define BLOCK_SIZE 1024
#define MAX_BLOCKS 64 /* 64k methods should be enough for anybody */
static const struct thunk *method_blocks[MAX_BLOCKS];
static const struct thunk *allocate_block( unsigned int num )
{
unsigned int i;
struct thunk *prev, *block;
DWORD oldprot;
block = VirtualAlloc( NULL, BLOCK_SIZE * sizeof(*block),
MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE );
if (!block) return NULL;
for (i = 0; i < BLOCK_SIZE; i++) init_thunk( &block[i], BLOCK_SIZE * num + i + 3 );
VirtualProtect( block, BLOCK_SIZE * sizeof(*block), PAGE_EXECUTE_READ, &oldprot );
prev = InterlockedCompareExchangePointer( (void **)&method_blocks[num], block, NULL );
if (prev) /* someone beat us to it */
{
VirtualFree( block, 0, MEM_RELEASE );
block = prev;
}
return block;
}
extern void ObjectStublessClient3(void);
extern void ObjectStublessClient4(void);
BOOL fill_stubless_table( IUnknownVtbl *vtbl, DWORD num )
{
size_t entry_size = (char *)ObjectStublessClient4 - (char *)ObjectStublessClient3;
const void **entry = (const void **)(vtbl + 1);
DWORD i, j;
DWORD i;
if (num - 3 > BLOCK_SIZE * MAX_BLOCKS)
if (num >= NB_THUNK_ENTRIES)
{
FIXME( "%u methods not supported\n", num );
FIXME( "%lu methods not supported\n", num );
return FALSE;
}
for (i = 0; i < (num - 3 + BLOCK_SIZE - 1) / BLOCK_SIZE; i++)
{
const struct thunk *block = method_blocks[i];
if (!block && !(block = allocate_block( i ))) return FALSE;
for (j = 0; j < BLOCK_SIZE && j < num - 3 - i * BLOCK_SIZE; j++, entry++)
if (*entry == (LPVOID)-1) *entry = &block[j];
}
for (i = 0; i < num - 3; i++, entry++)
if (*entry == (void *)-1) *entry = (char *)ObjectStublessClient3 + i * entry_size;
return TRUE;
}
@@ -320,7 +88,7 @@ HRESULT StdProxy_Construct(REFIID riid,
if (ProxyInfo->TableVersion > 1) {
ULONG count = ProxyInfo->pStubVtblList[Index]->header.DispatchTableCount;
vtbl = (CInterfaceProxyVtbl *)((const void **)vtbl + 1);
TRACE("stubless vtbl %p: count=%d\n", vtbl->Vtbl, count );
TRACE("stubless vtbl %p: count=%ld\n", vtbl->Vtbl, count );
fill_stubless_table( (IUnknownVtbl *)vtbl->Vtbl, count );
}
@@ -329,10 +97,10 @@ HRESULT StdProxy_Construct(REFIID riid,
return RPC_E_UNEXPECTED;
}
This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(StdProxyImpl));
This = calloc(1, sizeof(StdProxyImpl));
if (!This) return E_OUTOFMEMORY;
if (!pUnkOuter) pUnkOuter = (IUnknown *)This;
if (!pUnkOuter) pUnkOuter = (IUnknown *)&This->IRpcProxyBuffer_iface;
This->IRpcProxyBuffer_iface.lpVtbl = &StdProxy_Vtbl;
This->PVtbl = vtbl->Vtbl;
/* one reference for the proxy */
@@ -351,7 +119,7 @@ HRESULT StdProxy_Construct(REFIID riid,
&This->base_proxy, (void **)&This->base_object );
if (FAILED(r))
{
HeapFree( GetProcessHeap(), 0, This );
free( This );
return r;
}
}
@@ -411,7 +179,7 @@ static ULONG WINAPI StdProxy_Release(LPRPCPROXYBUFFER iface)
if (This->base_proxy) IRpcProxyBuffer_Release( This->base_proxy );
IPSFactoryBuffer_Release(This->pPSFactory);
HeapFree(GetProcessHeap(),0,This);
free(This);
}
return refs;
@@ -454,6 +222,9 @@ static void StdProxy_GetChannel(LPVOID iface,
StdProxyImpl *This = impl_from_proxy_obj( iface );
TRACE("(%p)->GetChannel(%p) %s\n",This,ppChannel,This->name);
if(This->pChannel)
IRpcChannelBuffer_AddRef(This->pChannel);
*ppChannel = This->pChannel;
}
@@ -583,8 +354,10 @@ void WINAPI NdrProxyFreeBuffer(void *This,
{
IRpcChannelBuffer_FreeBuffer(pStubMsg->pRpcChannelBuffer,
(RPCOLEMESSAGE*)pStubMsg->RpcMsg);
pStubMsg->fBufferValid = TRUE;
pStubMsg->fBufferValid = FALSE;
}
IRpcChannelBuffer_Release(pStubMsg->pRpcChannelBuffer);
pStubMsg->pRpcChannelBuffer = NULL;
}
/***********************************************************************
@@ -592,7 +365,7 @@ void WINAPI NdrProxyFreeBuffer(void *This,
*/
HRESULT WINAPI NdrProxyErrorHandler(DWORD dwExceptionCode)
{
WARN("(0x%08x): a proxy call failed\n", dwExceptionCode);
WARN("(0x%08lx): a proxy call failed\n", dwExceptionCode);
if (FAILED(dwExceptionCode))
return dwExceptionCode;
+12 -26
View File
@@ -41,11 +41,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
static void format_clsid( WCHAR *buffer, const CLSID *clsid )
{
static const WCHAR clsid_formatW[] = {'{','%','0','8','X','-','%','0','4','X','-','%','0','4','X','-',
'%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X',
'%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X','}',0};
swprintf( buffer, clsid_formatW, clsid->Data1, clsid->Data2, clsid->Data3,
swprintf( buffer, L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
clsid->Data1, clsid->Data2, clsid->Data3,
clsid->Data4[0], clsid->Data4[1], clsid->Data4[2], clsid->Data4[3],
clsid->Data4[4], clsid->Data4[5], clsid->Data4[6], clsid->Data4[7] );
@@ -222,15 +219,6 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
const ProxyFileInfo **pProxyFileList,
const CLSID *pclsid)
{
static const WCHAR bothW[] = {'B','o','t','h',0};
static const WCHAR clsidW[] = {'C','L','S','I','D','\\',0};
static const WCHAR clsid32W[] = {'P','r','o','x','y','S','t','u','b','C','l','s','i','d','3','2',0};
static const WCHAR interfaceW[] = {'I','n','t','e','r','f','a','c','e','\\',0};
static const WCHAR psfactoryW[] = {'P','S','F','a','c','t','o','r','y','B','u','f','f','e','r',0};
static const WCHAR numformatW[] = {'%','u',0};
static const WCHAR nummethodsW[] = {'N','u','m','M','e','t','h','o','d','s',0};
static const WCHAR inprocserverW[] = {'I','n','P','r','o','c','S','e','r','v','e','r','3','2',0};
static const WCHAR threadingmodelW[] = {'T','h','r','e','a','d','i','n','g','M','o','d','e','l',0};
WCHAR clsid[39], keyname[50], module[MAX_PATH];
HKEY key, subkey;
DWORD len;
@@ -257,15 +245,15 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
TRACE("registering %s %s => %s\n",
debugstr_a(name), debugstr_guid(proxy->header.piid), debugstr_w(clsid));
lstrcpyW( keyname, interfaceW );
lstrcpyW( keyname, L"Interface\\" );
format_clsid( keyname + lstrlenW(keyname), proxy->header.piid );
if (RegCreateKeyW(HKEY_CLASSES_ROOT, keyname, &key) == ERROR_SUCCESS) {
WCHAR num[10];
if (name)
RegSetValueExA(key, NULL, 0, REG_SZ, (const BYTE *)name, strlen(name)+1);
RegSetValueW( key, clsid32W, REG_SZ, clsid, 0 );
swprintf(num, numformatW, proxy->header.DispatchTableCount);
RegSetValueW( key, nummethodsW, REG_SZ, num, 0 );
RegSetValueW( key, L"ProxyStubClsid32", REG_SZ, clsid, 0 );
swprintf(num, L"%u", proxy->header.DispatchTableCount);
RegSetValueW( key, L"NumMethods", REG_SZ, num, 0 );
RegCloseKey(key);
}
}
@@ -273,16 +261,16 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
}
/* register clsid to point to module */
lstrcpyW( keyname, clsidW );
lstrcpyW( keyname, L"CLSID\\" );
lstrcatW( keyname, clsid );
len = GetModuleFileNameW(hDll, module, ARRAY_SIZE(module));
if (len && len < sizeof(module)) {
TRACE("registering CLSID %s => %s\n", debugstr_w(clsid), debugstr_w(module));
if (RegCreateKeyW(HKEY_CLASSES_ROOT, keyname, &key) == ERROR_SUCCESS) {
RegSetValueExW(key, NULL, 0, REG_SZ, (const BYTE *)psfactoryW, sizeof(psfactoryW));
if (RegCreateKeyW(key, inprocserverW, &subkey) == ERROR_SUCCESS) {
RegSetValueExW(key, NULL, 0, REG_SZ, (const BYTE *)L"PSFactoryBuffer", sizeof(L"PSFactoryBuffer"));
if (RegCreateKeyW(key, L"InProcServer32", &subkey) == ERROR_SUCCESS) {
RegSetValueExW(subkey, NULL, 0, REG_SZ, (LPBYTE)module, (lstrlenW(module)+1)*sizeof(WCHAR));
RegSetValueExW(subkey, threadingmodelW, 0, REG_SZ, (const BYTE *)bothW, sizeof(bothW));
RegSetValueExW(subkey, L"ThreadingModel", 0, REG_SZ, (const BYTE *)L"Both", sizeof(L"Both"));
RegCloseKey(subkey);
}
RegCloseKey(key);
@@ -299,8 +287,6 @@ HRESULT WINAPI NdrDllUnregisterProxy(HMODULE hDll,
const ProxyFileInfo **pProxyFileList,
const CLSID *pclsid)
{
static const WCHAR clsidW[] = {'C','L','S','I','D','\\',0};
static const WCHAR interfaceW[] = {'I','n','t','e','r','f','a','c','e','\\',0};
WCHAR keyname[50];
WCHAR clsid[39];
@@ -321,7 +307,7 @@ HRESULT WINAPI NdrDllUnregisterProxy(HMODULE hDll,
TRACE("unregistering %s %s\n", debugstr_a(name), debugstr_guid(proxy->header.piid));
lstrcpyW( keyname, interfaceW );
lstrcpyW( keyname, L"Interface\\" );
format_clsid( keyname + lstrlenW(keyname), proxy->header.piid );
RegDeleteTreeW(HKEY_CLASSES_ROOT, keyname);
}
@@ -329,7 +315,7 @@ HRESULT WINAPI NdrDllUnregisterProxy(HMODULE hDll,
}
/* unregister clsid */
lstrcpyW( keyname, clsidW );
lstrcpyW( keyname, L"CLSID\\" );
lstrcatW( keyname, clsid );
RegDeleteTreeW(HKEY_CLASSES_ROOT, keyname);
+26 -17
View File
@@ -39,37 +39,46 @@ typedef struct
typedef struct
{
IUnknownVtbl *base_obj;
IUnknown base_obj;
IRpcStubBuffer *base_stub;
CStdStubBuffer stub_buffer;
} cstdstubbuffer_delegating_t;
HRESULT StdProxy_Construct(REFIID riid, LPUNKNOWN pUnkOuter, const ProxyFileInfo *ProxyInfo,
int Index, LPPSFACTORYBUFFER pPSFactory, LPRPCPROXYBUFFER *ppProxy,
LPVOID *ppvObj) DECLSPEC_HIDDEN;
HRESULT WINAPI StdProxy_QueryInterface(IRpcProxyBuffer *iface, REFIID iid, void **obj) DECLSPEC_HIDDEN;
ULONG WINAPI StdProxy_AddRef(IRpcProxyBuffer *iface) DECLSPEC_HIDDEN;
HRESULT WINAPI StdProxy_Connect(IRpcProxyBuffer *iface, IRpcChannelBuffer *channel) DECLSPEC_HIDDEN;
void WINAPI StdProxy_Disconnect(IRpcProxyBuffer *iface) DECLSPEC_HIDDEN;
LPVOID *ppvObj);
HRESULT WINAPI StdProxy_QueryInterface(IRpcProxyBuffer *iface, REFIID iid, void **obj);
ULONG WINAPI StdProxy_AddRef(IRpcProxyBuffer *iface);
HRESULT WINAPI StdProxy_Connect(IRpcProxyBuffer *iface, IRpcChannelBuffer *channel);
void WINAPI StdProxy_Disconnect(IRpcProxyBuffer *iface);
HRESULT CStdStubBuffer_Construct(REFIID riid, LPUNKNOWN pUnkServer, PCInterfaceName name,
CInterfaceStubVtbl *vtbl, LPPSFACTORYBUFFER pPSFactory,
LPRPCSTUBBUFFER *ppStub) DECLSPEC_HIDDEN;
LPRPCSTUBBUFFER *ppStub);
HRESULT CStdStubBuffer_Delegating_Construct(REFIID riid, LPUNKNOWN pUnkServer, PCInterfaceName name,
CInterfaceStubVtbl *vtbl, REFIID delegating_iid,
LPPSFACTORYBUFFER pPSFactory, LPRPCSTUBBUFFER *ppStub) DECLSPEC_HIDDEN;
LPPSFACTORYBUFFER pPSFactory, LPRPCSTUBBUFFER *ppStub);
const MIDL_SERVER_INFO *CStdStubBuffer_GetServerInfo(IRpcStubBuffer *iface) DECLSPEC_HIDDEN;
const MIDL_SERVER_INFO *CStdStubBuffer_GetServerInfo(IRpcStubBuffer *iface);
extern const IRpcStubBufferVtbl CStdStubBuffer_Vtbl DECLSPEC_HIDDEN;
extern const IRpcStubBufferVtbl CStdStubBuffer_Delegating_Vtbl DECLSPEC_HIDDEN;
extern const IRpcStubBufferVtbl CStdStubBuffer_Vtbl;
extern const IRpcStubBufferVtbl CStdStubBuffer_Delegating_Vtbl;
BOOL fill_delegated_proxy_table(IUnknownVtbl *vtbl, DWORD num) DECLSPEC_HIDDEN;
HRESULT create_proxy(REFIID iid, IUnknown *pUnkOuter, IRpcProxyBuffer **pproxy, void **ppv) DECLSPEC_HIDDEN;
HRESULT create_stub(REFIID iid, IUnknown *pUnk, IRpcStubBuffer **ppstub) DECLSPEC_HIDDEN;
BOOL fill_stubless_table(IUnknownVtbl *vtbl, DWORD num) DECLSPEC_HIDDEN;
IUnknownVtbl *get_delegating_vtbl(DWORD num_methods) DECLSPEC_HIDDEN;
void release_delegating_vtbl(IUnknownVtbl *vtbl) DECLSPEC_HIDDEN;
BOOL fill_delegated_proxy_table(IUnknownVtbl *vtbl, DWORD num);
HRESULT create_proxy(REFIID iid, IUnknown *pUnkOuter, IRpcProxyBuffer **pproxy, void **ppv);
HRESULT create_stub(REFIID iid, IUnknown *pUnk, IRpcStubBuffer **ppstub);
BOOL fill_stubless_table(IUnknownVtbl *vtbl, DWORD num);
const IUnknownVtbl *get_delegating_vtbl(DWORD num_methods);
#define NB_THUNK_ENTRIES 1024
struct delegating_vtbl
{
IUnknownVtbl vtbl;
const void *methods[NB_THUNK_ENTRIES - 3];
};
extern const struct delegating_vtbl delegating_vtbl;
#endif /* __WINE_CPSF_H */
+57 -260
View File
@@ -32,14 +32,13 @@
#include "rpcproxy.h"
#include "wine/debug.h"
#include "wine/asm.h"
#include "wine/exception.h"
#include "cpsf.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole);
#define STUB_HEADER(This) (((const CInterfaceStubHeader*)((This)->lpVtbl))[-1])
static LONG WINAPI stub_filter(EXCEPTION_POINTERS *eptr)
{
if (eptr->ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE)
@@ -47,9 +46,21 @@ static LONG WINAPI stub_filter(EXCEPTION_POINTERS *eptr)
return EXCEPTION_EXECUTE_HANDLER;
}
static CStdStubBuffer *impl_from_IRpcStubBuffer(IRpcStubBuffer *iface)
{
return CONTAINING_RECORD(&iface->lpVtbl, CStdStubBuffer, lpVtbl);
}
static inline cstdstubbuffer_delegating_t *impl_from_delegating( IRpcStubBuffer *iface )
{
return CONTAINING_RECORD((void *)iface, cstdstubbuffer_delegating_t, stub_buffer);
return CONTAINING_RECORD(impl_from_IRpcStubBuffer(iface), cstdstubbuffer_delegating_t, stub_buffer);
}
static const CInterfaceStubHeader *get_stub_header(const CStdStubBuffer *stub)
{
const CInterfaceStubVtbl *vtbl = CONTAINING_RECORD(stub->lpVtbl, CInterfaceStubVtbl, Vtbl);
return &vtbl->header;
}
HRESULT CStdStubBuffer_Construct(REFIID riid,
@@ -75,7 +86,7 @@ HRESULT CStdStubBuffer_Construct(REFIID riid,
if(FAILED(r))
return r;
This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(CStdStubBuffer));
This = calloc(1, sizeof(CStdStubBuffer));
if (!This) {
IUnknown_Release(pvServer);
return E_OUTOFMEMORY;
@@ -91,250 +102,33 @@ HRESULT CStdStubBuffer_Construct(REFIID riid,
return S_OK;
}
static CRITICAL_SECTION delegating_vtbl_section;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &delegating_vtbl_section,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { (DWORD_PTR)(__FILE__ ": delegating_vtbl_section") }
};
static CRITICAL_SECTION delegating_vtbl_section = { &critsect_debug, -1, 0, 0, 0, 0 };
typedef struct
{
DWORD ref;
DWORD size;
IUnknownVtbl vtbl;
/* remaining entries in vtbl */
} ref_counted_vtbl;
static ref_counted_vtbl *current_vtbl;
static HRESULT WINAPI delegating_QueryInterface(IUnknown *pUnk, REFIID iid, void **ppv)
{
*ppv = pUnk;
return S_OK;
}
static ULONG WINAPI delegating_AddRef(IUnknown *pUnk)
{
return 1;
}
static ULONG WINAPI delegating_Release(IUnknown *pUnk)
{
return 1;
}
/* The idea here is to replace the first param on the stack
ie. This (which will point to cstdstubbuffer_delegating_t)
with This->stub_buffer.pvServerObject and then jump to the
relevant offset in This->stub_buffer.pvServerObject's vtbl.
*/
#ifdef __i386__
#include "pshpack1.h"
typedef struct {
BYTE mov1[4]; /* mov 0x4(%esp),%eax 8b 44 24 04 */
BYTE mov2[3]; /* mov 0x10(%eax),%eax 8b 40 10 */
BYTE mov3[4]; /* mov %eax,0x4(%esp) 89 44 24 04 */
BYTE mov4[2]; /* mov (%eax),%eax 8b 00 */
BYTE mov5[2]; /* jmp *offset(%eax) ff a0 offset */
DWORD offset;
BYTE pad[1]; /* nop 90 */
} vtbl_method_t;
#include "poppack.h"
static const BYTE opcodes[20] = { 0x8b, 0x44, 0x24, 0x04, 0x8b, 0x40, 0x10, 0x89, 0x44, 0x24, 0x04,
0x8b, 0x00, 0xff, 0xa0, 0, 0, 0, 0, 0x90 };
#elif defined(__x86_64__)
#include "pshpack1.h"
typedef struct
{
BYTE mov1[4]; /* movq 0x20(%rcx),%rcx 48 8b 49 20 */
BYTE mov2[3]; /* movq (%rcx),%rax 48 8b 01 */
BYTE jmp[2]; /* jmp *offset(%rax) ff a0 offset */
DWORD offset;
BYTE pad[3]; /* lea 0x0(%rsi),%rsi 48 8d 36 */
} vtbl_method_t;
#include "poppack.h"
static const BYTE opcodes[16] = { 0x48, 0x8b, 0x49, 0x20, 0x48, 0x8b, 0x01,
0xff, 0xa0, 0, 0, 0, 0, 0x48, 0x8d, 0x36 };
#elif defined(__arm__)
static const DWORD opcodes[] =
{
0xe52d4004, /* push {r4} */
0xe5900010, /* ldr r0, [r0, #16] */
0xe5904000, /* ldr r4, [r0] */
0xe59fc008, /* ldr ip, [pc, #8] */
0xe08cc004, /* add ip, ip, r4 */
0xe49d4004, /* pop {r4} */
0xe59cf000 /* ldr pc, [ip] */
};
typedef struct
{
DWORD opcodes[ARRAY_SIZE(opcodes)];
DWORD offset;
} vtbl_method_t;
#elif defined(__aarch64__)
static const DWORD opcodes[] =
{
0xf9401000, /* ldr x0, [x0,#32] */
0xf9400010, /* ldr x16, [x0] */
0x18000071, /* ldr w17, offset */
0xf8716a10, /* ldr x16, [x16,x17] */
0xd61f0200 /* br x16 */
};
typedef struct
{
DWORD opcodes[ARRAY_SIZE(opcodes)];
DWORD offset;
} vtbl_method_t;
#else
#warning You must implement delegated proxies/stubs for your CPU
typedef struct
{
DWORD offset;
} vtbl_method_t;
static const BYTE opcodes[1];
#endif
#define BLOCK_SIZE 1024
#define MAX_BLOCKS 64 /* 64k methods should be enough for anybody */
static const vtbl_method_t *method_blocks[MAX_BLOCKS];
static const vtbl_method_t *allocate_block( unsigned int num )
{
unsigned int i;
vtbl_method_t *prev, *block;
DWORD oldprot;
block = VirtualAlloc( NULL, BLOCK_SIZE * sizeof(*block),
MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE );
if (!block) return NULL;
for (i = 0; i < BLOCK_SIZE; i++)
{
memcpy( &block[i], opcodes, sizeof(opcodes) );
block[i].offset = (BLOCK_SIZE * num + i + 3) * sizeof(void *);
}
VirtualProtect( block, BLOCK_SIZE * sizeof(*block), PAGE_EXECUTE_READ, &oldprot );
prev = InterlockedCompareExchangePointer( (void **)&method_blocks[num], block, NULL );
if (prev) /* someone beat us to it */
{
VirtualFree( block, 0, MEM_RELEASE );
block = prev;
}
return block;
}
static BOOL fill_delegated_stub_table(IUnknownVtbl *vtbl, DWORD num)
{
const void **entry = (const void **)(vtbl + 1);
DWORD i, j;
if (num - 3 > BLOCK_SIZE * MAX_BLOCKS)
{
FIXME( "%u methods not supported\n", num );
return FALSE;
}
vtbl->QueryInterface = delegating_QueryInterface;
vtbl->AddRef = delegating_AddRef;
vtbl->Release = delegating_Release;
for (i = 0; i < (num - 3 + BLOCK_SIZE - 1) / BLOCK_SIZE; i++)
{
const vtbl_method_t *block = method_blocks[i];
if (!block && !(block = allocate_block( i ))) return FALSE;
for (j = 0; j < BLOCK_SIZE && j < num - 3 - i * BLOCK_SIZE; j++) *entry++ = &block[j];
}
return TRUE;
}
BOOL fill_delegated_proxy_table(IUnknownVtbl *vtbl, DWORD num)
{
const void **entry = (const void **)(vtbl + 1);
DWORD i, j;
DWORD i;
if (num - 3 > BLOCK_SIZE * MAX_BLOCKS)
if (num > NB_THUNK_ENTRIES)
{
FIXME( "%u methods not supported\n", num );
FIXME( "%lu methods not supported\n", num );
return FALSE;
}
vtbl->QueryInterface = IUnknown_QueryInterface_Proxy;
vtbl->AddRef = IUnknown_AddRef_Proxy;
vtbl->Release = IUnknown_Release_Proxy;
for (i = 0; i < (num - 3 + BLOCK_SIZE - 1) / BLOCK_SIZE; i++)
{
const vtbl_method_t *block = method_blocks[i];
if (!block && !(block = allocate_block( i ))) return FALSE;
for (j = 0; j < BLOCK_SIZE && j < num - 3 - i * BLOCK_SIZE; j++, entry++)
if (!*entry) *entry = &block[j];
}
for (i = 0; i < num - 3; i++)
if (!entry[i]) entry[i] = delegating_vtbl.methods[i];
return TRUE;
}
IUnknownVtbl *get_delegating_vtbl(DWORD num_methods)
const IUnknownVtbl *get_delegating_vtbl(DWORD num)
{
IUnknownVtbl *ret;
if (num_methods < 256) num_methods = 256; /* avoid frequent reallocations */
EnterCriticalSection(&delegating_vtbl_section);
if(!current_vtbl || num_methods > current_vtbl->size)
if (num > NB_THUNK_ENTRIES)
{
ref_counted_vtbl *table = HeapAlloc(GetProcessHeap(), 0,
FIELD_OFFSET(ref_counted_vtbl, vtbl) + num_methods * sizeof(void*));
if (!table)
{
LeaveCriticalSection(&delegating_vtbl_section);
return NULL;
}
table->ref = 0;
table->size = num_methods;
fill_delegated_stub_table(&table->vtbl, num_methods);
if (current_vtbl && current_vtbl->ref == 0)
{
TRACE("freeing old table\n");
HeapFree(GetProcessHeap(), 0, current_vtbl);
}
current_vtbl = table;
FIXME( "%lu methods not supported\n", num );
return NULL;
}
current_vtbl->ref++;
ret = &current_vtbl->vtbl;
LeaveCriticalSection(&delegating_vtbl_section);
return ret;
}
void release_delegating_vtbl(IUnknownVtbl *vtbl)
{
ref_counted_vtbl *table = (ref_counted_vtbl*)((DWORD *)vtbl - 1);
EnterCriticalSection(&delegating_vtbl_section);
table->ref--;
TRACE("ref now %d\n", table->ref);
if(table->ref == 0 && table != current_vtbl)
{
TRACE("... and we're not current so free'ing\n");
HeapFree(GetProcessHeap(), 0, table);
}
LeaveCriticalSection(&delegating_vtbl_section);
return &delegating_vtbl.vtbl;
}
HRESULT CStdStubBuffer_Delegating_Construct(REFIID riid,
@@ -362,19 +156,18 @@ HRESULT CStdStubBuffer_Delegating_Construct(REFIID riid,
r = IUnknown_QueryInterface(pUnkServer, riid, (void**)&pvServer);
if(FAILED(r)) return r;
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This));
This = calloc(1, sizeof(*This));
if (!This)
{
IUnknown_Release(pvServer);
return E_OUTOFMEMORY;
}
This->base_obj = get_delegating_vtbl( vtbl->header.DispatchTableCount );
r = create_stub(delegating_iid, (IUnknown*)&This->base_obj, &This->base_stub);
This->base_obj.lpVtbl = get_delegating_vtbl( vtbl->header.DispatchTableCount );
r = create_stub(delegating_iid, &This->base_obj, &This->base_stub);
if(FAILED(r))
{
release_delegating_vtbl(This->base_obj);
HeapFree(GetProcessHeap(), 0, This);
free(This);
IUnknown_Release(pvServer);
return r;
}
@@ -393,7 +186,7 @@ HRESULT WINAPI CStdStubBuffer_QueryInterface(LPRPCSTUBBUFFER iface,
REFIID riid,
LPVOID *obj)
{
CStdStubBuffer *This = (CStdStubBuffer *)iface;
CStdStubBuffer *This = impl_from_IRpcStubBuffer(iface);
TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(riid),obj);
if (IsEqualIID(&IID_IUnknown, riid) ||
@@ -409,7 +202,7 @@ HRESULT WINAPI CStdStubBuffer_QueryInterface(LPRPCSTUBBUFFER iface,
ULONG WINAPI CStdStubBuffer_AddRef(LPRPCSTUBBUFFER iface)
{
CStdStubBuffer *This = (CStdStubBuffer *)iface;
CStdStubBuffer *This = impl_from_IRpcStubBuffer(iface);
TRACE("(%p)->AddRef()\n",This);
return InterlockedIncrement(&This->RefCount);
}
@@ -417,7 +210,7 @@ ULONG WINAPI CStdStubBuffer_AddRef(LPRPCSTUBBUFFER iface)
ULONG WINAPI NdrCStdStubBuffer_Release(LPRPCSTUBBUFFER iface,
LPPSFACTORYBUFFER pPSF)
{
CStdStubBuffer *This = (CStdStubBuffer *)iface;
CStdStubBuffer *This = impl_from_IRpcStubBuffer(iface);
ULONG refs;
TRACE("(%p)->Release()\n",This);
@@ -430,7 +223,7 @@ ULONG WINAPI NdrCStdStubBuffer_Release(LPRPCSTUBBUFFER iface,
IRpcStubBuffer_Disconnect(iface);
IPSFactoryBuffer_Release(pPSF);
HeapFree(GetProcessHeap(),0,This);
free(This);
}
return refs;
}
@@ -451,10 +244,8 @@ ULONG WINAPI NdrCStdStubBuffer2_Release(LPRPCSTUBBUFFER iface,
IRpcStubBuffer_Disconnect((IRpcStubBuffer *)&This->stub_buffer);
IRpcStubBuffer_Release(This->base_stub);
release_delegating_vtbl(This->base_obj);
IPSFactoryBuffer_Release(pPSF);
HeapFree(GetProcessHeap(), 0, This);
free(This);
}
return refs;
@@ -463,13 +254,13 @@ ULONG WINAPI NdrCStdStubBuffer2_Release(LPRPCSTUBBUFFER iface,
HRESULT WINAPI CStdStubBuffer_Connect(LPRPCSTUBBUFFER iface,
LPUNKNOWN lpUnkServer)
{
CStdStubBuffer *This = (CStdStubBuffer *)iface;
CStdStubBuffer *This = impl_from_IRpcStubBuffer(iface);
HRESULT r;
IUnknown *new = NULL;
TRACE("(%p)->Connect(%p)\n",This,lpUnkServer);
r = IUnknown_QueryInterface(lpUnkServer, STUB_HEADER(This).piid, (void**)&new);
r = IUnknown_QueryInterface(lpUnkServer, get_stub_header(This)->piid, (void**)&new);
new = InterlockedExchangePointer((void**)&This->pvServerObject, new);
if(new)
IUnknown_Release(new);
@@ -478,7 +269,7 @@ HRESULT WINAPI CStdStubBuffer_Connect(LPRPCSTUBBUFFER iface,
void WINAPI CStdStubBuffer_Disconnect(LPRPCSTUBBUFFER iface)
{
CStdStubBuffer *This = (CStdStubBuffer *)iface;
CStdStubBuffer *This = impl_from_IRpcStubBuffer(iface);
IUnknown *old;
TRACE("(%p)->Disconnect()\n",This);
@@ -492,7 +283,8 @@ HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface,
PRPCOLEMESSAGE pMsg,
LPRPCCHANNELBUFFER pChannel)
{
CStdStubBuffer *This = (CStdStubBuffer *)iface;
CStdStubBuffer *This = impl_from_IRpcStubBuffer(iface);
const CInterfaceStubHeader *header = get_stub_header(This);
DWORD dwPhase = STUB_UNMARSHAL;
HRESULT hr = S_OK;
@@ -500,15 +292,15 @@ HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface,
__TRY
{
if (STUB_HEADER(This).pDispatchTable)
STUB_HEADER(This).pDispatchTable[pMsg->iMethod](iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
if (header->pDispatchTable)
header->pDispatchTable[pMsg->iMethod](iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
else /* pure interpreted */
NdrStubCall2(iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
}
__EXCEPT(stub_filter)
{
DWORD dwExceptionCode = GetExceptionCode();
WARN("a stub call failed with exception 0x%08x (%d)\n", dwExceptionCode, dwExceptionCode);
WARN("a stub call failed with exception 0x%08lx (%ld)\n", dwExceptionCode, dwExceptionCode);
if (FAILED(dwExceptionCode))
hr = dwExceptionCode;
else
@@ -522,14 +314,18 @@ HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface,
LPRPCSTUBBUFFER WINAPI CStdStubBuffer_IsIIDSupported(LPRPCSTUBBUFFER iface,
REFIID riid)
{
CStdStubBuffer *This = (CStdStubBuffer *)iface;
TRACE("(%p)->IsIIDSupported(%s)\n",This,debugstr_guid(riid));
return IsEqualGUID(STUB_HEADER(This).piid, riid) ? iface : NULL;
CStdStubBuffer *stub = impl_from_IRpcStubBuffer(iface);
TRACE("(%p)->IsIIDSupported(%s)\n", stub, debugstr_guid(riid));
if (IsEqualGUID(get_stub_header(stub)->piid, riid))
return iface;
return NULL;
}
ULONG WINAPI CStdStubBuffer_CountRefs(LPRPCSTUBBUFFER iface)
{
CStdStubBuffer *This = (CStdStubBuffer *)iface;
CStdStubBuffer *This = impl_from_IRpcStubBuffer(iface);
TRACE("(%p)->CountRefs()\n",This);
return This->RefCount;
}
@@ -537,7 +333,7 @@ ULONG WINAPI CStdStubBuffer_CountRefs(LPRPCSTUBBUFFER iface)
HRESULT WINAPI CStdStubBuffer_DebugServerQueryInterface(LPRPCSTUBBUFFER iface,
LPVOID *ppv)
{
CStdStubBuffer *This = (CStdStubBuffer *)iface;
CStdStubBuffer *This = impl_from_IRpcStubBuffer(iface);
TRACE("(%p)->DebugServerQueryInterface(%p)\n",This,ppv);
return S_OK;
}
@@ -545,7 +341,7 @@ HRESULT WINAPI CStdStubBuffer_DebugServerQueryInterface(LPRPCSTUBBUFFER iface,
void WINAPI CStdStubBuffer_DebugServerRelease(LPRPCSTUBBUFFER iface,
LPVOID pv)
{
CStdStubBuffer *This = (CStdStubBuffer *)iface;
CStdStubBuffer *This = impl_from_IRpcStubBuffer(iface);
TRACE("(%p)->DebugServerRelease(%p)\n",This,pv);
}
@@ -614,8 +410,9 @@ const IRpcStubBufferVtbl CStdStubBuffer_Delegating_Vtbl =
const MIDL_SERVER_INFO *CStdStubBuffer_GetServerInfo(IRpcStubBuffer *iface)
{
CStdStubBuffer *This = (CStdStubBuffer *)iface;
return STUB_HEADER(This).pServerInfo;
CStdStubBuffer *stub = impl_from_IRpcStubBuffer(iface);
return get_stub_header(stub)->pServerInfo;
}
/************************************************************************
@@ -655,14 +452,14 @@ void WINAPI NdrStubGetBuffer(LPRPCSTUBBUFFER iface,
LPRPCCHANNELBUFFER pRpcChannelBuffer,
PMIDL_STUB_MESSAGE pStubMsg)
{
CStdStubBuffer *This = (CStdStubBuffer *)iface;
CStdStubBuffer *This = impl_from_IRpcStubBuffer(iface);
HRESULT hr;
TRACE("(%p, %p, %p)\n", This, pRpcChannelBuffer, pStubMsg);
pStubMsg->RpcMsg->BufferLength = pStubMsg->BufferLength;
hr = IRpcChannelBuffer_GetBuffer(pRpcChannelBuffer,
(RPCOLEMESSAGE *)pStubMsg->RpcMsg, STUB_HEADER(This).piid);
(RPCOLEMESSAGE *)pStubMsg->RpcMsg, get_stub_header(This)->piid);
if (FAILED(hr))
{
RpcRaiseException(hr);
+4
View File
@@ -0,0 +1,4 @@
#pragma once
#include "epm_c.h"
+1 -3
View File
@@ -19,9 +19,7 @@
*
*/
#pragma once
#include <epm_c.h>
#include "epm.h"
#define EPM_PROTOCOL_DNET_NSP 0x04
#define EPM_PROTOCOL_OSI_TP4 0x05
+87 -20
View File
@@ -8,7 +8,7 @@
#ifdef _M_IX86
.code32
EXTERN _ndr_client_call:PROC
EXTERN _NdrpClientCall2@16:PROC
PUBLIC _call_stubless_func
_call_stubless_func:
@@ -24,21 +24,64 @@ _call_stubless_func:
shr eax, 1
movzx eax, word ptr [edx+eax+4] /* arguments size */
push eax
lea eax, [esp+8] /* &This */
// .cfi_adjust_cfa_offset 4
push 0 /* fpu_stack */
// .cfi_adjust_cfa_offset 4
lea eax, [esp + 12] /* &This */
push eax
// .cfi_adjust_cfa_offset 4
push edx /* format string */
push [ecx] /* info->pstubdesc */
call _ndr_client_call
lea esp, [esp+12]
// .cfi_adjust_cfa_offset 4
push [ecx] /* info->pStubDesc */
// .cfi_adjust_cfa_offset 4
call _NdrpClientCall2@16
// .cfi_adjust_cfa_offset -16
pop edx /* arguments size */
// .cfi_adjust_cfa_offset -4
mov ecx, [esp] /* return address */
add esp, edx
jmp ecx
PUBLIC _NdrClientCall2
_NdrClientCall2:
push ebp
// .cfi_adjust_cfa_offset 4
// .cfi_rel_offset %ebp,0
mov ebp, esp
// .cfi_def_cfa_register %ebp
push 0 /* fpu_stack */
push [ebp + 16] /* stack */
push [ebp + 12] /* format */
push [ebp + 8] /* desc */
call _NdrpClientCall2@16
leave
// .cfi_def_cfa %esp,4
// .cfi_same_value %ebp
ret
EXTERN _ndr_async_client_call:PROC
PUBLIC _NdrAsyncClientCall
_NdrAsyncClientCall:
push ebp
// .cfi_adjust_cfa_offset 4
// .cfi_rel_offset %ebp,0
mov ebp, esp
// .cfi_def_cfa_register %ebp
push 0 /* fpu_stack */
push [ebp + 16] /* stack */
push [ebp + 12] /* format */
push [ebp + 8] /* desc */
call _ndr_async_client_call
leave
// .cfi_def_cfa %esp,4
// .cfi_same_value %ebp
ret
#elif _M_AMD64
.code64
EXTERN ndr_client_call:PROC
EXTERN NdrpClientCall2:PROC
EXTERN ndr_stubless_client_call:PROC
PUBLIC call_stubless_func
FUNC call_stubless_func
@@ -54,19 +97,13 @@ FUNC call_stubless_func
.ALLOCSTACK 38h
.ENDPROLOG
lea r8, [rsp +38h + 8] /* &This */
mov rcx, [rcx] /* This->lpVtbl */
mov rcx, [rcx - 10h] /* MIDL_STUBLESS_PROXY_INFO */
mov rdx, [rcx + 10h] /* info->FormatStringOffset */
movzx rdx, word ptr [rdx+r10*2] /* FormatStringOffset[index] */
add rdx, [rcx + 8] /* info->ProcFormatString + offset */
mov rcx, [rcx] /* info->pStubDesc */
lea rdx, [rsp + 40h] /* args */
movsd qword ptr [rsp + 20h], xmm1
movsd qword ptr [rsp + 28h], xmm2
movsd qword ptr [rsp + 30h], xmm3
lea r9, [rsp + 18h] /* fpu_args */
call ndr_client_call
lea r8, [rsp + 18h] /* fpu_regs */
mov ecx, r10d /* index */
call ndr_stubless_client_call
add rsp, 38h
ret
ENDFUNC
@@ -129,9 +166,9 @@ FUNC NdrClientCall2
.ALLOCSTACK 28h
.ENDPROLOG
lea r8, [rsp + 28h + 18h]
xor r9, r9
call ndr_client_call
lea r8, [rsp + 28h + 18h] /* stack */
xor r9, r9 /* fpu_stack */
call NdrpClientCall2
add rsp, 28h
ret
@@ -148,13 +185,43 @@ FUNC NdrAsyncClientCall
.ALLOCSTACK 28h
.ENDPROLOG
lea r8, [rsp + 28h + 18h]
lea r8, [rsp + 28h + 18h] /* stack */
xor r9, r9 /* fpu_stack */
call ndr_async_client_call
add rsp, 28h
ret
ENDFUNC
EXTERN ndr64_client_call:PROC
PUBLIC NdrClientCall3
FUNC NdrClientCall3
sub rsp, 28h
.ALLOCSTACK 28h
.ENDPROLOG
mov [rsp + 48h], r9
lea r9, [rsp + 48h] /* stack */
call ndr64_client_call
add rsp, 28h
ret
ENDFUNC
EXTERN ndr64_async_client_call:PROC
PUBLIC Ndr64AsyncClientCall
FUNC Ndr64AsyncClientCall
mov [rsp + 20h], r9
lea r9, [rsp + 20h]
push 0
sub rsp, 20h
.ALLOCSTACK 28h
.ENDPROLOG
call ndr64_async_client_call
add rsp, 28h
ret
ENDFUNC
#elif _M_ARM
TEXTAREA
+4 -6
View File
@@ -78,7 +78,6 @@ void WINAPI NdrClientInitializeNew( PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE
pStubMsg->PointerLength = 0;
pStubMsg->fInDontFree = 0;
pStubMsg->fDontCallFreeInst = 0;
pStubMsg->fInOnlyParam = 0;
pStubMsg->fHasReturn = 0;
pStubMsg->fHasExtensions = 0;
pStubMsg->fHasNewCorrDesc = 0;
@@ -89,7 +88,7 @@ void WINAPI NdrClientInitializeNew( PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE
pStubMsg->fHasMemoryValidateCallback = 0;
pStubMsg->fInFree = 0;
pStubMsg->fNeedMCCP = 0;
pStubMsg->fUnused = 0;
pStubMsg->fUnused2 = 0;
pStubMsg->dwDestContext = MSHCTX_DIFFERENTMACHINE;
pStubMsg->pvDestContext = NULL;
pStubMsg->pRpcChannelBuffer = NULL;
@@ -132,7 +131,6 @@ unsigned char* WINAPI NdrServerInitializeNew( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_M
pStubMsg->PointerLength = 0;
pStubMsg->fInDontFree = 0;
pStubMsg->fDontCallFreeInst = 0;
pStubMsg->fInOnlyParam = 0;
pStubMsg->fHasReturn = 0;
pStubMsg->fHasExtensions = 0;
pStubMsg->fHasNewCorrDesc = 0;
@@ -142,7 +140,7 @@ unsigned char* WINAPI NdrServerInitializeNew( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_M
pStubMsg->fHasMemoryValidateCallback = 0;
pStubMsg->fInFree = 0;
pStubMsg->fNeedMCCP = 0;
pStubMsg->fUnused = 0;
pStubMsg->fUnused2 = 0;
pStubMsg->dwDestContext = MSHCTX_DIFFERENTMACHINE;
pStubMsg->pvDestContext = NULL;
pStubMsg->pRpcChannelBuffer = NULL;
@@ -164,7 +162,7 @@ unsigned char *WINAPI NdrGetBuffer(PMIDL_STUB_MESSAGE stubmsg, ULONG buflen, RPC
{
RPC_STATUS status;
TRACE("(stubmsg == ^%p, buflen == %u, handle == %p)\n", stubmsg, buflen, handle);
TRACE("(stubmsg == ^%p, buflen == %lu, handle == %p)\n", stubmsg, buflen, handle);
stubmsg->RpcMsg->Handle = handle;
stubmsg->RpcMsg->BufferLength = buflen;
@@ -233,7 +231,7 @@ RPC_STATUS RPC_ENTRY NdrMapCommAndFaultStatus( PMIDL_STUB_MESSAGE pStubMsg,
ULONG *pFaultStatus,
RPC_STATUS Status )
{
TRACE("(%p, %p, %p, %d)\n", pStubMsg, pCommStatus, pFaultStatus, Status);
TRACE("(%p, %p, %p, %ld)\n", pStubMsg, pCommStatus, pFaultStatus, Status);
switch (Status)
{
+12 -9
View File
@@ -19,9 +19,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdlib.h>
#include "ndr_misc.h"
#include "rpc_assoc.h"
#include "rpcndr.h"
#include "cguid.h"
#include "wine/debug.h"
#include "wine/list.h"
@@ -139,7 +142,7 @@ RPC_STATUS WINAPI RpcSmDestroyClientContext(void **ContextHandle)
if (che)
{
RpcBindingFree(&che->handle);
HeapFree(GetProcessHeap(), 0, che);
free(che);
}
return status;
@@ -179,14 +182,14 @@ static RPC_STATUS ndr_update_context_handle(NDR_CCONTEXT *CContext,
return RPC_X_SS_CONTEXT_MISMATCH;
list_remove(&che->entry);
RpcBindingFree(&che->handle);
HeapFree(GetProcessHeap(), 0, che);
free(che);
che = NULL;
}
}
/* if there's no existing entry matching the GUID, allocate one */
else if (!(che = context_entry_from_guid(&chi->uuid)))
{
che = HeapAlloc(GetProcessHeap(), 0, sizeof *che);
che = malloc(sizeof *che);
if (!che)
return RPC_X_NO_MEMORY;
che->magic = NDR_CONTEXT_HANDLE_MAGIC;
@@ -209,7 +212,7 @@ void WINAPI NDRCContextUnmarshall(NDR_CCONTEXT *CContext,
{
RPC_STATUS status;
TRACE("*%p=(%p) %p %p %08x\n",
TRACE("*%p=(%p) %p %p %08lx\n",
CContext, *CContext, hBinding, pBuff, DataRepresentation);
EnterCriticalSection(&ndr_context_cs);
@@ -257,7 +260,7 @@ void WINAPI NDRSContextMarshall2(RPC_BINDING_HANDLE hBinding,
RPC_STATUS status;
ndr_context_handle *ndr = pBuff;
TRACE("(%p %p %p %p %p %u)\n",
TRACE("(%p %p %p %p %p %lu)\n",
hBinding, SContext, pBuff, userRunDownIn, CtxGuard, Flags);
if (!binding->server || !binding->Assoc)
@@ -297,7 +300,7 @@ void WINAPI NDRSContextMarshall2(RPC_BINDING_HANDLE hBinding,
NDR_SCONTEXT WINAPI NDRSContextUnmarshall(void *pBuff,
ULONG DataRepresentation)
{
TRACE("(%p %08x)\n", pBuff, DataRepresentation);
TRACE("(%p %08lx)\n", pBuff, DataRepresentation);
return NDRSContextUnmarshall2(I_RpcGetCurrentCallHandle(), pBuff,
DataRepresentation, NULL,
RPC_CONTEXT_HANDLE_DEFAULT_FLAGS);
@@ -310,7 +313,7 @@ NDR_SCONTEXT WINAPI NDRSContextUnmarshallEx(RPC_BINDING_HANDLE hBinding,
void *pBuff,
ULONG DataRepresentation)
{
TRACE("(%p %p %08x)\n", hBinding, pBuff, DataRepresentation);
TRACE("(%p %p %08lx)\n", hBinding, pBuff, DataRepresentation);
return NDRSContextUnmarshall2(hBinding, pBuff, DataRepresentation, NULL,
RPC_CONTEXT_HANDLE_DEFAULT_FLAGS);
}
@@ -328,7 +331,7 @@ NDR_SCONTEXT WINAPI NDRSContextUnmarshall2(RPC_BINDING_HANDLE hBinding,
RPC_STATUS status;
const ndr_context_handle *context_ndr = pBuff;
TRACE("(%p %p %08x %p %u)\n",
TRACE("(%p %p %08lx %p %lu)\n",
hBinding, pBuff, DataRepresentation, CtxGuard, Flags);
if (!binding->server || !binding->Assoc)
@@ -342,7 +345,7 @@ NDR_SCONTEXT WINAPI NDRSContextUnmarshall2(RPC_BINDING_HANDLE hBinding,
{
if (context_ndr->attributes)
{
ERR("non-null attributes 0x%x\n", context_ndr->attributes);
ERR("non-null attributes 0x%lx\n", context_ndr->attributes);
status = RPC_X_SS_CONTEXT_MISMATCH;
}
else
+29 -28
View File
@@ -20,6 +20,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
@@ -55,7 +56,7 @@ RPC_STATUS WINAPI MesEncodeIncrementalHandleCreate(
TRACE("(%p, %p, %p, %p)\n", UserState, AllocFn, WriteFn, pHandle);
pEsMsg = HeapAlloc(GetProcessHeap(), 0, sizeof(*pEsMsg));
pEsMsg = malloc(sizeof(*pEsMsg));
if (!pEsMsg)
return RPC_S_OUT_OF_MEMORY;
@@ -82,7 +83,7 @@ RPC_STATUS WINAPI MesDecodeIncrementalHandleCreate(
TRACE("(%p, %p, %p)\n", UserState, ReadFn, pHandle);
pEsMsg = HeapAlloc(GetProcessHeap(), 0, sizeof(*pEsMsg));
pEsMsg = malloc(sizeof(*pEsMsg));
if (!pEsMsg)
return RPC_S_OUT_OF_MEMORY;
@@ -130,7 +131,7 @@ RPC_STATUS WINAPI MesBufferHandleReset(handle_t Handle, ULONG HandleStyle,
{
MIDL_ES_MESSAGE *pEsMsg = (MIDL_ES_MESSAGE *)Handle;
TRACE("(%p, %u, %d, %p, %u, %p)\n", Handle, HandleStyle, Operation, Buffer,
TRACE("(%p, %lu, %d, %p, %lu, %p)\n", Handle, HandleStyle, Operation, Buffer,
BufferSize, EncodedSize);
if (!Handle || !Buffer || !EncodedSize)
@@ -162,7 +163,7 @@ RPC_STATUS WINAPI MesBufferHandleReset(handle_t Handle, ULONG HandleStyle,
RPC_STATUS WINAPI MesHandleFree(handle_t Handle)
{
TRACE("(%p)\n", Handle);
HeapFree(GetProcessHeap(), 0, Handle);
free(Handle);
return RPC_S_OK;
}
@@ -186,7 +187,7 @@ RPC_STATUS RPC_ENTRY MesEncodeFixedBufferHandleCreate(
MIDL_ES_MESSAGE *pEsMsg;
RPC_STATUS status;
TRACE("(%p, %d, %p, %p)\n", Buffer, BufferSize, pEncodedSize, pHandle);
TRACE("(%p, %ld, %p, %p)\n", Buffer, BufferSize, pEncodedSize, pHandle);
if ((status = validate_mes_buffer_pointer(Buffer)))
return status;
@@ -196,7 +197,7 @@ RPC_STATUS RPC_ENTRY MesEncodeFixedBufferHandleCreate(
/* FIXME: check BufferSize too */
pEsMsg = HeapAlloc(GetProcessHeap(), 0, sizeof(*pEsMsg));
pEsMsg = malloc(sizeof(*pEsMsg));
if (!pEsMsg)
return RPC_S_OUT_OF_MEMORY;
@@ -226,7 +227,7 @@ RPC_STATUS RPC_ENTRY MesEncodeDynBufferHandleCreate(char **Buffer,
if (!pEncodedSize)
return RPC_S_INVALID_ARG;
pEsMsg = HeapAlloc(GetProcessHeap(), 0, sizeof(*pEsMsg));
pEsMsg = malloc(sizeof(*pEsMsg));
if (!pEsMsg)
return RPC_S_OUT_OF_MEMORY;
@@ -251,12 +252,12 @@ RPC_STATUS RPC_ENTRY MesDecodeBufferHandleCreate(
MIDL_ES_MESSAGE *pEsMsg;
RPC_STATUS status;
TRACE("(%p, %d, %p)\n", Buffer, BufferSize, pHandle);
TRACE("(%p, %ld, %p)\n", Buffer, BufferSize, pHandle);
if ((status = validate_mes_buffer_pointer(Buffer)))
return status;
pEsMsg = HeapAlloc(GetProcessHeap(), 0, sizeof(*pEsMsg));
pEsMsg = malloc(sizeof(*pEsMsg));
if (!pEsMsg)
return RPC_S_OUT_OF_MEMORY;
@@ -277,17 +278,17 @@ static void es_data_alloc(MIDL_ES_MESSAGE *pEsMsg, ULONG size)
if (pEsMsg->HandleStyle == MES_INCREMENTAL_HANDLE)
{
unsigned int tmpsize = size;
TRACE("%d with incremental handle\n", size);
TRACE("%ld with incremental handle\n", size);
pEsMsg->Alloc(pEsMsg->UserState, (char **)&pEsMsg->StubMsg.Buffer, &tmpsize);
if (tmpsize < size)
{
ERR("not enough bytes allocated - requested %d, got %d\n", size, tmpsize);
ERR("not enough bytes allocated - requested %ld, got %d\n", size, tmpsize);
RpcRaiseException(RPC_S_OUT_OF_MEMORY);
}
}
else if (pEsMsg->HandleStyle == MES_FIXED_BUFFER_HANDLE)
{
TRACE("%d with fixed buffer handle\n", size);
TRACE("%ld with fixed buffer handle\n", size);
pEsMsg->StubMsg.Buffer = pEsMsg->Buffer;
}
pEsMsg->StubMsg.RpcMsg->Buffer = pEsMsg->StubMsg.BufferStart = pEsMsg->StubMsg.Buffer;
@@ -298,17 +299,17 @@ static void es_data_read(MIDL_ES_MESSAGE *pEsMsg, ULONG size)
if (pEsMsg->HandleStyle == MES_INCREMENTAL_HANDLE)
{
unsigned int tmpsize = size;
TRACE("%d from incremental handle\n", size);
TRACE("%ld from incremental handle\n", size);
pEsMsg->Read(pEsMsg->UserState, (char **)&pEsMsg->StubMsg.Buffer, &tmpsize);
if (tmpsize < size)
{
ERR("not enough bytes read - requested %d, got %d\n", size, tmpsize);
ERR("not enough bytes read - requested %ld, got %d\n", size, tmpsize);
RpcRaiseException(RPC_S_OUT_OF_MEMORY);
}
}
else
{
TRACE("%d from fixed or dynamic buffer handle\n", size);
TRACE("%ld from fixed or dynamic buffer handle\n", size);
/* FIXME: validate BufferSize? */
pEsMsg->StubMsg.Buffer = pEsMsg->Buffer;
pEsMsg->Buffer += size;
@@ -323,12 +324,12 @@ static void es_data_write(MIDL_ES_MESSAGE *pEsMsg, ULONG size)
{
if (pEsMsg->HandleStyle == MES_INCREMENTAL_HANDLE)
{
TRACE("%d to incremental handle\n", size);
TRACE("%ld to incremental handle\n", size);
pEsMsg->Write(pEsMsg->UserState, (char *)pEsMsg->StubMsg.BufferStart, size);
}
else
{
TRACE("%d to dynamic or fixed buffer handle\n", size);
TRACE("%ld to dynamic or fixed buffer handle\n", size);
*pEsMsg->pEncodedSize += size;
}
}
@@ -386,7 +387,7 @@ static void mes_proc_header_unmarshal(MIDL_ES_MESSAGE *pEsMsg)
pEsMsg->ProcNumber = *(DWORD *)pEsMsg->StubMsg.Buffer;
pEsMsg->StubMsg.Buffer += 4;
if (*(DWORD *)pEsMsg->StubMsg.Buffer != 0x00000001)
FIXME("unknown value 0x%08x, expected 0x00000001\n", *(DWORD *)pEsMsg->StubMsg.Buffer);
FIXME("unknown value 0x%08lx, expected 0x00000001\n", *(DWORD *)pEsMsg->StubMsg.Buffer);
pEsMsg->StubMsg.Buffer += 4;
pEsMsg->ByteCount = *(DWORD *)pEsMsg->StubMsg.Buffer;
pEsMsg->StubMsg.Buffer += 4;
@@ -407,7 +408,7 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu
/* header for procedure string */
const NDR_PROC_HEADER *pProcHeader = (const NDR_PROC_HEADER *)&pFormat[0];
const RPC_CLIENT_INTERFACE *client_interface;
__ms_va_list args;
va_list args;
unsigned int number_of_params;
ULONG_PTR arg_buffer[256];
@@ -416,7 +417,7 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu
/* Later NDR language versions probably won't be backwards compatible */
if (pStubDesc->Version > 0x50002)
{
FIXME("Incompatible stub description version: 0x%x\n", pStubDesc->Version);
FIXME("Incompatible stub description version: 0x%lx\n", pStubDesc->Version);
RpcRaiseException(RPC_X_WRONG_STUB_VERSION);
}
@@ -457,7 +458,7 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu
}
TRACE("stack size: 0x%x\n", stack_size);
TRACE("proc num: %d\n", pEsMsg->ProcNumber);
TRACE("proc num: %ld\n", pEsMsg->ProcNumber);
memset(&rpcMsg, 0, sizeof(rpcMsg));
pEsMsg->StubMsg.RpcMsg = &rpcMsg;
@@ -470,13 +471,13 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu
pEsMsg->StubMsg.FullPtrXlatTables = NdrFullPointerXlatInit(0,XLAT_CLIENT);
TRACE("Oi_flags = 0x%02x\n", pProcHeader->Oi_flags);
TRACE("stubdesc version = 0x%x\n", pStubDesc->Version);
TRACE("MIDL stub version = 0x%x\n", pStubDesc->MIDLVersion);
TRACE("stubdesc version = 0x%lx\n", pStubDesc->Version);
TRACE("MIDL stub version = 0x%lx\n", pStubDesc->MIDLVersion);
/* needed for conformance of top-level objects */
__ms_va_start( args, pFormat );
va_start( args, pFormat );
pEsMsg->StubMsg.StackTop = va_arg( args, unsigned char * );
__ms_va_end( args );
va_end( args );
pFormat = convert_old_args( &pEsMsg->StubMsg, pFormat, stack_size, FALSE,
arg_buffer, sizeof(arg_buffer), &number_of_params );
@@ -486,14 +487,14 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu
case MES_ENCODE:
pEsMsg->StubMsg.BufferLength = mes_proc_header_buffer_size();
client_do_args( &pEsMsg->StubMsg, pFormat, STUBLESS_CALCSIZE, NULL, number_of_params, NULL );
client_do_args( &pEsMsg->StubMsg, pFormat, STUBLESS_CALCSIZE, FALSE, number_of_params, NULL );
pEsMsg->ByteCount = pEsMsg->StubMsg.BufferLength - mes_proc_header_buffer_size();
es_data_alloc(pEsMsg, pEsMsg->StubMsg.BufferLength);
mes_proc_header_marshal(pEsMsg);
client_do_args( &pEsMsg->StubMsg, pFormat, STUBLESS_MARSHAL, NULL, number_of_params, NULL );
client_do_args( &pEsMsg->StubMsg, pFormat, STUBLESS_MARSHAL, FALSE, number_of_params, NULL );
es_data_write(pEsMsg, pEsMsg->ByteCount);
break;
@@ -502,7 +503,7 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu
es_data_read(pEsMsg, pEsMsg->ByteCount);
client_do_args( &pEsMsg->StubMsg, pFormat, STUBLESS_UNMARSHAL, NULL, number_of_params, NULL );
client_do_args( &pEsMsg->StubMsg, pFormat, STUBLESS_UNMARSHAL, FALSE, number_of_params, NULL );
break;
default:
RpcRaiseException(RPC_S_INTERNAL_ERROR);
+26 -29
View File
@@ -19,6 +19,7 @@
*/
#include <stdarg.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
@@ -33,25 +34,19 @@ PFULL_PTR_XLAT_TABLES WINAPI NdrFullPointerXlatInit(ULONG NumberOfPointers,
XLAT_SIDE XlatSide)
{
ULONG NumberOfBuckets;
PFULL_PTR_XLAT_TABLES pXlatTables = HeapAlloc(GetProcessHeap(), 0, sizeof(*pXlatTables));
FULL_PTR_XLAT_TABLES *pXlatTables = malloc(sizeof(*pXlatTables));
TRACE("(%d, %d)\n", NumberOfPointers, XlatSide);
TRACE("(%ld, %d)\n", NumberOfPointers, XlatSide);
if (!NumberOfPointers) NumberOfPointers = 512;
NumberOfBuckets = ((NumberOfPointers + 3) & ~3) - 1;
pXlatTables->RefIdToPointer.XlatTable =
HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(void *) * NumberOfPointers);
pXlatTables->RefIdToPointer.StateTable =
HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(unsigned char) * NumberOfPointers);
pXlatTables->RefIdToPointer.XlatTable = calloc(NumberOfPointers, sizeof(void *));
pXlatTables->RefIdToPointer.StateTable = calloc(NumberOfPointers, sizeof(unsigned char));
pXlatTables->RefIdToPointer.NumberOfEntries = NumberOfPointers;
TRACE("NumberOfBuckets = %d\n", NumberOfBuckets);
pXlatTables->PointerToRefId.XlatTable =
HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(PFULL_PTR_TO_REFID_ELEMENT) * NumberOfBuckets);
TRACE("NumberOfBuckets = %ld\n", NumberOfBuckets);
pXlatTables->PointerToRefId.XlatTable = calloc(NumberOfBuckets, sizeof(FULL_PTR_TO_REFID_ELEMENT *));
pXlatTables->PointerToRefId.NumberOfBuckets = NumberOfBuckets;
pXlatTables->PointerToRefId.HashMask = NumberOfBuckets - 1;
@@ -75,34 +70,36 @@ void WINAPI NdrFullPointerXlatFree(PFULL_PTR_XLAT_TABLES pXlatTables)
XlatTableEntry; )
{
PFULL_PTR_TO_REFID_ELEMENT Next = XlatTableEntry->Next;
HeapFree(GetProcessHeap(), 0, XlatTableEntry);
free(XlatTableEntry);
XlatTableEntry = Next;
}
}
HeapFree(GetProcessHeap(), 0, pXlatTables->RefIdToPointer.XlatTable);
HeapFree(GetProcessHeap(), 0, pXlatTables->RefIdToPointer.StateTable);
HeapFree(GetProcessHeap(), 0, pXlatTables->PointerToRefId.XlatTable);
free(pXlatTables->RefIdToPointer.XlatTable);
free(pXlatTables->RefIdToPointer.StateTable);
free(pXlatTables->PointerToRefId.XlatTable);
HeapFree(GetProcessHeap(), 0, pXlatTables);
free(pXlatTables);
}
static void expand_pointer_table_if_necessary(PFULL_PTR_XLAT_TABLES pXlatTables, ULONG RefId)
{
if (RefId >= pXlatTables->RefIdToPointer.NumberOfEntries)
{
pXlatTables->RefIdToPointer.NumberOfEntries = RefId * 2;
pXlatTables->RefIdToPointer.XlatTable =
HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
pXlatTables->RefIdToPointer.XlatTable,
sizeof(void *) * pXlatTables->RefIdToPointer.NumberOfEntries);
realloc(pXlatTables->RefIdToPointer.XlatTable, sizeof(void *) * RefId * 2);
pXlatTables->RefIdToPointer.StateTable =
HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
pXlatTables->RefIdToPointer.StateTable,
sizeof(unsigned char) * pXlatTables->RefIdToPointer.NumberOfEntries);
realloc(pXlatTables->RefIdToPointer.StateTable, RefId * 2);
if (!pXlatTables->RefIdToPointer.XlatTable || !pXlatTables->RefIdToPointer.StateTable)
{
pXlatTables->RefIdToPointer.NumberOfEntries = 0;
return;
}
memset(pXlatTables->RefIdToPointer.XlatTable + pXlatTables->RefIdToPointer.NumberOfEntries, 0,
(RefId * 2 - pXlatTables->RefIdToPointer.NumberOfEntries) * sizeof(void *));
memset(pXlatTables->RefIdToPointer.StateTable + pXlatTables->RefIdToPointer.NumberOfEntries, 0,
RefId * 2 - pXlatTables->RefIdToPointer.NumberOfEntries);
pXlatTables->RefIdToPointer.NumberOfEntries = RefId * 2;
}
}
@@ -137,7 +134,7 @@ int WINAPI NdrFullPointerQueryPointer(PFULL_PTR_XLAT_TABLES pXlatTables,
return 0;
}
XlatTableEntry = HeapAlloc(GetProcessHeap(), 0, sizeof(*XlatTableEntry));
XlatTableEntry = malloc(sizeof(*XlatTableEntry));
XlatTableEntry->Next = pXlatTables->PointerToRefId.XlatTable[Hash & pXlatTables->PointerToRefId.HashMask];
XlatTableEntry->Pointer = pPointer;
XlatTableEntry->RefId = *pRefId = pXlatTables->NextRefId++;
@@ -159,7 +156,7 @@ int WINAPI NdrFullPointerQueryRefId(PFULL_PTR_XLAT_TABLES pXlatTables,
ULONG RefId, unsigned char QueryType,
void **ppPointer)
{
TRACE("(%p, 0x%x, %d, %p)\n", pXlatTables, RefId, QueryType, ppPointer);
TRACE("(%p, 0x%lx, %d, %p)\n", pXlatTables, RefId, QueryType, ppPointer);
if (!RefId)
return 1;
@@ -192,13 +189,13 @@ void WINAPI NdrFullPointerInsertRefId(PFULL_PTR_XLAT_TABLES pXlatTables,
unsigned int i;
PFULL_PTR_TO_REFID_ELEMENT XlatTableEntry;
TRACE("(%p, 0x%x, %p)\n", pXlatTables, RefId, pPointer);
TRACE("(%p, 0x%lx, %p)\n", pXlatTables, RefId, pPointer);
/* simple hashing algorithm, don't know whether it matches native */
for (i = 0; i < sizeof(pPointer); i++)
Hash = (Hash * 3) ^ ((unsigned char *)&pPointer)[i];
XlatTableEntry = HeapAlloc(GetProcessHeap(), 0, sizeof(*XlatTableEntry));
XlatTableEntry = malloc(sizeof(*XlatTableEntry));
XlatTableEntry->Next = pXlatTables->PointerToRefId.XlatTable[Hash & pXlatTables->PointerToRefId.HashMask];
XlatTableEntry->Pointer = pPointer;
XlatTableEntry->RefId = RefId;
+83 -89
View File
@@ -33,7 +33,6 @@
#include <string.h>
#include <limits.h>
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
@@ -121,9 +120,9 @@ static inline void align_pointer_offset_clear( unsigned char **ptr, unsigned cha
}
#define STD_OVERFLOW_CHECK(_Msg) do { \
TRACE("buffer=%d/%d\n", (ULONG)(_Msg->Buffer - (unsigned char *)_Msg->RpcMsg->Buffer), _Msg->BufferLength); \
TRACE("buffer=%Id/%ld\n", _Msg->Buffer - (unsigned char *)_Msg->RpcMsg->Buffer, _Msg->BufferLength); \
if (_Msg->Buffer > (unsigned char *)_Msg->RpcMsg->Buffer + _Msg->BufferLength) \
ERR("buffer overflow %d bytes\n", (ULONG)(_Msg->Buffer - ((unsigned char *)_Msg->RpcMsg->Buffer + _Msg->BufferLength))); \
ERR("buffer overflow %Id bytes\n", _Msg->Buffer - ((unsigned char *)_Msg->RpcMsg->Buffer + _Msg->BufferLength)); \
} while (0)
#define NDR_POINTER_ID_BASE 0x20000
@@ -428,7 +427,7 @@ void * WINAPI NdrAllocate(MIDL_STUB_MESSAGE *pStubMsg, SIZE_T len)
/* check for overflow */
if (adjusted_len < len)
{
ERR("overflow of adjusted_len %ld, len %ld\n", adjusted_len, len);
ERR("overflow of adjusted_len %Id, len %Id\n", adjusted_len, len);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
@@ -477,7 +476,7 @@ static PFORMAT_STRING ReadConformance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRIN
RpcRaiseException(RPC_X_BAD_STUB_DATA);
pStubMsg->MaxCount = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
pStubMsg->Buffer += 4;
TRACE("unmarshalled conformance is %ld\n", pStubMsg->MaxCount);
TRACE("unmarshalled conformance is %Id\n", pStubMsg->MaxCount);
return SkipConformance(pStubMsg, pFormat);
}
@@ -495,15 +494,15 @@ static inline PFORMAT_STRING ReadVariance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_S
RpcRaiseException(RPC_X_BAD_STUB_DATA);
pStubMsg->Offset = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
pStubMsg->Buffer += 4;
TRACE("offset is %d\n", pStubMsg->Offset);
TRACE("offset is %ld\n", pStubMsg->Offset);
pStubMsg->ActualCount = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
pStubMsg->Buffer += 4;
TRACE("variance is %d\n", pStubMsg->ActualCount);
TRACE("variance is %ld\n", pStubMsg->ActualCount);
if ((pStubMsg->ActualCount > MaxValue) ||
(pStubMsg->ActualCount + pStubMsg->Offset > MaxValue))
{
ERR("invalid array bound(s): ActualCount = %d, Offset = %d, MaxValue = %d\n",
ERR("invalid array bound(s): ActualCount = %ld, Offset = %ld, MaxValue = %ld\n",
pStubMsg->ActualCount, pStubMsg->Offset, MaxValue);
RpcRaiseException(RPC_S_INVALID_BOUND);
return NULL;
@@ -589,7 +588,7 @@ PFORMAT_STRING ComputeConformanceOrVariance(
break;
case FC_CONSTANT_CONFORMANCE:
data = ofs | ((DWORD)pFormat[1] << 16);
TRACE("constant conformance, val=%ld\n", data);
TRACE("constant conformance, val=%Id\n", data);
*pCount = data;
goto finish_conf;
case FC_TOP_LEVEL_MULTID_CONFORMANCE:
@@ -661,7 +660,7 @@ PFORMAT_STRING ComputeConformanceOrVariance(
FIXME("unknown conformance data type %x\n", dtype);
goto done_conf_grab;
}
TRACE("dereferenced data type %x at %p, got %ld\n", dtype, ptr, data);
TRACE("dereferenced data type %x at %p, got %Id\n", dtype, ptr, data);
done_conf_grab:
switch (pFormat[1]) {
@@ -687,7 +686,7 @@ done_conf_grab:
}
finish_conf:
TRACE("resulting conformance is %ld\n", *pCount);
TRACE("resulting conformance is %Id\n", *pCount);
return SkipConformance(pStubMsg, pFormat);
}
@@ -722,7 +721,7 @@ static inline void safe_buffer_length_increment(MIDL_STUB_MESSAGE *pStubMsg, ULO
{
if (pStubMsg->BufferLength + size < pStubMsg->BufferLength) /* integer overflow of pStubMsg->BufferSize */
{
ERR("buffer length overflow - BufferLength = %u, size = %u\n",
ERR("buffer length overflow - BufferLength = %lu, size = %lu\n",
pStubMsg->BufferLength, size);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
@@ -736,7 +735,7 @@ static inline void safe_copy_from_buffer(MIDL_STUB_MESSAGE *pStubMsg, void *p, U
if ((pStubMsg->Buffer + size < pStubMsg->Buffer) || /* integer overflow of pStubMsg->Buffer */
(pStubMsg->Buffer + size > pStubMsg->BufferEnd))
{
ERR("buffer overflow - Buffer = %p, BufferEnd = %p, size = %u\n",
ERR("buffer overflow - Buffer = %p, BufferEnd = %p, size = %lu\n",
pStubMsg->Buffer, pStubMsg->BufferEnd, size);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
@@ -752,7 +751,7 @@ static inline void safe_copy_to_buffer(MIDL_STUB_MESSAGE *pStubMsg, const void *
if ((pStubMsg->Buffer + size < pStubMsg->Buffer) || /* integer overflow of pStubMsg->Buffer */
(pStubMsg->Buffer + size > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength))
{
ERR("buffer overflow - Buffer = %p, BufferEnd = %p, size = %u\n",
ERR("buffer overflow - Buffer = %p, BufferEnd = %p, size = %lu\n",
pStubMsg->Buffer, (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength,
size);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
@@ -771,7 +770,7 @@ static void validate_string_data(MIDL_STUB_MESSAGE *pStubMsg, ULONG bufsize, ULO
if ((pStubMsg->Buffer + bufsize < pStubMsg->Buffer) ||
(pStubMsg->Buffer + bufsize > pStubMsg->BufferEnd))
{
ERR("bufsize 0x%x exceeded buffer end %p of buffer %p\n", bufsize,
ERR("bufsize 0x%lx exceeded buffer end %p of buffer %p\n", bufsize,
pStubMsg->BufferEnd, pStubMsg->Buffer);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
@@ -779,14 +778,14 @@ static void validate_string_data(MIDL_STUB_MESSAGE *pStubMsg, ULONG bufsize, ULO
/* strings must always have null terminating bytes */
if (bufsize < esize)
{
ERR("invalid string length of %d\n", bufsize / esize);
ERR("invalid string length of %ld\n", bufsize / esize);
RpcRaiseException(RPC_S_INVALID_BOUND);
}
for (i = bufsize - esize; i < bufsize; i++)
if (pStubMsg->Buffer[i] != 0)
{
ERR("string not null-terminated at byte position %d, data is 0x%x\n",
ERR("string not null-terminated at byte position %ld, data is 0x%x\n",
i, pStubMsg->Buffer[i]);
RpcRaiseException(RPC_S_INVALID_BOUND);
}
@@ -843,13 +842,13 @@ static void PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
else
pointer_needs_marshaling = FALSE;
pointer_id = Pointer ? NDR_POINTER_ID(pStubMsg) : 0;
TRACE("writing 0x%08x to buffer\n", pointer_id);
TRACE("writing 0x%08lx to buffer\n", pointer_id);
NDR_LOCAL_UINT32_WRITE(Buffer, pointer_id);
break;
case FC_FP:
pointer_needs_marshaling = !NdrFullPointerQueryPointer(
pStubMsg->FullPtrXlatTables, Pointer, 1, &pointer_id);
TRACE("writing 0x%08x to buffer\n", pointer_id);
TRACE("writing 0x%08lx to buffer\n", pointer_id);
NDR_LOCAL_UINT32_WRITE(Buffer, pointer_id);
break;
default:
@@ -905,7 +904,7 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
break;
case FC_UP: /* unique pointer */
pointer_id = NDR_LOCAL_UINT32_READ(Buffer);
TRACE("pointer_id is 0x%08x\n", pointer_id);
TRACE("pointer_id is 0x%08lx\n", pointer_id);
if (pointer_id)
pointer_needs_unmarshaling = TRUE;
else {
@@ -915,7 +914,7 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
break;
case FC_OP: /* object pointer - we must free data before overwriting it */
pointer_id = NDR_LOCAL_UINT32_READ(Buffer);
TRACE("pointer_id is 0x%08x\n", pointer_id);
TRACE("pointer_id is 0x%08lx\n", pointer_id);
/* An object pointer always allocates new memory (it cannot point to the
* buffer). */
@@ -933,7 +932,7 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
break;
case FC_FP:
pointer_id = NDR_LOCAL_UINT32_READ(Buffer);
TRACE("pointer_id is 0x%08x\n", pointer_id);
TRACE("pointer_id is 0x%08lx\n", pointer_id);
pointer_needs_unmarshaling = !NdrFullPointerQueryRefId(
pStubMsg->FullPtrXlatTables, pointer_id, 1, (void **)pPointer);
break;
@@ -1079,7 +1078,7 @@ static ULONG PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
case FC_UP: /* unique pointer */
case FC_OP: /* object pointer - we must free data before overwriting it */
pointer_id = NDR_LOCAL_UINT32_READ(Buffer);
TRACE("pointer_id is 0x%08x\n", pointer_id);
TRACE("pointer_id is 0x%08lx\n", pointer_id);
if (pointer_id)
pointer_needs_sizing = TRUE;
else
@@ -1089,7 +1088,7 @@ static ULONG PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
{
void *pointer;
pointer_id = NDR_LOCAL_UINT32_READ(Buffer);
TRACE("pointer_id is 0x%08x\n", pointer_id);
TRACE("pointer_id is 0x%08lx\n", pointer_id);
pointer_needs_sizing = !NdrFullPointerQueryRefId(
pStubMsg->FullPtrXlatTables, pointer_id, 1, &pointer);
break;
@@ -1693,7 +1692,7 @@ void WINAPI NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char*
case FC_ERROR_STATUS_T:
case FC_ENUM32:
BASE_TYPE_UNMARSHALL(ULONG);
TRACE("value: 0x%08x\n", *(ULONG *)pMemory);
TRACE("value: 0x%08lx\n", *(ULONG *)pMemory);
break;
case FC_FLOAT:
BASE_TYPE_UNMARSHALL(float);
@@ -1720,14 +1719,14 @@ void WINAPI NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char*
/* 32-bits on the wire, but int_ptr in memory */
*(INT_PTR *)pMemory = *(INT *)pStubMsg->Buffer;
pStubMsg->Buffer += sizeof(INT);
TRACE("value: 0x%08lx\n", *(INT_PTR *)pMemory);
TRACE("value: 0x%08Ix\n", *(INT_PTR *)pMemory);
break;
case FC_UINT3264:
align_pointer(&pStubMsg->Buffer, sizeof(UINT));
/* 32-bits on the wire, but int_ptr in memory */
*(UINT_PTR *)pMemory = *(UINT *)pStubMsg->Buffer;
pStubMsg->Buffer += sizeof(UINT);
TRACE("value: 0x%08lx\n", *(UINT_PTR *)pMemory);
TRACE("value: 0x%08Ix\n", *(UINT_PTR *)pMemory);
break;
case FC_IGNORE:
break;
@@ -2225,13 +2224,13 @@ static inline ULONG array_read_variance_and_unmarshall(
if (pFormat[1] != FC_STRING_SIZED && (pStubMsg->MaxCount != pStubMsg->ActualCount))
{
ERR("buffer size %d must equal memory size %ld for non-sized conformant strings\n",
ERR("buffer size %ld must equal memory size %Id for non-sized conformant strings\n",
pStubMsg->ActualCount, pStubMsg->MaxCount);
RpcRaiseException(RPC_S_INVALID_BOUND);
}
if (pStubMsg->Offset)
{
ERR("conformant strings can't have Offset (%d)\n", pStubMsg->Offset);
ERR("conformant strings can't have Offset (%ld)\n", pStubMsg->Offset);
RpcRaiseException(RPC_S_INVALID_BOUND);
}
@@ -2356,13 +2355,13 @@ static inline void array_memory_size(
if (pFormat[1] != FC_STRING_SIZED && (pStubMsg->MaxCount != pStubMsg->ActualCount))
{
ERR("buffer size %d must equal memory size %ld for non-sized conformant strings\n",
ERR("buffer size %ld must equal memory size %Id for non-sized conformant strings\n",
pStubMsg->ActualCount, pStubMsg->MaxCount);
RpcRaiseException(RPC_S_INVALID_BOUND);
}
if (pStubMsg->Offset)
{
ERR("conformant strings can't have Offset (%d)\n", pStubMsg->Offset);
ERR("conformant strings can't have Offset (%ld)\n", pStubMsg->Offset);
RpcRaiseException(RPC_S_INVALID_BOUND);
}
@@ -2636,7 +2635,7 @@ unsigned char * WINAPI NdrNonConformantStringUnmarshall(PMIDL_STUB_MESSAGE pStu
ReadVariance(pStubMsg, NULL, maxsize);
if (pStubMsg->Offset)
{
ERR("non-conformant strings can't have Offset (%d)\n", pStubMsg->Offset);
ERR("non-conformant strings can't have Offset (%ld)\n", pStubMsg->Offset);
RpcRaiseException(RPC_S_INVALID_BOUND);
}
@@ -2728,7 +2727,7 @@ ULONG WINAPI NdrNonConformantStringMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
if (pStubMsg->Offset)
{
ERR("non-conformant strings can't have Offset (%d)\n", pStubMsg->Offset);
ERR("non-conformant strings can't have Offset (%ld)\n", pStubMsg->Offset);
RpcRaiseException(RPC_S_INVALID_BOUND);
}
@@ -2869,7 +2868,7 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg,
case FC_ENUM16:
{
USHORT val = *(DWORD *)pMemory;
TRACE("enum16=%d <= %p\n", *(DWORD*)pMemory, pMemory);
TRACE("enum16=%ld <= %p\n", *(DWORD*)pMemory, pMemory);
if (32767 < *(DWORD*)pMemory)
RpcRaiseException(RPC_X_ENUM_VALUE_OUT_OF_RANGE);
safe_copy_to_buffer(pStubMsg, &val, 2);
@@ -2879,7 +2878,7 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg,
case FC_LONG:
case FC_ULONG:
case FC_ENUM32:
TRACE("long=%d <= %p\n", *(DWORD*)pMemory, pMemory);
TRACE("long=%ld <= %p\n", *(DWORD*)pMemory, pMemory);
safe_copy_to_buffer(pStubMsg, pMemory, 4);
pMemory += 4;
break;
@@ -2887,7 +2886,7 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg,
case FC_UINT3264:
{
UINT val = *(UINT_PTR *)pMemory;
TRACE("int3264=%ld <= %p\n", *(UINT_PTR *)pMemory, pMemory);
TRACE("int3264=%Id <= %p\n", *(UINT_PTR *)pMemory, pMemory);
safe_copy_to_buffer(pStubMsg, &val, sizeof(UINT));
pMemory += sizeof(UINT_PTR);
break;
@@ -2970,7 +2969,7 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg,
pFormat += 2;
desc = pFormat + *(const SHORT*)pFormat;
size = EmbeddedComplexSize(pStubMsg, desc);
TRACE("embedded complex (size=%d) <= %p\n", size, pMemory);
TRACE("embedded complex (size=%ld) <= %p\n", size, pMemory);
m = NdrMarshaller[*desc & NDR_TABLE_MASK];
if (m)
{
@@ -3031,7 +3030,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
WORD val;
safe_copy_from_buffer(pStubMsg, &val, 2);
*(DWORD*)pMemory = val;
TRACE("enum16=%d => %p\n", *(DWORD*)pMemory, pMemory);
TRACE("enum16=%ld => %p\n", *(DWORD*)pMemory, pMemory);
if (32767 < *(DWORD*)pMemory)
RpcRaiseException(RPC_X_ENUM_VALUE_OUT_OF_RANGE);
pMemory += 4;
@@ -3041,7 +3040,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
case FC_ULONG:
case FC_ENUM32:
safe_copy_from_buffer(pStubMsg, pMemory, 4);
TRACE("long=%d => %p\n", *(DWORD*)pMemory, pMemory);
TRACE("long=%ld => %p\n", *(DWORD*)pMemory, pMemory);
pMemory += 4;
break;
case FC_INT3264:
@@ -3049,7 +3048,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
INT val;
safe_copy_from_buffer(pStubMsg, &val, 4);
*(INT_PTR *)pMemory = val;
TRACE("int3264=%ld => %p\n", *(INT_PTR*)pMemory, pMemory);
TRACE("int3264=%Id => %p\n", *(INT_PTR*)pMemory, pMemory);
pMemory += sizeof(INT_PTR);
break;
}
@@ -3058,7 +3057,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
UINT val;
safe_copy_from_buffer(pStubMsg, &val, 4);
*(UINT_PTR *)pMemory = val;
TRACE("uint3264=%ld => %p\n", *(UINT_PTR*)pMemory, pMemory);
TRACE("uint3264=%Id => %p\n", *(UINT_PTR*)pMemory, pMemory);
pMemory += sizeof(UINT_PTR);
break;
}
@@ -3140,7 +3139,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
pFormat += 2;
desc = pFormat + *(const SHORT*)pFormat;
size = EmbeddedComplexSize(pStubMsg, desc);
TRACE("embedded complex (size=%d) => %p\n", size, pMemory);
TRACE("embedded complex (size=%ld) => %p\n", size, pMemory);
if (fMustAlloc)
/* we can't pass fMustAlloc=TRUE into the marshaller for this type
* since the type is part of the memory block that is encompassed by
@@ -3629,7 +3628,7 @@ unsigned char * WINAPI NdrComplexStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
/* save it for use by embedded pointer code later */
pStubMsg->PointerBufferMark = (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength;
TRACE("difference = 0x%x\n", (ULONG)(pStubMsg->PointerBufferMark - pStubMsg->Buffer));
TRACE("difference = 0x%Ix\n", pStubMsg->PointerBufferMark - pStubMsg->Buffer);
pointer_buffer_mark_set = TRUE;
/* restore the original buffer length */
@@ -3715,7 +3714,7 @@ unsigned char * WINAPI NdrComplexStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
/* save it for use by embedded pointer code later */
pStubMsg->PointerBufferMark = pStubMsg->Buffer;
TRACE("difference = 0x%x\n", (ULONG)(pStubMsg->PointerBufferMark - saved_buffer));
TRACE("difference = 0x%Ix\n", pStubMsg->PointerBufferMark - saved_buffer);
pointer_buffer_mark_set = TRUE;
/* restore the original buffer */
@@ -3803,7 +3802,7 @@ void WINAPI NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
/* save it for use by embedded pointer code later */
pStubMsg->PointerLength = pStubMsg->BufferLength;
pointer_length_set = 1;
TRACE("difference = 0x%x\n", pStubMsg->PointerLength - saved_buffer_length);
TRACE("difference = 0x%lx\n", pStubMsg->PointerLength - saved_buffer_length);
/* restore the original buffer length */
pStubMsg->BufferLength = saved_buffer_length;
@@ -4186,7 +4185,7 @@ unsigned char * WINAPI NdrComplexArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
/* save it for use by embedded pointer code later */
pStubMsg->PointerBufferMark = (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength;
TRACE("difference = 0x%x\n", (ULONG)(pStubMsg->Buffer - (unsigned char *)pStubMsg->RpcMsg->Buffer));
TRACE("difference = 0x%Ix\n", pStubMsg->Buffer - (unsigned char *)pStubMsg->RpcMsg->Buffer);
pointer_buffer_mark_set = TRUE;
/* restore fields */
@@ -4242,7 +4241,7 @@ unsigned char * WINAPI NdrComplexArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
NdrComplexArrayMemorySize(pStubMsg, pFormat);
pStubMsg->IgnoreEmbeddedPointers = saved_ignore_embedded;
TRACE("difference = 0x%x\n", (ULONG)(pStubMsg->Buffer - saved_buffer));
TRACE("difference = 0x%Ix\n", pStubMsg->Buffer - saved_buffer);
if (!pStubMsg->PointerBufferMark)
{
/* save it for use by embedded pointer code later */
@@ -4362,10 +4361,10 @@ void WINAPI NdrComplexArrayFree(PMIDL_STUB_MESSAGE pStubMsg,
pFormat += 4;
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, def);
TRACE("conformance = %ld\n", pStubMsg->MaxCount);
TRACE("conformance = %Id\n", pStubMsg->MaxCount);
pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, pStubMsg->MaxCount);
TRACE("variance = %d\n", pStubMsg->ActualCount);
TRACE("variance = %ld\n", pStubMsg->ActualCount);
count = pStubMsg->ActualCount;
for (i = 0; i < count; i++)
@@ -4533,7 +4532,7 @@ void WINAPI NdrUserMarshalBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
align_length(&pStubMsg->BufferLength, (flags & 0xf) + 1);
if (bufsize) {
TRACE("size=%d\n", bufsize);
TRACE("size=%ld\n", bufsize);
safe_buffer_length_increment(pStubMsg, bufsize);
}
else
@@ -4612,20 +4611,20 @@ RPC_STATUS RPC_ENTRY NdrGetUserMarshalInfo(ULONG *flags, ULONG level, NDR_USER_M
{
USER_MARSHAL_CB *umcb = CONTAINING_RECORD(flags, USER_MARSHAL_CB, Flags);
TRACE("(%p,%u,%p)\n", flags, level, umi);
TRACE("(%p,%lu,%p)\n", flags, level, umi);
if (level != 1)
return RPC_S_INVALID_ARG;
memset(&umi->u1.Level1, 0, sizeof(umi->u1.Level1));
memset(&umi->Level1, 0, sizeof(umi->Level1));
umi->InformationLevel = level;
if (umcb->Signature != USER_MARSHAL_CB_SIGNATURE)
return RPC_S_INVALID_ARG;
umi->u1.Level1.pfnAllocate = umcb->pStubMsg->pfnAllocate;
umi->u1.Level1.pfnFree = umcb->pStubMsg->pfnFree;
umi->u1.Level1.pRpcChannelBuffer = umcb->pStubMsg->pRpcChannelBuffer;
umi->Level1.pfnAllocate = umcb->pStubMsg->pfnAllocate;
umi->Level1.pfnFree = umcb->pStubMsg->pfnFree;
umi->Level1.pRpcChannelBuffer = umcb->pStubMsg->pRpcChannelBuffer;
switch (umcb->CBType)
{
@@ -4641,8 +4640,8 @@ RPC_STATUS RPC_ENTRY NdrGetUserMarshalInfo(ULONG *flags, ULONG level, NDR_USER_M
umcb->pStubMsg->Buffer > buffer_end)
return RPC_X_INVALID_BUFFER;
umi->u1.Level1.Buffer = umcb->pStubMsg->Buffer;
umi->u1.Level1.BufferSize = buffer_end - umcb->pStubMsg->Buffer;
umi->Level1.Buffer = umcb->pStubMsg->Buffer;
umi->Level1.BufferSize = buffer_end - umcb->pStubMsg->Buffer;
break;
}
case USER_MARSHAL_CB_BUFFER_SIZE:
@@ -4680,7 +4679,7 @@ void WINAPI NdrConvert( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat )
*/
void WINAPI NdrConvert2( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, LONG NumberParams )
{
FIXME("(pStubMsg == ^%p, pFormat == ^%p, NumberParams == %d): stub.\n",
FIXME("(pStubMsg == ^%p, pFormat == ^%p, NumberParams == %ld): stub.\n",
pStubMsg, pFormat, NumberParams);
/* FIXME: since this stub doesn't do any converting, the proper behavior
is to raise an exception */
@@ -4739,7 +4738,7 @@ unsigned char * WINAPI NdrConformantStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
bufsize = safe_multiply(esize, pStubMsg->MaxCount);
if (pCStructFormat->memory_size + bufsize < pCStructFormat->memory_size) /* integer overflow */
{
ERR("integer overflow of memory_size %u with bufsize %u\n",
ERR("integer overflow of memory_size %u with bufsize %lu\n",
pCStructFormat->memory_size, bufsize);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
@@ -4794,7 +4793,7 @@ unsigned char * WINAPI NdrConformantStructUnmarshall(PMIDL_STUB_MESSAGE pStubMs
bufsize = safe_multiply(esize, pStubMsg->MaxCount);
if (pCStructFormat->memory_size + bufsize < pCStructFormat->memory_size) /* integer overflow */
{
ERR("integer overflow of memory_size %u with bufsize %u\n",
ERR("integer overflow of memory_size %u with bufsize %lu\n",
pCStructFormat->memory_size, bufsize);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
@@ -5706,13 +5705,13 @@ static PFORMAT_STRING get_arm_offset_from_union_arm_selector(PMIDL_STUB_MESSAGE
{
if(type == 0xffff)
{
ERR("no arm for 0x%x and no default case\n", discriminant);
ERR("no arm for 0x%lx and no default case\n", discriminant);
RpcRaiseException(RPC_S_INVALID_TAG);
return NULL;
}
if(type == 0)
{
TRACE("falling back to empty default case for 0x%x\n", discriminant);
TRACE("falling back to empty default case for 0x%lx\n", discriminant);
return NULL;
}
}
@@ -6036,7 +6035,7 @@ unsigned char * WINAPI NdrEncapsulatedUnionMarshall(PMIDL_STUB_MESSAGE pStubMsg
align_pointer_clear(&pStubMsg->Buffer, increment);
switch_value = get_discriminant(switch_type, pMemory);
TRACE("got switch value 0x%x\n", switch_value);
TRACE("got switch value 0x%lx\n", switch_value);
NdrBaseTypeMarshall(pStubMsg, pMemory, &switch_type);
pMemory += increment;
@@ -6067,7 +6066,7 @@ unsigned char * WINAPI NdrEncapsulatedUnionUnmarshall(PMIDL_STUB_MESSAGE pStubM
align_pointer(&pStubMsg->Buffer, increment);
switch_value = get_discriminant(switch_type, pStubMsg->Buffer);
TRACE("got switch value 0x%x\n", switch_value);
TRACE("got switch value 0x%lx\n", switch_value);
size = *(const unsigned short*)pFormat + increment;
if (!fMustAlloc && !*ppMemory)
@@ -6109,7 +6108,7 @@ void WINAPI NdrEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
align_length(&pStubMsg->BufferLength, increment);
switch_value = get_discriminant(switch_type, pMemory);
TRACE("got switch value 0x%x\n", switch_value);
TRACE("got switch value 0x%lx\n", switch_value);
/* Add discriminant size */
NdrBaseTypeBufferSize(pStubMsg, (unsigned char *)&switch_value, &switch_type);
@@ -6134,7 +6133,7 @@ ULONG WINAPI NdrEncapsulatedUnionMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
align_pointer(&pStubMsg->Buffer, increment);
switch_value = get_discriminant(switch_type, pStubMsg->Buffer);
TRACE("got switch value 0x%x\n", switch_value);
TRACE("got switch value 0x%lx\n", switch_value);
pStubMsg->Memory += increment;
@@ -6160,7 +6159,7 @@ void WINAPI NdrEncapsulatedUnionFree(PMIDL_STUB_MESSAGE pStubMsg,
pFormat++;
switch_value = get_discriminant(switch_type, pMemory);
TRACE("got switch value 0x%x\n", switch_value);
TRACE("got switch value 0x%lx\n", switch_value);
pMemory += increment;
@@ -6183,7 +6182,7 @@ unsigned char * WINAPI NdrNonEncapsulatedUnionMarshall(PMIDL_STUB_MESSAGE pStub
pFormat++;
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, 0);
TRACE("got switch value 0x%lx\n", pStubMsg->MaxCount);
TRACE("got switch value 0x%Ix\n", pStubMsg->MaxCount);
/* Marshall discriminant */
NdrBaseTypeMarshall(pStubMsg, (unsigned char *)&pStubMsg->MaxCount, &switch_type);
@@ -6252,7 +6251,7 @@ unsigned char * WINAPI NdrNonEncapsulatedUnionUnmarshall(PMIDL_STUB_MESSAGE pSt
/* Unmarshall discriminant */
discriminant = unmarshall_discriminant(pStubMsg, &pFormat);
TRACE("unmarshalled discriminant %x\n", discriminant);
TRACE("unmarshalled discriminant %lx\n", discriminant);
pFormat += *(const SHORT*)pFormat;
@@ -6290,7 +6289,7 @@ void WINAPI NdrNonEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
pFormat++;
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, 0);
TRACE("got switch value 0x%lx\n", pStubMsg->MaxCount);
TRACE("got switch value 0x%Ix\n", pStubMsg->MaxCount);
/* Add discriminant size */
NdrBaseTypeBufferSize(pStubMsg, (unsigned char *)&pStubMsg->MaxCount, &switch_type);
@@ -6308,7 +6307,7 @@ ULONG WINAPI NdrNonEncapsulatedUnionMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
pFormat++;
/* Unmarshall discriminant */
discriminant = unmarshall_discriminant(pStubMsg, &pFormat);
TRACE("unmarshalled discriminant 0x%x\n", discriminant);
TRACE("unmarshalled discriminant 0x%lx\n", discriminant);
return union_arm_memory_size(pStubMsg, discriminant, pFormat + *(const SHORT*)pFormat);
}
@@ -6325,7 +6324,7 @@ void WINAPI NdrNonEncapsulatedUnionFree(PMIDL_STUB_MESSAGE pStubMsg,
pFormat++;
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, 0);
TRACE("got switch value 0x%lx\n", pStubMsg->MaxCount);
TRACE("got switch value 0x%Ix\n", pStubMsg->MaxCount);
union_arm_free(pStubMsg, pMemory, pStubMsg->MaxCount, pFormat + *(const SHORT*)pFormat);
}
@@ -6483,7 +6482,7 @@ unsigned char *WINAPI NdrRangeUnmarshall(
}
base_type = pRange->flags_type & 0xf;
TRACE("base_type = 0x%02x, low_value = %d, high_value = %d\n",
TRACE("base_type = 0x%02x, low_value = %ld, high_value = %ld\n",
base_type, pRange->low_value, pRange->high_value);
#define RANGE_UNMARSHALL(mem_type, wire_type, format_spec) \
@@ -6537,12 +6536,12 @@ unsigned char *WINAPI NdrRangeUnmarshall(
break;
case FC_LONG:
case FC_ENUM32:
RANGE_UNMARSHALL(LONG, LONG, "%d");
TRACE("value: 0x%08x\n", **(ULONG **)ppMemory);
RANGE_UNMARSHALL(LONG, LONG, "%ld");
TRACE("value: 0x%08lx\n", **(ULONG **)ppMemory);
break;
case FC_ULONG:
RANGE_UNMARSHALL(ULONG, ULONG, "%u");
TRACE("value: 0x%08x\n", **(ULONG **)ppMemory);
RANGE_UNMARSHALL(ULONG, ULONG, "%lu");
TRACE("value: 0x%08lx\n", **(ULONG **)ppMemory);
break;
case FC_ENUM16:
RANGE_UNMARSHALL(UINT, USHORT, "%u");
@@ -6647,7 +6646,7 @@ static unsigned char *WINAPI NdrBaseTypeMarshall(
case FC_ENUM32:
align_pointer_clear(&pStubMsg->Buffer, sizeof(ULONG));
safe_copy_to_buffer(pStubMsg, pMemory, sizeof(ULONG));
TRACE("value: 0x%08x\n", *(ULONG *)pMemory);
TRACE("value: 0x%08lx\n", *(ULONG *)pMemory);
break;
case FC_FLOAT:
align_pointer_clear(&pStubMsg->Buffer, sizeof(float));
@@ -6739,7 +6738,7 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall(
case FC_ERROR_STATUS_T:
case FC_ENUM32:
BASE_TYPE_UNMARSHALL(ULONG);
TRACE("value: 0x%08x\n", **(ULONG **)ppMemory);
TRACE("value: 0x%08lx\n", **(ULONG **)ppMemory);
break;
case FC_FLOAT:
BASE_TYPE_UNMARSHALL(float);
@@ -6779,7 +6778,7 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall(
*ppMemory = NdrAllocate(pStubMsg, sizeof(INT_PTR));
safe_copy_from_buffer(pStubMsg, &val, sizeof(INT));
**(INT_PTR **)ppMemory = val;
TRACE("value: 0x%08lx\n", **(INT_PTR **)ppMemory);
TRACE("value: 0x%08Ix\n", **(INT_PTR **)ppMemory);
}
break;
case FC_UINT3264:
@@ -6794,7 +6793,7 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall(
*ppMemory = NdrAllocate(pStubMsg, sizeof(UINT_PTR));
safe_copy_from_buffer(pStubMsg, &val, sizeof(UINT));
**(UINT_PTR **)ppMemory = val;
TRACE("value: 0x%08lx\n", **(UINT_PTR **)ppMemory);
TRACE("value: 0x%08Ix\n", **(UINT_PTR **)ppMemory);
}
break;
case FC_IGNORE:
@@ -7264,15 +7263,13 @@ NDR_SCONTEXT WINAPI NdrServerContextNewUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
*/
void WINAPI NdrCorrelationInitialize(PMIDL_STUB_MESSAGE pStubMsg, void *pMemory, ULONG CacheSize, ULONG Flags)
{
static int once;
if (!once++)
FIXME("(%p, %p, %d, 0x%x): semi-stub\n", pStubMsg, pMemory, CacheSize, Flags);
TRACE("(%p, %p, %ld, 0x%lx)\n", pStubMsg, pMemory, CacheSize, Flags);
if (pStubMsg->CorrDespIncrement == 0)
pStubMsg->CorrDespIncrement = 2; /* size of the normal (non-range) /robust payload */
pStubMsg->fHasNewCorrDesc = TRUE;
pStubMsg->pCorrInfo = pMemory;
}
/***********************************************************************
@@ -7305,8 +7302,5 @@ void WINAPI NdrCorrelationPass(PMIDL_STUB_MESSAGE pStubMsg)
*/
void WINAPI NdrCorrelationFree(PMIDL_STUB_MESSAGE pStubMsg)
{
static int once;
if (!once++)
FIXME("(%p): stub\n", pStubMsg);
/* FIXME: free memory */
}
+7 -7
View File
@@ -32,7 +32,7 @@ struct IPSFactoryBuffer;
PFORMAT_STRING ComputeConformanceOrVariance(
MIDL_STUB_MESSAGE *pStubMsg, unsigned char *pMemory,
PFORMAT_STRING pFormat, ULONG_PTR def, ULONG_PTR *pCount) DECLSPEC_HIDDEN;
PFORMAT_STRING pFormat, ULONG_PTR def, ULONG_PTR *pCount);
static inline PFORMAT_STRING ComputeConformance(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, ULONG def)
{
@@ -56,12 +56,12 @@ typedef void (WINAPI *NDR_BUFFERSIZE)(PMIDL_STUB_MESSAGE, unsigned cha
typedef ULONG (WINAPI *NDR_MEMORYSIZE)(PMIDL_STUB_MESSAGE, PFORMAT_STRING);
typedef void (WINAPI *NDR_FREE) (PMIDL_STUB_MESSAGE, unsigned char*, PFORMAT_STRING);
extern const NDR_MARSHALL NdrMarshaller[] DECLSPEC_HIDDEN;
extern const NDR_UNMARSHALL NdrUnmarshaller[] DECLSPEC_HIDDEN;
extern const NDR_BUFFERSIZE NdrBufferSizer[] DECLSPEC_HIDDEN;
extern const NDR_MEMORYSIZE NdrMemorySizer[] DECLSPEC_HIDDEN;
extern const NDR_FREE NdrFreer[] DECLSPEC_HIDDEN;
extern const NDR_MARSHALL NdrMarshaller[];
extern const NDR_UNMARSHALL NdrUnmarshaller[];
extern const NDR_BUFFERSIZE NdrBufferSizer[];
extern const NDR_MEMORYSIZE NdrMemorySizer[];
extern const NDR_FREE NdrFreer[];
ULONG ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) DECLSPEC_HIDDEN;
ULONG ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat);
#endif /* __WINE_NDR_MISC_H */
+23 -61
View File
@@ -26,8 +26,6 @@
#include <string.h>
#define COBJMACROS
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
@@ -44,33 +42,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) */
@@ -116,9 +87,9 @@ static ULONG WINAPI RpcStream_Release(LPSTREAM iface)
RpcStreamImpl *This = impl_from_IStream(iface);
ULONG ref = InterlockedDecrement( &This->RefCount );
if (!ref) {
TRACE("size=%d\n", *This->size);
TRACE("size=%ld\n", *This->size);
This->pMsg->Buffer = This->data + *This->size;
HeapFree(GetProcessHeap(),0,This);
free(This);
}
return ref;
}
@@ -166,13 +137,13 @@ static HRESULT WINAPI RpcStream_Seek(LPSTREAM iface,
RpcStreamImpl *This = impl_from_IStream(iface);
switch (origin) {
case STREAM_SEEK_SET:
This->pos = move.u.LowPart;
This->pos = move.LowPart;
break;
case STREAM_SEEK_CUR:
This->pos = This->pos + move.u.LowPart;
This->pos = This->pos + move.LowPart;
break;
case STREAM_SEEK_END:
This->pos = *This->size + move.u.LowPart;
This->pos = *This->size + move.LowPart;
break;
default:
return STG_E_INVALIDFUNCTION;
@@ -188,7 +159,7 @@ static HRESULT WINAPI RpcStream_SetSize(LPSTREAM iface,
ULARGE_INTEGER newSize)
{
RpcStreamImpl *This = impl_from_IStream(iface);
*This->size = newSize.u.LowPart;
*This->size = newSize.LowPart;
return S_OK;
}
@@ -203,7 +174,7 @@ static HRESULT WINAPI RpcStream_CopyTo(IStream *iface, IStream *dest,
static HRESULT WINAPI RpcStream_Commit(IStream *iface, DWORD flags)
{
RpcStreamImpl *This = impl_from_IStream(iface);
FIXME("(%p)->(0x%08x): stub\n", This, flags);
FIXME("(%p)->(0x%08lx): stub\n", This, flags);
return E_NOTIMPL;
}
@@ -267,7 +238,7 @@ static HRESULT RpcStream_Create(PMIDL_STUB_MESSAGE pStubMsg, BOOL init, ULONG *s
RpcStreamImpl *This;
*stream = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(RpcStreamImpl));
This = malloc(sizeof(RpcStreamImpl));
if (!This) return E_OUTOFMEMORY;
This->IStream_iface.lpVtbl = &RpcStream_Vtbl;
This->RefCount = 1;
@@ -276,7 +247,7 @@ static HRESULT RpcStream_Create(PMIDL_STUB_MESSAGE pStubMsg, BOOL init, ULONG *s
This->data = pStubMsg->Buffer + sizeof(DWORD);
This->pos = 0;
if (init) *This->size = 0;
TRACE("init size=%d\n", *This->size);
TRACE("init size=%ld\n", *This->size);
if (size) *size = *This->size;
*stream = &This->IStream_iface;
@@ -313,14 +284,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 = COM_MarshalInterface(stream, riid, (LPUNKNOWN)pMemory,
pStubMsg->dwDestContext, pStubMsg->pvDestContext,
MSHLFLAGS_NORMAL);
hr = CoMarshalInterface(stream, riid, (IUnknown *)pMemory,
pStubMsg->dwDestContext, pStubMsg->pvDestContext,
MSHLFLAGS_NORMAL);
IStream_Release(stream);
}
@@ -343,7 +313,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 +325,7 @@ unsigned char * WINAPI NdrInterfacePointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg
hr = RpcStream_Create(pStubMsg, FALSE, &size, &stream);
if (hr == S_OK) {
if (size != 0)
hr = COM_UnmarshalInterface(stream, &IID_NULL, (void **)unk);
hr = CoUnmarshalInterface(stream, &IID_NULL, (void **)unk);
IStream_Release(stream);
}
@@ -378,11 +347,10 @@ 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);
TRACE("size=%d\n", size);
CoGetMarshalSizeMax(&size, riid, (IUnknown *)pMemory,
pStubMsg->dwDestContext, pStubMsg->pvDestContext,
MSHLFLAGS_NORMAL);
TRACE("size=%ld\n", size);
pStubMsg->BufferLength += sizeof(DWORD) + size;
}
@@ -422,8 +390,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 +398,7 @@ void * WINAPI NdrOleAllocate(SIZE_T Size)
*/
void WINAPI NdrOleFree(void *NodeToFree)
{
if (!LoadCOM()) return;
COM_MemFree(NodeToFree);
CoTaskMemFree(NodeToFree);
}
/***********************************************************************
@@ -445,12 +411,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 = COM_GetClassObject( &clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IPSFactoryBuffer, (void**)&psfac );
r = CoGetClassObject(&clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IPSFactoryBuffer, (void **)&psfac);
if(FAILED(r)) return r;
r = IPSFactoryBuffer_CreateProxy(psfac, pUnkOuter, iid, pproxy, ppv);
@@ -469,12 +433,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 = COM_GetClassObject( &clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IPSFactoryBuffer, (void**)&psfac );
r = CoGetClassObject(&clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IPSFactoryBuffer, (void **)&psfac);
if(FAILED(r)) return r;
r = IPSFactoryBuffer_CreateStub(psfac, iid, pUnk, ppstub);
File diff suppressed because it is too large Load Diff
+4 -8
View File
@@ -255,14 +255,10 @@ enum stubless_phase
STUBLESS_FREE
};
LONG_PTR CDECL ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat,
void **stack_top, void **fpu_stack ) DECLSPEC_HIDDEN;
LONG_PTR CDECL ndr_async_client_call( PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat,
void **stack_top ) DECLSPEC_HIDDEN;
void client_do_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, enum stubless_phase phase,
void **fpu_args, unsigned short number_of_params, unsigned char *pRetVal ) DECLSPEC_HIDDEN;
BOOLEAN fpu_args, unsigned short number_of_params, unsigned char *pRetVal );
PFORMAT_STRING convert_old_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat,
unsigned int stack_size, BOOL object_proc,
void *buffer, unsigned int size, unsigned int *count ) DECLSPEC_HIDDEN;
RPC_STATUS NdrpCompleteAsyncClientCall(RPC_ASYNC_STATE *pAsync, void *Reply) DECLSPEC_HIDDEN;
RPC_STATUS NdrpCompleteAsyncServerCall(RPC_ASYNC_STATE *pAsync, void *Reply) DECLSPEC_HIDDEN;
void *buffer, unsigned int size, unsigned int *count );
RPC_STATUS NdrpCompleteAsyncClientCall(RPC_ASYNC_STATE *pAsync, void *Reply);
RPC_STATUS NdrpCompleteAsyncServerCall(RPC_ASYNC_STATE *pAsync, void *Reply);
+331 -153
View File
@@ -29,7 +29,6 @@
#include "rpcproxy.h"
#include "ndrtypes.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "cpsf.h"
#include "initguid.h"
@@ -47,6 +46,7 @@ static size_t write_type_tfs(ITypeInfo *typeinfo, unsigned char *str,
do { if ((str)) *((short *)((str) + (len))) = (val); (len) += 2; } while (0)
#define WRITE_INT(str, len, val) \
do { if ((str)) *((int *)((str) + (len))) = (val); (len) += 4; } while (0)
#define ROUND_SIZE(size, alignment) (((size) + ((alignment) - 1)) & ~((alignment) - 1))
extern const ExtendedProxyFileInfo ndr_types_ProxyFileInfo;
@@ -149,17 +149,21 @@ static unsigned char get_basetype(ITypeInfo *typeinfo, TYPEDESC *desc)
}
}
static unsigned int type_memsize(ITypeInfo *typeinfo, TYPEDESC *desc)
static unsigned int type_memsize(ITypeInfo *typeinfo, TYPEDESC *desc, unsigned int *align_ret)
{
unsigned int size, align;
switch (desc->vt)
{
case VT_I1:
case VT_UI1:
return 1;
size = align = 1;
break;
case VT_I2:
case VT_UI2:
case VT_BOOL:
return 2;
size = align = 2;
break;
case VT_I4:
case VT_UI4:
case VT_R4:
@@ -167,45 +171,52 @@ static unsigned int type_memsize(ITypeInfo *typeinfo, TYPEDESC *desc)
case VT_UINT:
case VT_ERROR:
case VT_HRESULT:
return 4;
size = align = 4;
break;
case VT_I8:
case VT_UI8:
case VT_R8:
case VT_DATE:
return 8;
size = align = 8;
break;
case VT_BSTR:
case VT_SAFEARRAY:
case VT_PTR:
case VT_UNKNOWN:
case VT_DISPATCH:
return sizeof(void *);
size = align = sizeof(void *);
break;
case VT_VARIANT:
return sizeof(VARIANT);
align = 8;
size = sizeof(VARIANT);
break;
case VT_CARRAY:
{
unsigned int size = type_memsize(typeinfo, &desc->lpadesc->tdescElem);
unsigned int i;
size = type_memsize(typeinfo, &desc->lpadesc->tdescElem, &align);
for (i = 0; i < desc->lpadesc->cDims; i++)
size *= desc->lpadesc->rgbounds[i].cElements;
return size;
break;
}
case VT_USERDEFINED:
{
unsigned int size = 0;
ITypeInfo *refinfo;
TYPEATTR *attr;
ITypeInfo_GetRefTypeInfo(typeinfo, desc->hreftype, &refinfo);
ITypeInfo_GetTypeAttr(refinfo, &attr);
size = attr->cbSizeInstance;
align = attr->cbAlignment;
ITypeInfo_ReleaseTypeAttr(refinfo, attr);
ITypeInfo_Release(refinfo);
return size;
break;
}
default:
FIXME("unhandled type %u\n", desc->vt);
return 0;
}
if (align_ret) *align_ret = align;
return size;
}
static BOOL type_pointer_is_iface(ITypeInfo *typeinfo, TYPEDESC *tdesc)
@@ -404,16 +415,9 @@ static void write_struct_members(ITypeInfo *typeinfo, unsigned char *str,
ITypeInfo_GetVarDesc(typeinfo, i, &desc);
tdesc = &desc->elemdescVar.tdesc;
/* This may not match the intended alignment, but we don't have enough
* information to determine that. This should always give the correct
* layout. */
if ((struct_offset & 7) && !(desc->oInst & 7))
WRITE_CHAR(str, *len, FC_ALIGNM8);
else if ((struct_offset & 3) && !(desc->oInst & 3))
WRITE_CHAR(str, *len, FC_ALIGNM4);
else if ((struct_offset & 1) && !(desc->oInst & 1))
WRITE_CHAR(str, *len, FC_ALIGNM2);
struct_offset = desc->oInst + type_memsize(typeinfo, tdesc);
if (struct_offset != desc->oInst)
WRITE_CHAR(str, *len, FC_STRUCTPAD1 + desc->oInst - struct_offset - 1);
struct_offset = desc->oInst + type_memsize(typeinfo, tdesc, NULL);
if ((basetype = get_basetype(typeinfo, tdesc)))
WRITE_CHAR(str, *len, basetype);
@@ -574,7 +578,7 @@ static void write_complex_struct_tfs(ITypeInfo *typeinfo, unsigned char *str,
if (struct_offset != desc->oInst)
member_layout++; /* alignment directive */
struct_offset = desc->oInst + type_memsize(typeinfo, tdesc);
struct_offset = desc->oInst + type_memsize(typeinfo, tdesc, NULL);
if (get_basetype(typeinfo, tdesc))
member_layout++;
@@ -644,11 +648,13 @@ static size_t write_array_tfs(ITypeInfo *typeinfo, unsigned char *str,
{
WRITE_SHORT(str, *len, size);
WRITE_INT(str, *len, 0xffffffff); /* conformance */
WRITE_SHORT(str, *len, 0);
WRITE_INT(str, *len, 0xffffffff); /* variance */
WRITE_SHORT(str, *len, 0);
}
else
{
size *= type_memsize(typeinfo, &desc->tdescElem);
size *= type_memsize(typeinfo, &desc->tdescElem, NULL);
WRITE_INT(str, *len, size);
}
@@ -790,9 +796,7 @@ static size_t write_type_tfs(ITypeInfo *typeinfo, unsigned char *str,
ITypeInfo *refinfo;
TYPEATTR *attr;
size_t off;
#ifdef __REACTOS__
GUID guid;
#endif
TRACE("vt %d%s\n", desc->vt, toplevel ? " (toplevel)" : "");
@@ -814,7 +818,6 @@ static size_t write_type_tfs(ITypeInfo *typeinfo, unsigned char *str,
case TKIND_RECORD:
off = write_struct_tfs(refinfo, str, len, attr);
break;
#ifdef __REACTOS__
case TKIND_INTERFACE:
case TKIND_DISPATCH:
/* These are treated as if they were interface pointers. */
@@ -826,13 +829,6 @@ static size_t write_type_tfs(ITypeInfo *typeinfo, unsigned char *str,
get_default_iface(refinfo, attr->cImplTypes, &guid);
write_ip_tfs(str, len, &guid);
break;
#else
case TKIND_INTERFACE:
case TKIND_DISPATCH:
case TKIND_COCLASS:
assert(0);
break;
#endif
case TKIND_ALIAS:
off = write_type_tfs(refinfo, str, len, &attr->tdescAlias, toplevel, onstack);
break;
@@ -858,15 +854,52 @@ static size_t write_type_tfs(ITypeInfo *typeinfo, unsigned char *str,
return off;
}
static unsigned short get_stack_size(ITypeInfo *typeinfo, TYPEDESC *desc)
static unsigned int get_stack_size(ITypeInfo *typeinfo, TYPEDESC *desc, unsigned int *align, int *by_value)
{
#if defined(__i386__) || defined(__arm__)
if (desc->vt == VT_CARRAY)
return sizeof(void *);
return (type_memsize(typeinfo, desc) + 3) & ~3;
#else
return sizeof(void *);
unsigned int size = *align = sizeof(void *);
int byval = 1;
switch (desc->vt)
{
case VT_R8:
case VT_I8:
case VT_UI8:
case VT_DATE:
#ifdef __arm__
case VT_R4:
*align = 8;
#endif
size = 8;
break;
case VT_PTR:
case VT_UNKNOWN:
case VT_DISPATCH:
case VT_CARRAY:
byval = 0;
break;
case VT_VARIANT:
case VT_USERDEFINED:
size = type_memsize(typeinfo, desc, align);
break;
default:
break;
}
#ifdef __i386__
*align = sizeof(void *);
#endif
if (byval)
{
#ifdef __x86_64__
byval = (size == 1 || size == 2 || size == 4 || size == 8);
#elif defined __aarch64__
byval = (size <= 16);
#endif
}
if (!byval) size = *align = sizeof(void *);
else if (*align < sizeof(void *)) *align = sizeof(void *);
if (by_value) *by_value = byval;
return ROUND_SIZE( size, *align );
}
static const unsigned short MustSize = 0x0001;
@@ -906,7 +939,7 @@ static HRESULT get_param_pointer_info(ITypeInfo *typeinfo, TYPEDESC *tdesc, int
break;
case VT_CARRAY:
*flags |= IsSimpleRef | MustFree;
*server_size = type_memsize(typeinfo, tdesc);
*server_size = type_memsize(typeinfo, tdesc, NULL);
*tfs_tdesc = tdesc;
break;
case VT_USERDEFINED:
@@ -949,9 +982,11 @@ static HRESULT get_param_pointer_info(ITypeInfo *typeinfo, TYPEDESC *tdesc, int
*flags |= IsSimpleRef;
*tfs_tdesc = tdesc;
if (!is_in && is_out)
*server_size = type_memsize(typeinfo, tdesc);
*server_size = type_memsize(typeinfo, tdesc, NULL);
if ((*basetype = get_basetype(typeinfo, tdesc)))
*flags |= IsBasetype;
else
*flags |= MustFree;
break;
}
@@ -959,7 +994,7 @@ static HRESULT get_param_pointer_info(ITypeInfo *typeinfo, TYPEDESC *tdesc, int
}
static HRESULT get_param_info(ITypeInfo *typeinfo, TYPEDESC *tdesc, int is_in,
int is_out, unsigned short *server_size, unsigned short *flags,
int is_out, int by_val, unsigned short *server_size, unsigned short *flags,
unsigned char *basetype, TYPEDESC **tfs_tdesc)
{
ITypeInfo *refinfo;
@@ -976,15 +1011,10 @@ static HRESULT get_param_info(ITypeInfo *typeinfo, TYPEDESC *tdesc, int is_in,
switch (tdesc->vt)
{
case VT_VARIANT:
#if !defined(__i386__) && !defined(__arm__)
*flags |= IsSimpleRef | MustFree;
break;
#endif
/* otherwise fall through */
case VT_BSTR:
case VT_SAFEARRAY:
case VT_CY:
*flags |= IsByValue | MustFree;
*flags |= (by_val ? IsByValue : IsSimpleRef) | MustFree;
break;
case VT_UNKNOWN:
case VT_DISPATCH:
@@ -1005,27 +1035,20 @@ static HRESULT get_param_info(ITypeInfo *typeinfo, TYPEDESC *tdesc, int is_in,
*basetype = FC_ENUM32;
break;
case TKIND_RECORD:
#if defined(__i386__) || defined(__arm__)
*flags |= IsByValue | MustFree;
#else
if (attr->cbSizeInstance <= 8)
*flags |= IsByValue | MustFree;
else
*flags |= IsSimpleRef | MustFree;
#endif
*flags |= (by_val ? IsByValue : IsSimpleRef) | MustFree;
break;
case TKIND_ALIAS:
hr = get_param_info(refinfo, &attr->tdescAlias, is_in, is_out,
hr = get_param_info(refinfo, &attr->tdescAlias, is_in, is_out, 0,
server_size, flags, basetype, tfs_tdesc);
break;
#ifdef __REACTOS__
case TKIND_INTERFACE:
case TKIND_DISPATCH:
case TKIND_COCLASS:
/* These are treated as if they were interface pointers. */
*flags |= MustFree;
break;
#endif
default:
FIXME("unhandled kind %#x\n", attr->typekind);
hr = E_NOTIMPL;
@@ -1056,7 +1079,8 @@ static HRESULT write_param_fs(ITypeInfo *typeinfo, unsigned char *type,
USHORT param_flags = desc->paramdesc.wParamFlags;
TYPEDESC *tdesc = &desc->tdesc, *tfs_tdesc;
unsigned short server_size;
unsigned short stack_size = get_stack_size(typeinfo, tdesc);
int byval;
unsigned int align, stack_size = get_stack_size(typeinfo, tdesc, &align, &byval);
unsigned char basetype;
unsigned short flags;
int is_in, is_out;
@@ -1066,7 +1090,7 @@ static HRESULT write_param_fs(ITypeInfo *typeinfo, unsigned char *type,
is_out = param_flags & PARAMFLAG_FOUT;
is_in = (param_flags & PARAMFLAG_FIN) || (!is_out && !is_return);
hr = get_param_info(typeinfo, tdesc, is_in, is_out, &server_size, &flags,
hr = get_param_info(typeinfo, tdesc, is_in, is_out, byval, &server_size, &flags,
&basetype, &tfs_tdesc);
if (is_in) flags |= IsIn;
@@ -1082,6 +1106,8 @@ static HRESULT write_param_fs(ITypeInfo *typeinfo, unsigned char *type,
if (SUCCEEDED(hr))
{
*stack_offset = ROUND_SIZE( *stack_offset, align );
WRITE_SHORT(proc, *proclen, flags);
WRITE_SHORT(proc, *proclen, *stack_offset);
WRITE_SHORT(proc, *proclen, basetype ? basetype : off);
@@ -1092,46 +1118,188 @@ static HRESULT write_param_fs(ITypeInfo *typeinfo, unsigned char *type,
return hr;
}
#if defined __arm__ || defined __aarch64__
/* replace consecutive params code by a repeat sequence: 0x9d code<1> repeat_count<2> */
static unsigned int compress_params_array( unsigned char *params, unsigned int count )
{
unsigned int i, j;
for (i = 0; i + 4 <= count; i++)
{
for (j = 1; i + j < count; j++) if (params[i + j] != params[i]) break;
if (j < 4) continue;
params[i] = 0x9d;
params[i + 2] = j & 0xff;
params[i + 3] = j >> 8;
memmove( params + i + 4, params + i + j, count - (i + j) );
count -= j - 4;
i += 3;
}
return count;
}
/* fill the parameters array for the procedure extra data on ARM platforms */
static unsigned int fill_params_array( ITypeInfo *typeinfo, FUNCDESC *desc,
unsigned char *params, unsigned int count )
{
static const unsigned int pointer_size = sizeof(void *);
unsigned int reg_count = 0, float_count = 0, double_count = 0, stack_pos = 0, offset = 0;
unsigned int i, size, pos, align;
memset( params, 0x9f /* padding */, count );
/* This pointer */
params[0] = 0x80 + reg_count++;
offset += pointer_size;
for (i = 0; i < desc->cParams; i++)
{
unsigned char basetype = get_basetype( typeinfo, &desc->lprgelemdescParam[i].tdesc );
size = get_stack_size( typeinfo, &desc->lprgelemdescParam[i].tdesc, &align, NULL );
offset = ROUND_SIZE( offset, align );
pos = offset / pointer_size;
#ifdef __aarch64__
switch (basetype)
{
case FC_FLOAT:
case FC_DOUBLE:
if (double_count >= 8) break;
params[pos] = 0x88 + double_count++;
offset += size;
continue;
default:
reg_count = ROUND_SIZE( reg_count, align / pointer_size );
if (reg_count > 8 - size / pointer_size) break;
while (size)
{
params[pos++] = 0x80 + reg_count++;
offset += pointer_size;
size -= pointer_size;
}
continue;
}
(void)float_count; /* unused on arm64 */
#else
switch (basetype)
{
case FC_FLOAT:
if (!(float_count % 2)) float_count = max( float_count, double_count * 2 );
if (float_count >= 16)
{
stack_pos = ROUND_SIZE( stack_pos, align );
params[pos] = 0x100 - (offset - stack_pos) / pointer_size;
stack_pos += size;
}
else
{
params[pos] = 0x84 + float_count++;
}
offset += size;
continue;
case FC_DOUBLE:
double_count = max( double_count, (float_count + 1) / 2 );
if (double_count >= 8) break;
params[pos] = 0x84 + 2 * double_count;
params[pos + 1] = 0x84 + 2 * double_count + 1;
double_count++;
offset += size;
continue;
default:
reg_count = ROUND_SIZE( reg_count, align / pointer_size );
if (reg_count <= 4 - size / pointer_size || !stack_pos)
{
while (size && reg_count < 4)
{
params[pos++] = 0x80 + reg_count++;
offset += pointer_size;
size -= pointer_size;
}
}
break;
}
#endif
stack_pos = ROUND_SIZE( stack_pos, align );
memset( params + pos, 0x100 - (offset - stack_pos) / pointer_size, size / pointer_size );
stack_pos += size;
offset += size;
}
while (count && params[count - 1] == 0x9f) count--;
return count;
}
#endif /* __arm__ || __aarch64__ */
static void write_proc_func_header(ITypeInfo *typeinfo, FUNCDESC *desc,
WORD proc_idx, unsigned char *proc, size_t *proclen)
{
unsigned short stack_size = 2 * sizeof(void *); /* This + return */
#ifdef __x86_64__
unsigned short float_mask = 0;
unsigned char basetype;
#endif
WORD param_idx;
unsigned int i, align, size, stack_size = sizeof(void *); /* This */
for (i = 0; i < desc->cParams; i++)
{
size = get_stack_size(typeinfo, &desc->lprgelemdescParam[i].tdesc, &align, NULL );
stack_size = ROUND_SIZE( stack_size, align );
stack_size += size;
}
stack_size += sizeof(void *); /* return */
WRITE_CHAR (proc, *proclen, FC_AUTO_HANDLE);
WRITE_CHAR (proc, *proclen, Oi_OBJECT_PROC | Oi_OBJ_USE_V2_INTERPRETER);
WRITE_SHORT(proc, *proclen, proc_idx);
for (param_idx = 0; param_idx < desc->cParams; param_idx++)
stack_size += get_stack_size(typeinfo, &desc->lprgelemdescParam[param_idx].tdesc);
WRITE_SHORT(proc, *proclen, stack_size);
WRITE_SHORT(proc, *proclen, 0); /* constant_client_buffer_size */
WRITE_SHORT(proc, *proclen, 0); /* constant_server_buffer_size */
#ifdef __x86_64__
WRITE_CHAR (proc, *proclen, 0x47); /* HasExtensions | HasReturn | ClientMustSize | ServerMustSize */
#else
WRITE_CHAR (proc, *proclen, 0x07); /* HasReturn | ClientMustSize | ServerMustSize */
#endif
WRITE_CHAR (proc, *proclen, desc->cParams + 1); /* incl. return value */
#ifdef __x86_64__
WRITE_CHAR (proc, *proclen, 10); /* extension size */
WRITE_CHAR (proc, *proclen, 0); /* INTERPRETER_OPT_FLAGS2 */
#ifdef __i386__
WRITE_CHAR (proc, *proclen, 8); /* extension size */
WRITE_CHAR (proc, *proclen, 1); /* HasNewCorrDesc */
WRITE_SHORT(proc, *proclen, 0); /* ClientCorrHint */
WRITE_SHORT(proc, *proclen, 0); /* ServerCorrHint */
WRITE_SHORT(proc, *proclen, 0); /* NotifyIndex */
for (param_idx = 0; param_idx < desc->cParams && param_idx < 3; param_idx++)
#elif defined __x86_64__
{
basetype = get_basetype(typeinfo, &desc->lprgelemdescParam[param_idx].tdesc);
if (basetype == FC_FLOAT)
float_mask |= (1 << ((param_idx + 1) * 2));
else if (basetype == FC_DOUBLE)
float_mask |= (2 << ((param_idx + 1) * 2));
unsigned short float_mask = 0;
for (i = 0; i < desc->cParams && i < 3; i++)
{
unsigned char basetype = get_basetype(typeinfo, &desc->lprgelemdescParam[i].tdesc);
if (basetype == FC_FLOAT) float_mask |= (1 << ((i + 1) * 2));
else if (basetype == FC_DOUBLE) float_mask |= (2 << ((i + 1) * 2));
}
WRITE_CHAR (proc, *proclen, 10); /* extension size */
WRITE_CHAR (proc, *proclen, 1); /* HasNewCorrDesc */
WRITE_SHORT(proc, *proclen, 0); /* ClientCorrHint */
WRITE_SHORT(proc, *proclen, 0); /* ServerCorrHint */
WRITE_SHORT(proc, *proclen, 0); /* NotifyIndex */
WRITE_SHORT(proc, *proclen, float_mask);
}
#else
{
unsigned int len, count = stack_size / sizeof(void *);
unsigned char *params = malloc( count );
count = fill_params_array( typeinfo, desc, params, count );
len = compress_params_array( params, count );
WRITE_CHAR (proc, *proclen, 8 + 3 + len + !(len % 2) ); /* extension size */
WRITE_CHAR (proc, *proclen, 1); /* HasNewCorrDesc */
WRITE_SHORT(proc, *proclen, 0); /* ClientCorrHint */
WRITE_SHORT(proc, *proclen, 0); /* ServerCorrHint */
WRITE_SHORT(proc, *proclen, 0); /* NotifyIndex */
WRITE_SHORT(proc, *proclen, count);
WRITE_CHAR (proc, *proclen, len);
for (i = 0; i < len; i++) WRITE_CHAR (proc, *proclen, params[i]);
if (!(len % 2)) WRITE_CHAR (proc, *proclen, 0);
free( params );
}
WRITE_SHORT(proc, *proclen, float_mask);
#endif
}
@@ -1198,9 +1366,9 @@ static HRESULT build_format_strings(ITypeInfo *typeinfo, WORD funcs,
hr = write_iface_fs(typeinfo, funcs, parentfuncs, NULL, &typelen, NULL, &proclen, NULL);
if (FAILED(hr)) return hr;
type = heap_alloc(typelen);
proc = heap_alloc(proclen);
offset = heap_alloc((parentfuncs + funcs - 3) * sizeof(*offset));
type = malloc(typelen);
proc = malloc(proclen);
offset = malloc((parentfuncs + funcs - 3) * sizeof(*offset));
if (!type || !proc || !offset)
{
ERR("Failed to allocate format strings.\n");
@@ -1222,17 +1390,17 @@ static HRESULT build_format_strings(ITypeInfo *typeinfo, WORD funcs,
}
err:
heap_free(type);
heap_free(proc);
heap_free(offset);
free(type);
free(proc);
free(offset);
return hr;
}
/* Common helper for Create{Proxy,Stub}FromTypeInfo(). */
static HRESULT get_iface_info(ITypeInfo **typeinfo, WORD *funcs, WORD *parentfuncs,
GUID *parentiid)
static HRESULT get_iface_info(ITypeInfo *typeinfo, WORD *funcs, WORD *parentfuncs,
GUID *parentiid, ITypeInfo **real_typeinfo)
{
ITypeInfo *real_typeinfo, *parentinfo;
ITypeInfo *parentinfo;
TYPEATTR *typeattr;
ITypeLib *typelib;
TLIBATTR *libattr;
@@ -1244,59 +1412,64 @@ static HRESULT get_iface_info(ITypeInfo **typeinfo, WORD *funcs, WORD *parentfun
/* Dual interfaces report their size to be sizeof(IDispatchVtbl) and their
* implemented type to be IDispatch. We need to retrieve the underlying
* interface to get that information. */
hr = ITypeInfo_GetTypeAttr(*typeinfo, &typeattr);
hr = ITypeInfo_GetTypeAttr(typeinfo, &typeattr);
if (FAILED(hr))
return hr;
typekind = typeattr->typekind;
ITypeInfo_ReleaseTypeAttr(*typeinfo, typeattr);
ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr);
if (typekind == TKIND_DISPATCH)
{
hr = ITypeInfo_GetRefTypeOfImplType(*typeinfo, -1, &reftype);
hr = ITypeInfo_GetRefTypeOfImplType(typeinfo, -1, &reftype);
if (FAILED(hr))
return hr;
hr = ITypeInfo_GetRefTypeInfo(*typeinfo, reftype, &real_typeinfo);
hr = ITypeInfo_GetRefTypeInfo(typeinfo, reftype, real_typeinfo);
if (FAILED(hr))
return hr;
ITypeInfo_Release(*typeinfo);
*typeinfo = real_typeinfo;
}
else
ITypeInfo_AddRef(*real_typeinfo = typeinfo);
hr = ITypeInfo_GetContainingTypeLib(*typeinfo, &typelib, NULL);
hr = ITypeInfo_GetContainingTypeLib(*real_typeinfo, &typelib, NULL);
if (FAILED(hr))
return hr;
goto err;
hr = ITypeLib_GetLibAttr(typelib, &libattr);
if (FAILED(hr))
{
ITypeLib_Release(typelib);
return hr;
goto err;
}
syskind = libattr->syskind;
ITypeLib_ReleaseTLibAttr(typelib, libattr);
ITypeLib_Release(typelib);
hr = ITypeInfo_GetTypeAttr(*typeinfo, &typeattr);
hr = ITypeInfo_GetTypeAttr(*real_typeinfo, &typeattr);
if (FAILED(hr))
return hr;
goto err;
*funcs = typeattr->cFuncs;
*parentfuncs = typeattr->cbSizeVft / (syskind == SYS_WIN64 ? 8 : 4) - *funcs;
ITypeInfo_ReleaseTypeAttr(*typeinfo, typeattr);
ITypeInfo_ReleaseTypeAttr(*real_typeinfo, typeattr);
hr = ITypeInfo_GetRefTypeOfImplType(*typeinfo, 0, &reftype);
hr = ITypeInfo_GetRefTypeOfImplType(*real_typeinfo, 0, &reftype);
if (FAILED(hr))
return hr;
hr = ITypeInfo_GetRefTypeInfo(*typeinfo, reftype, &parentinfo);
goto err;
hr = ITypeInfo_GetRefTypeInfo(*real_typeinfo, reftype, &parentinfo);
if (FAILED(hr))
return hr;
goto err;
hr = ITypeInfo_GetTypeAttr(parentinfo, &typeattr);
if (FAILED(hr))
return hr;
*parentiid = typeattr->guid;
ITypeInfo_ReleaseTypeAttr(parentinfo, typeattr);
if (SUCCEEDED(hr))
{
*parentiid = typeattr->guid;
ITypeInfo_ReleaseTypeAttr(parentinfo, typeattr);
}
ITypeInfo_Release(parentinfo);
if (SUCCEEDED(hr))
return hr;
err:
ITypeInfo_Release(*real_typeinfo);
return hr;
}
@@ -1324,7 +1497,7 @@ static ULONG WINAPI typelib_proxy_Release(IRpcProxyBuffer *iface)
struct typelib_proxy *proxy = CONTAINING_RECORD(iface, struct typelib_proxy, proxy.IRpcProxyBuffer_iface);
ULONG refcount = InterlockedDecrement(&proxy->proxy.RefCount);
TRACE("(%p) decreasing refs to %d\n", proxy, refcount);
TRACE("(%p) decreasing refs to %ld\n", proxy, refcount);
if (!refcount)
{
@@ -1334,11 +1507,11 @@ static ULONG WINAPI typelib_proxy_Release(IRpcProxyBuffer *iface)
IUnknown_Release(proxy->proxy.base_object);
if (proxy->proxy.base_proxy)
IRpcProxyBuffer_Release(proxy->proxy.base_proxy);
heap_free((void *)proxy->stub_desc.pFormatTypes);
heap_free((void *)proxy->proxy_info.ProcFormatString);
heap_free(proxy->offset_table);
heap_free(proxy->proxy_vtbl);
heap_free(proxy);
free((void *)proxy->stub_desc.pFormatTypes);
free((void *)proxy->proxy_info.ProcFormatString);
free(proxy->offset_table);
free(proxy->proxy_vtbl);
free(proxy);
}
return refcount;
}
@@ -1385,30 +1558,33 @@ HRESULT WINAPI CreateProxyFromTypeInfo(ITypeInfo *typeinfo, IUnknown *outer,
{
struct typelib_proxy *proxy;
WORD funcs, parentfuncs, i;
ITypeInfo *real_typeinfo;
GUID parentiid;
HRESULT hr;
TRACE("typeinfo %p, outer %p, iid %s, proxy_buffer %p, out %p.\n",
typeinfo, outer, debugstr_guid(iid), proxy_buffer, out);
hr = get_iface_info(&typeinfo, &funcs, &parentfuncs, &parentiid);
hr = get_iface_info(typeinfo, &funcs, &parentfuncs, &parentiid, &real_typeinfo);
if (FAILED(hr))
return hr;
if (!(proxy = heap_alloc_zero(sizeof(*proxy))))
if (!(proxy = calloc(1, sizeof(*proxy))))
{
ERR("Failed to allocate proxy object.\n");
ITypeInfo_Release(real_typeinfo);
return E_OUTOFMEMORY;
}
init_stub_desc(&proxy->stub_desc);
proxy->proxy_info.pStubDesc = &proxy->stub_desc;
proxy->proxy_vtbl = heap_alloc_zero(sizeof(proxy->proxy_vtbl->header) + (funcs + parentfuncs) * sizeof(void *));
proxy->proxy_vtbl = calloc(1, sizeof(proxy->proxy_vtbl->header) + (funcs + parentfuncs) * sizeof(void *));
if (!proxy->proxy_vtbl)
{
ERR("Failed to allocate proxy vtbl.\n");
heap_free(proxy);
free(proxy);
ITypeInfo_Release(real_typeinfo);
return E_OUTOFMEMORY;
}
proxy->proxy_vtbl->header.pStublessProxyInfo = &proxy->proxy_info;
@@ -1418,12 +1594,13 @@ HRESULT WINAPI CreateProxyFromTypeInfo(ITypeInfo *typeinfo, IUnknown *outer,
for (i = 0; i < funcs; i++)
proxy->proxy_vtbl->Vtbl[parentfuncs + i] = (void *)-1;
hr = build_format_strings(typeinfo, funcs, parentfuncs, &proxy->stub_desc.pFormatTypes,
hr = build_format_strings(real_typeinfo, funcs, parentfuncs, &proxy->stub_desc.pFormatTypes,
&proxy->proxy_info.ProcFormatString, &proxy->offset_table);
ITypeInfo_Release(real_typeinfo);
if (FAILED(hr))
{
heap_free(proxy->proxy_vtbl);
heap_free(proxy);
free(proxy->proxy_vtbl);
free(proxy);
return hr;
}
proxy->proxy_info.FormatStringOffset = &proxy->offset_table[-3];
@@ -1431,11 +1608,11 @@ HRESULT WINAPI CreateProxyFromTypeInfo(ITypeInfo *typeinfo, IUnknown *outer,
hr = typelib_proxy_init(proxy, outer, funcs + parentfuncs, &parentiid, proxy_buffer, out);
if (FAILED(hr))
{
heap_free((void *)proxy->stub_desc.pFormatTypes);
heap_free((void *)proxy->proxy_info.ProcFormatString);
heap_free((void *)proxy->offset_table);
heap_free(proxy->proxy_vtbl);
heap_free(proxy);
free((void *)proxy->stub_desc.pFormatTypes);
free((void *)proxy->proxy_info.ProcFormatString);
free((void *)proxy->offset_table);
free(proxy->proxy_vtbl);
free(proxy);
}
return hr;
@@ -1457,7 +1634,7 @@ static ULONG WINAPI typelib_stub_Release(IRpcStubBuffer *iface)
struct typelib_stub *stub = CONTAINING_RECORD(iface, struct typelib_stub, stub.stub_buffer);
ULONG refcount = InterlockedDecrement(&stub->stub.stub_buffer.RefCount);
TRACE("(%p) decreasing refs to %d\n", stub, refcount);
TRACE("(%p) decreasing refs to %ld\n", stub, refcount);
if (!refcount)
{
@@ -1468,14 +1645,13 @@ static ULONG WINAPI typelib_stub_Release(IRpcStubBuffer *iface)
if (stub->stub.base_stub)
{
IRpcStubBuffer_Release(stub->stub.base_stub);
release_delegating_vtbl(stub->stub.base_obj);
heap_free(stub->dispatch_table);
free(stub->dispatch_table);
}
heap_free((void *)stub->stub_desc.pFormatTypes);
heap_free((void *)stub->server_info.ProcString);
heap_free(stub->offset_table);
heap_free(stub);
free((void *)stub->stub_desc.pFormatTypes);
free((void *)stub->server_info.ProcString);
free(stub->offset_table);
free(stub);
}
return refcount;
@@ -1490,7 +1666,7 @@ static HRESULT typelib_stub_init(struct typelib_stub *stub, IUnknown *server,
(void **)&stub->stub.stub_buffer.pvServerObject);
if (FAILED(hr))
{
WARN("Failed to get interface %s, hr %#x.\n",
WARN("Failed to get interface %s, hr %#lx.\n",
debugstr_guid(stub->stub_vtbl.header.piid), hr);
stub->stub.stub_buffer.pvServerObject = server;
IUnknown_AddRef(server);
@@ -1498,11 +1674,10 @@ static HRESULT typelib_stub_init(struct typelib_stub *stub, IUnknown *server,
if (!IsEqualGUID(parentiid, &IID_IUnknown))
{
stub->stub.base_obj = get_delegating_vtbl(stub->stub_vtbl.header.DispatchTableCount);
hr = create_stub(parentiid, (IUnknown *)&stub->stub.base_obj, &stub->stub.base_stub);
stub->stub.base_obj.lpVtbl = get_delegating_vtbl(stub->stub_vtbl.header.DispatchTableCount);
hr = create_stub(parentiid, &stub->stub.base_obj, &stub->stub.base_stub);
if (FAILED(hr))
{
release_delegating_vtbl(stub->stub.base_obj);
IUnknown_Release(stub->stub.stub_buffer.pvServerObject);
return hr;
}
@@ -1520,30 +1695,33 @@ HRESULT WINAPI CreateStubFromTypeInfo(ITypeInfo *typeinfo, REFIID iid,
{
WORD funcs, parentfuncs, i;
struct typelib_stub *stub;
ITypeInfo *real_typeinfo;
GUID parentiid;
HRESULT hr;
TRACE("typeinfo %p, iid %s, server %p, stub_buffer %p.\n",
typeinfo, debugstr_guid(iid), server, stub_buffer);
hr = get_iface_info(&typeinfo, &funcs, &parentfuncs, &parentiid);
hr = get_iface_info(typeinfo, &funcs, &parentfuncs, &parentiid, &real_typeinfo);
if (FAILED(hr))
return hr;
if (!(stub = heap_alloc_zero(sizeof(*stub))))
if (!(stub = calloc(1, sizeof(*stub))))
{
ERR("Failed to allocate stub object.\n");
ITypeInfo_Release(real_typeinfo);
return E_OUTOFMEMORY;
}
init_stub_desc(&stub->stub_desc);
stub->server_info.pStubDesc = &stub->stub_desc;
hr = build_format_strings(typeinfo, funcs, parentfuncs, &stub->stub_desc.pFormatTypes,
hr = build_format_strings(real_typeinfo, funcs, parentfuncs, &stub->stub_desc.pFormatTypes,
&stub->server_info.ProcString, &stub->offset_table);
ITypeInfo_Release(real_typeinfo);
if (FAILED(hr))
{
heap_free(stub);
free(stub);
return hr;
}
stub->server_info.FmtStringOffset = &stub->offset_table[-3];
@@ -1555,7 +1733,7 @@ HRESULT WINAPI CreateStubFromTypeInfo(ITypeInfo *typeinfo, REFIID iid,
if (!IsEqualGUID(&parentiid, &IID_IUnknown))
{
stub->dispatch_table = heap_alloc((funcs + parentfuncs) * sizeof(void *));
stub->dispatch_table = malloc((funcs + parentfuncs) * sizeof(void *));
for (i = 3; i < parentfuncs; i++)
stub->dispatch_table[i - 3] = NdrStubForwardingFunction;
for (; i < funcs + parentfuncs; i++)
@@ -1570,10 +1748,10 @@ HRESULT WINAPI CreateStubFromTypeInfo(ITypeInfo *typeinfo, REFIID iid,
hr = typelib_stub_init(stub, server, &parentiid, stub_buffer);
if (FAILED(hr))
{
heap_free((void *)stub->stub_desc.pFormatTypes);
heap_free((void *)stub->server_info.ProcString);
heap_free(stub->offset_table);
heap_free(stub);
free((void *)stub->stub_desc.pFormatTypes);
free((void *)stub->server_info.ProcString);
free(stub->offset_table);
free(stub);
}
return hr;
-2
View File
@@ -9,8 +9,6 @@
#define _INC_WINDOWS
#define COBJMACROS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include <ntstatus.h>
#define WIN32_NO_STATUS
+59
View File
@@ -0,0 +1,59 @@
#include <stdarg.h>
#include "rpc.h"
#include "rpcndr.h"
#include "rpcasync.h"
#include "wine/debug.h"
#include "rpc_binding.h"
#include "rpc_message.h"
#include "ndr_stubless.h"
WINE_DEFAULT_DEBUG_CHANNEL(rpc);
/***********************************************************************
* RpcGetAuthorizationContextForClient [RPCRT4.@]
*
* Called by RpcFreeAuthorizationContext to return the Authz context.
*
* PARAMS
* ClientBinding [I] Binding handle, represents a binding to a client on the server.
* ImpersonateOnReturn [I] Directs this function to be represented the client on return.
* Reserved1 [I] Reserved, equal to null.
* expiration_time [I] Points to the exact date and time when the token expires.
* Reserved2 [I] Reserved, equal to a LUID structure which has a members,
* each of them is set to zero.
* Reserved3 [I] Reserved, equal to zero.
* Reserved4 [I] Reserved, equal to null.
* authz_client_context [I] Points to an AUTHZ_CLIENT_CONTEXT_HANDLE structure
* that has direct pass to Authz functions.
*
* RETURNS
* Success: RPC_S_OK.
* Failure: Any error code.
*/
RPC_STATUS
WINAPI
RpcGetAuthorizationContextForClient(RPC_BINDING_HANDLE ClientBinding,
BOOL ImpersonateOnReturn,
void * Reserved1,
PLARGE_INTEGER expiration_time,
LUID Reserved2,
DWORD Reserved3,
PVOID Reserved4,
PVOID *authz_client_context)
{
FIXME("(%p, %d, %p, %p, (%d, %u), %u, %p, %p): stub\n",
ClientBinding,
ImpersonateOnReturn,
Reserved1,
expiration_time,
Reserved2.HighPart,
Reserved2.LowPart,
Reserved3,
Reserved4,
authz_client_context);
return RPC_S_NO_CONTEXT_AVAILABLE;
}
+26 -24
View File
@@ -20,11 +20,11 @@
*/
#include <stdarg.h>
#include <stdlib.h>
#include <assert.h>
#include "rpc.h"
#include "rpcndr.h"
#include "wine/winternl.h"
#include "wine/debug.h"
@@ -55,7 +55,7 @@ typedef struct _RpcContextHandle
NDR_RUNDOWN rundown_routine;
void *ctx_guard;
UUID uuid;
RTL_RWLOCK rw_lock;
CRITICAL_SECTION lock;
unsigned int refs;
} RpcContextHandle;
@@ -66,18 +66,18 @@ static RPC_STATUS RpcAssoc_Alloc(LPCSTR Protseq, LPCSTR NetworkAddr,
RpcAssoc **assoc_out)
{
RpcAssoc *assoc;
assoc = HeapAlloc(GetProcessHeap(), 0, sizeof(*assoc));
assoc = malloc(sizeof(*assoc));
if (!assoc)
return RPC_S_OUT_OF_RESOURCES;
assoc->refs = 1;
list_init(&assoc->free_connection_pool);
list_init(&assoc->context_handle_list);
InitializeCriticalSection(&assoc->cs);
InitializeCriticalSectionEx(&assoc->cs, 0, RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO);
assoc->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": RpcAssoc.cs");
assoc->Protseq = RPCRT4_strdupA(Protseq);
assoc->NetworkAddr = RPCRT4_strdupA(NetworkAddr);
assoc->Endpoint = RPCRT4_strdupA(Endpoint);
assoc->NetworkOptions = NetworkOptions ? RPCRT4_strdupW(NetworkOptions) : NULL;
assoc->Protseq = strdup(Protseq);
assoc->NetworkAddr = strdup(NetworkAddr);
assoc->Endpoint = strdup(Endpoint);
assoc->NetworkOptions = wcsdup(NetworkOptions);
assoc->assoc_group_id = 0;
assoc->connection_cnt = 0;
UuidCreate(&assoc->http_uuid);
@@ -210,15 +210,15 @@ ULONG RpcAssoc_Release(RpcAssoc *assoc)
LIST_FOR_EACH_ENTRY_SAFE(context_handle, context_handle_cursor, &assoc->context_handle_list, RpcContextHandle, entry)
RpcContextHandle_Destroy(context_handle);
HeapFree(GetProcessHeap(), 0, assoc->NetworkOptions);
HeapFree(GetProcessHeap(), 0, assoc->Endpoint);
HeapFree(GetProcessHeap(), 0, assoc->NetworkAddr);
HeapFree(GetProcessHeap(), 0, assoc->Protseq);
free(assoc->NetworkOptions);
free(assoc->Endpoint);
free(assoc->NetworkAddr);
free(assoc->Protseq);
assoc->cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&assoc->cs);
HeapFree(GetProcessHeap(), 0, assoc);
free(assoc);
}
return refs;
@@ -245,14 +245,14 @@ static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection *
InterfaceId, TransferSyntax);
status = RPCRT4_Send(conn, hdr, NULL, 0);
RPCRT4_FreeHeader(hdr);
free(hdr);
if (status != RPC_S_OK)
return status;
status = RPCRT4_ReceiveWithAuth(conn, &response_hdr, &msg, &auth_data, &auth_length);
if (status != RPC_S_OK)
{
ERR("receive failed with error %d\n", status);
ERR("receive failed with error %ld\n", status);
return status;
}
@@ -356,8 +356,8 @@ static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection *
}
I_RpcFree(msg.Buffer);
RPCRT4_FreeHeader(response_hdr);
HeapFree(GetProcessHeap(), 0, auth_data);
free(response_hdr);
free(auth_data);
return status;
}
@@ -458,17 +458,18 @@ RPC_STATUS RpcServerAssoc_AllocateContextHandle(RpcAssoc *assoc, void *CtxGuard,
{
RpcContextHandle *context_handle;
context_handle = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*context_handle));
context_handle = calloc(1, sizeof(*context_handle));
if (!context_handle)
return RPC_S_OUT_OF_MEMORY;
context_handle->ctx_guard = CtxGuard;
RtlInitializeResource(&context_handle->rw_lock);
InitializeCriticalSectionEx(&context_handle->lock, 0, RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO);
context_handle->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": RpcContextHandle.lock");
context_handle->refs = 1;
/* lock here to mirror unmarshall, so we don't need to special-case the
* freeing of a non-marshalled context handle */
RtlAcquireResourceExclusive(&context_handle->rw_lock, TRUE);
EnterCriticalSection(&context_handle->lock);
EnterCriticalSection(&assoc->cs);
list_add_tail(&assoc->context_handle_list, &context_handle->entry);
@@ -500,7 +501,7 @@ RPC_STATUS RpcServerAssoc_FindContextHandle(RpcAssoc *assoc, const UUID *uuid,
{
LeaveCriticalSection(&assoc->cs);
TRACE("found %p\n", context_handle);
RtlAcquireResourceExclusive(&context_handle->rw_lock, TRUE);
EnterCriticalSection(&context_handle->lock);
return RPC_S_OK;
}
}
@@ -555,9 +556,10 @@ static void RpcContextHandle_Destroy(RpcContextHandle *context_handle)
context_handle->rundown_routine(context_handle->user_context);
}
RtlDeleteResource(&context_handle->rw_lock);
context_handle->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&context_handle->lock);
HeapFree(GetProcessHeap(), 0, context_handle);
free(context_handle);
}
unsigned int RpcServerAssoc_ReleaseContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SContext, BOOL release_lock)
@@ -566,7 +568,7 @@ unsigned int RpcServerAssoc_ReleaseContextHandle(RpcAssoc *assoc, NDR_SCONTEXT S
unsigned int refs;
if (release_lock)
RtlReleaseResource(&context_handle->rw_lock);
LeaveCriticalSection(&context_handle->lock);
EnterCriticalSection(&assoc->cs);
refs = --context_handle->refs;
+12 -12
View File
@@ -49,17 +49,17 @@ typedef struct _RpcAssoc
struct list context_handle_list; /* protected by cs */
} RpcAssoc;
RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAssoc **assoc) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAssoc **assoc);
RPC_STATUS RpcAssoc_GetClientConnection(RpcAssoc *assoc, const RPC_SYNTAX_IDENTIFIER *InterfaceId,
const RPC_SYNTAX_IDENTIFIER *TransferSyntax, RpcAuthInfo *AuthInfo, RpcQualityOfService *QOS,
LPCWSTR CookieAuth, RpcConnection **Connection, BOOL *from_cache) DECLSPEC_HIDDEN;
void RpcAssoc_ReleaseIdleConnection(RpcAssoc *assoc, RpcConnection *Connection) DECLSPEC_HIDDEN;
ULONG RpcAssoc_Release(RpcAssoc *assoc) DECLSPEC_HIDDEN;
RPC_STATUS RpcServerAssoc_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, ULONG assoc_gid, RpcAssoc **assoc_out) DECLSPEC_HIDDEN;
RPC_STATUS RpcServerAssoc_AllocateContextHandle(RpcAssoc *assoc, void *CtxGuard, NDR_SCONTEXT *SContext) DECLSPEC_HIDDEN;
RPC_STATUS RpcServerAssoc_FindContextHandle(RpcAssoc *assoc, const UUID *uuid, void *CtxGuard, ULONG Flags, NDR_SCONTEXT *SContext) DECLSPEC_HIDDEN;
RPC_STATUS RpcServerAssoc_UpdateContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SContext, void *CtxGuard, NDR_RUNDOWN rundown_routine) DECLSPEC_HIDDEN;
unsigned int RpcServerAssoc_ReleaseContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SContext, BOOL release_lock) DECLSPEC_HIDDEN;
void RpcContextHandle_GetUuid(NDR_SCONTEXT SContext, UUID *uuid) DECLSPEC_HIDDEN;
BOOL RpcContextHandle_IsGuardCorrect(NDR_SCONTEXT SContext, void *CtxGuard) DECLSPEC_HIDDEN;
void RpcAssoc_ConnectionReleased(RpcAssoc *assoc) DECLSPEC_HIDDEN;
LPCWSTR CookieAuth, RpcConnection **Connection, BOOL *from_cache);
void RpcAssoc_ReleaseIdleConnection(RpcAssoc *assoc, RpcConnection *Connection);
ULONG RpcAssoc_Release(RpcAssoc *assoc);
RPC_STATUS RpcServerAssoc_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, ULONG assoc_gid, RpcAssoc **assoc_out);
RPC_STATUS RpcServerAssoc_AllocateContextHandle(RpcAssoc *assoc, void *CtxGuard, NDR_SCONTEXT *SContext);
RPC_STATUS RpcServerAssoc_FindContextHandle(RpcAssoc *assoc, const UUID *uuid, void *CtxGuard, ULONG Flags, NDR_SCONTEXT *SContext);
RPC_STATUS RpcServerAssoc_UpdateContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SContext, void *CtxGuard, NDR_RUNDOWN rundown_routine);
unsigned int RpcServerAssoc_ReleaseContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SContext, BOOL release_lock);
void RpcContextHandle_GetUuid(NDR_SCONTEXT SContext, UUID *uuid);
BOOL RpcContextHandle_IsGuardCorrect(NDR_SCONTEXT SContext, void *CtxGuard);
void RpcAssoc_ConnectionReleased(RpcAssoc *assoc);
+1 -48
View File
@@ -143,7 +143,7 @@ RPC_STATUS WINAPI RpcAsyncCompleteCall(PRPC_ASYNC_STATE pAsync, void *Reply)
*/
RPC_STATUS WINAPI RpcAsyncAbortCall(PRPC_ASYNC_STATE pAsync, ULONG ExceptionCode)
{
FIXME("(%p, %d/0x%x): stub\n", pAsync, ExceptionCode, ExceptionCode);
FIXME("(%p, %ld/0x%lx): stub\n", pAsync, ExceptionCode, ExceptionCode);
return RPC_S_INVALID_ASYNC_HANDLE;
}
@@ -166,50 +166,3 @@ RPC_STATUS WINAPI RpcAsyncCancelCall(PRPC_ASYNC_STATE pAsync, BOOL fAbortCall)
FIXME("(%p, %s): stub\n", pAsync, fAbortCall ? "TRUE" : "FALSE");
return RPC_S_INVALID_ASYNC_HANDLE;
}
#ifdef __REACTOS__
/***********************************************************************
* RpcGetAuthorizationContextForClient [RPCRT4.@]
*
* Called by RpcFreeAuthorizationContext to return the Authz context.
*
* PARAMS
* ClientBinding [I] Binding handle, represents a binding to a client on the server.
* ImpersonateOnReturn [I] Directs this function to be represented the client on return.
* Reserved1 [I] Reserved, equal to null.
* expiration_time [I] Points to the exact date and time when the token expires.
* Reserved2 [I] Reserved, equal to a LUID structure which has a members,
* each of them is set to zero.
* Reserved3 [I] Reserved, equal to zero.
* Reserved4 [I] Reserved, equal to null.
* authz_client_context [I] Points to an AUTHZ_CLIENT_CONTEXT_HANDLE structure
* that has direct pass to Authz functions.
*
* RETURNS
* Success: RPC_S_OK.
* Failure: Any error code.
*/
RPC_STATUS
WINAPI
RpcGetAuthorizationContextForClient(RPC_BINDING_HANDLE ClientBinding,
BOOL ImpersonateOnReturn,
void * Reserved1,
PLARGE_INTEGER expiration_time,
LUID Reserved2,
DWORD Reserved3,
PVOID Reserved4,
PVOID *authz_client_context)
{
FIXME("(%p, %d, %p, %p, (%d, %u), %u, %p, %p): stub\n",
ClientBinding,
ImpersonateOnReturn,
Reserved1,
expiration_time,
Reserved2.HighPart,
Reserved2.LowPart,
Reserved3,
Reserved4,
authz_client_context);
return RPC_S_NO_CONTEXT_AVAILABLE;
}
#endif
+146 -152
View File
@@ -23,6 +23,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
@@ -30,7 +31,7 @@
#include "winbase.h"
#include "winnls.h"
#include "winerror.h"
#include "wine/winternl.h"
#include "winternl.h"
#include "rpc.h"
#include "rpcndr.h"
@@ -42,26 +43,13 @@
WINE_DEFAULT_DEBUG_CHANNEL(rpc);
LPSTR RPCRT4_strndupA(LPCSTR src, INT slen)
{
DWORD len;
LPSTR s;
if (!src) return NULL;
if (slen == -1) slen = strlen(src);
len = slen;
s = HeapAlloc(GetProcessHeap(), 0, len+1);
memcpy(s, src, len);
s[len] = 0;
return s;
}
LPSTR RPCRT4_strdupWtoA(LPCWSTR src)
{
DWORD len;
LPSTR s;
if (!src) return NULL;
len = WideCharToMultiByte(CP_ACP, 0, src, -1, NULL, 0, NULL, NULL);
s = HeapAlloc(GetProcessHeap(), 0, len);
s = malloc(len);
WideCharToMultiByte(CP_ACP, 0, src, -1, s, len, NULL, NULL);
return s;
}
@@ -72,7 +60,7 @@ LPWSTR RPCRT4_strdupAtoW(LPCSTR src)
LPWSTR s;
if (!src) return NULL;
len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0);
s = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
s = malloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, src, -1, s, len);
return s;
}
@@ -83,7 +71,7 @@ static LPWSTR RPCRT4_strndupAtoW(LPCSTR src, INT slen)
LPWSTR s;
if (!src) return NULL;
len = MultiByteToWideChar(CP_ACP, 0, src, slen, NULL, 0);
s = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
s = malloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, src, slen, s, len);
return s;
}
@@ -95,22 +83,17 @@ LPWSTR RPCRT4_strndupW(LPCWSTR src, INT slen)
if (!src) return NULL;
if (slen == -1) slen = lstrlenW(src);
len = slen;
s = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR));
s = malloc((len + 1) * sizeof(WCHAR));
memcpy(s, src, len*sizeof(WCHAR));
s[len] = 0;
return s;
}
void RPCRT4_strfree(LPSTR src)
{
HeapFree(GetProcessHeap(), 0, src);
}
static RPC_STATUS RPCRT4_AllocBinding(RpcBinding** Binding, BOOL server)
{
RpcBinding* NewBinding;
NewBinding = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcBinding));
NewBinding = calloc(1, sizeof(RpcBinding));
NewBinding->refs = 1;
NewBinding->server = server;
@@ -124,7 +107,7 @@ static RPC_STATUS RPCRT4_CreateBindingA(RpcBinding** Binding, BOOL server, LPCST
RpcBinding* NewBinding;
RPCRT4_AllocBinding(&NewBinding, server);
NewBinding->Protseq = RPCRT4_strdupA(Protseq);
NewBinding->Protseq = strdup(Protseq);
TRACE("binding: %p\n", NewBinding);
*Binding = NewBinding;
@@ -153,11 +136,11 @@ static RPC_STATUS RPCRT4_CompleteBindingA(RpcBinding* Binding, LPCSTR NetworkAdd
TRACE("(RpcBinding == ^%p, NetworkAddr == %s, EndPoint == %s, NetworkOptions == %s)\n", Binding,
debugstr_a(NetworkAddr), debugstr_a(Endpoint), debugstr_a(NetworkOptions));
RPCRT4_strfree(Binding->NetworkAddr);
Binding->NetworkAddr = RPCRT4_strdupA(NetworkAddr);
RPCRT4_strfree(Binding->Endpoint);
Binding->Endpoint = RPCRT4_strdupA(Endpoint);
HeapFree(GetProcessHeap(), 0, Binding->NetworkOptions);
free(Binding->NetworkAddr);
Binding->NetworkAddr = strdup(NetworkAddr);
free(Binding->Endpoint);
Binding->Endpoint = strdup(Endpoint);
free(Binding->NetworkOptions);
Binding->NetworkOptions = RPCRT4_strdupAtoW(NetworkOptions);
/* only attempt to get an association if the binding is complete */
@@ -181,12 +164,12 @@ static RPC_STATUS RPCRT4_CompleteBindingW(RpcBinding* Binding, LPCWSTR NetworkAd
TRACE("(RpcBinding == ^%p, NetworkAddr == %s, EndPoint == %s, NetworkOptions == %s)\n", Binding,
debugstr_w(NetworkAddr), debugstr_w(Endpoint), debugstr_w(NetworkOptions));
RPCRT4_strfree(Binding->NetworkAddr);
free(Binding->NetworkAddr);
Binding->NetworkAddr = RPCRT4_strdupWtoA(NetworkAddr);
RPCRT4_strfree(Binding->Endpoint);
free(Binding->Endpoint);
Binding->Endpoint = RPCRT4_strdupWtoA(Endpoint);
HeapFree(GetProcessHeap(), 0, Binding->NetworkOptions);
Binding->NetworkOptions = RPCRT4_strdupW(NetworkOptions);
free(Binding->NetworkOptions);
Binding->NetworkOptions = wcsdup(NetworkOptions);
/* only attempt to get an association if the binding is complete */
if (Endpoint && Endpoint[0] != '\0')
@@ -207,8 +190,8 @@ RPC_STATUS RPCRT4_ResolveBinding(RpcBinding* Binding, LPCSTR Endpoint)
TRACE("(RpcBinding == ^%p, EndPoint == \"%s\"\n", Binding, Endpoint);
RPCRT4_strfree(Binding->Endpoint);
Binding->Endpoint = RPCRT4_strdupA(Endpoint);
free(Binding->Endpoint);
Binding->Endpoint = strdup(Endpoint);
if (Binding->Assoc) RpcAssoc_Release(Binding->Assoc);
Binding->Assoc = NULL;
@@ -235,9 +218,9 @@ RPC_STATUS RPCRT4_MakeBinding(RpcBinding** Binding, RpcConnection* Connection)
TRACE("(RpcBinding == ^%p, Connection == ^%p)\n", Binding, Connection);
RPCRT4_AllocBinding(&NewBinding, Connection->server);
NewBinding->Protseq = RPCRT4_strdupA(rpcrt4_conn_get_name(Connection));
NewBinding->NetworkAddr = RPCRT4_strdupA(Connection->NetworkAddr);
NewBinding->Endpoint = RPCRT4_strdupA(Connection->Endpoint);
NewBinding->Protseq = strdup(rpcrt4_conn_get_name(Connection));
NewBinding->NetworkAddr = strdup(Connection->NetworkAddr);
NewBinding->Endpoint = strdup(Connection->Endpoint);
NewBinding->FromConn = Connection;
TRACE("binding: %p\n", NewBinding);
@@ -258,14 +241,14 @@ RPC_STATUS RPCRT4_ReleaseBinding(RpcBinding* Binding)
TRACE("binding: %p\n", Binding);
if (Binding->Assoc) RpcAssoc_Release(Binding->Assoc);
RPCRT4_strfree(Binding->Endpoint);
RPCRT4_strfree(Binding->NetworkAddr);
RPCRT4_strfree(Binding->Protseq);
HeapFree(GetProcessHeap(), 0, Binding->NetworkOptions);
HeapFree(GetProcessHeap(), 0, Binding->CookieAuth);
free(Binding->Endpoint);
free(Binding->NetworkAddr);
free(Binding->Protseq);
free(Binding->NetworkOptions);
free(Binding->CookieAuth);
if (Binding->AuthInfo) RpcAuthInfo_Release(Binding->AuthInfo);
if (Binding->QOS) RpcQualityOfService_Release(Binding->QOS);
HeapFree(GetProcessHeap(), 0, Binding);
free(Binding);
return RPC_S_OK;
}
@@ -308,10 +291,10 @@ RPC_STATUS RPCRT4_CloseBinding(RpcBinding* Binding, RpcConnection* Connection)
static LPSTR RPCRT4_strconcatA(LPSTR dst, LPCSTR src)
{
DWORD len = strlen(dst), slen = strlen(src);
LPSTR ndst = HeapReAlloc(GetProcessHeap(), 0, dst, (len+slen+2)*sizeof(CHAR));
char *ndst = realloc(dst, len + slen + 2);
if (!ndst)
{
HeapFree(GetProcessHeap(), 0, dst);
free(dst);
return NULL;
}
ndst[len] = ',';
@@ -322,10 +305,10 @@ static LPSTR RPCRT4_strconcatA(LPSTR dst, LPCSTR src)
static LPWSTR RPCRT4_strconcatW(LPWSTR dst, LPCWSTR src)
{
DWORD len = lstrlenW(dst), slen = lstrlenW(src);
LPWSTR ndst = HeapReAlloc(GetProcessHeap(), 0, dst, (len+slen+2)*sizeof(WCHAR));
if (!ndst)
WCHAR *ndst = realloc(dst, (len + slen + 2) * sizeof(WCHAR));
if (!ndst)
{
HeapFree(GetProcessHeap(), 0, dst);
free(dst);
return NULL;
}
ndst[len] = ',';
@@ -414,7 +397,7 @@ static RPC_CSTR unescape_string_binding_component(
if (len == -1) len = strlen((const char *)string_binding);
component = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(*component));
component = malloc((len + 1) * sizeof(*component));
if (!component) return NULL;
for (p = component; len > 0; string_binding++, len--) {
if (*string_binding == '\\') {
@@ -436,7 +419,7 @@ static RPC_WSTR unescape_string_binding_componentW(
if (len == -1) len = lstrlenW(string_binding);
component = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(*component));
component = malloc((len + 1) * sizeof(*component));
if (!component) return NULL;
for (p = component; len > 0; string_binding++, len--) {
if (*string_binding == '\\') {
@@ -473,7 +456,7 @@ RPC_STATUS WINAPI RpcStringBindingComposeA(RPC_CSTR ObjUuid, RPC_CSTR Protseq,
if (Endpoint && *Endpoint) len += strlen((char*)Endpoint) * 2 + 2;
if (Options && *Options) len += strlen((char*)Options) * 2 + 2;
data = HeapAlloc(GetProcessHeap(), 0, len);
data = malloc(len);
*StringBinding = data;
if (ObjUuid && *ObjUuid) {
@@ -526,7 +509,7 @@ RPC_STATUS WINAPI RpcStringBindingComposeW( RPC_WSTR ObjUuid, RPC_WSTR Protseq,
if (Endpoint && *Endpoint) len += lstrlenW(Endpoint) * 2 + 2;
if (Options && *Options) len += lstrlenW(Options) * 2 + 2;
data = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
data = malloc(len * sizeof(WCHAR));
*StringBinding = data;
if (ObjUuid && *ObjUuid) {
@@ -587,13 +570,13 @@ RPC_STATUS WINAPI RpcStringBindingParseA( RPC_CSTR StringBinding, RPC_CSTR *ObjU
RPC_CSTR str_uuid = unescape_string_binding_component(data, next - data);
status = UuidFromStringA(str_uuid, &uuid);
if (status != RPC_S_OK) {
HeapFree(GetProcessHeap(), 0, str_uuid);
free(str_uuid);
return status;
}
if (ObjUuid)
*ObjUuid = str_uuid;
else
HeapFree(GetProcessHeap(), 0, str_uuid);
free(str_uuid);
data = next+1;
}
@@ -629,14 +612,14 @@ RPC_STATUS WINAPI RpcStringBindingParseA( RPC_CSTR StringBinding, RPC_CSTR *ObjU
/* not an option, must be an endpoint */
if (endpoint_already_found) goto fail;
if (Endpoint) *Endpoint = opt;
else HeapFree(GetProcessHeap(), 0, opt);
else free(opt);
endpoint_already_found = TRUE;
} else {
if (strncmp((const char *)opt, ep_opt, strlen(ep_opt)) == 0) {
/* endpoint option */
if (endpoint_already_found) goto fail;
if (Endpoint) *Endpoint = unescape_string_binding_component(next+1, -1);
HeapFree(GetProcessHeap(), 0, opt);
free(opt);
endpoint_already_found = TRUE;
} else {
/* network option */
@@ -644,11 +627,11 @@ RPC_STATUS WINAPI RpcStringBindingParseA( RPC_CSTR StringBinding, RPC_CSTR *ObjU
if (*Options) {
/* FIXME: this is kind of inefficient */
*Options = (unsigned char*) RPCRT4_strconcatA( (char*)*Options, (char *)opt);
HeapFree(GetProcessHeap(), 0, opt);
free(opt);
} else
*Options = opt;
} else
HeapFree(GetProcessHeap(), 0, opt);
free(opt);
}
}
}
@@ -678,7 +661,6 @@ RPC_STATUS WINAPI RpcStringBindingParseW( RPC_WSTR StringBinding, RPC_WSTR *ObjU
RPC_WSTR *Endpoint, RPC_WSTR *Options)
{
const WCHAR *data, *next;
static const WCHAR ep_opt[] = {'e','n','d','p','o','i','n','t','=',0};
BOOL endpoint_already_found = FALSE;
TRACE("(%s,%p,%p,%p,%p,%p)\n", debugstr_w(StringBinding),
@@ -699,13 +681,13 @@ RPC_STATUS WINAPI RpcStringBindingParseW( RPC_WSTR StringBinding, RPC_WSTR *ObjU
RPC_WSTR str_uuid = unescape_string_binding_componentW(data, next - data);
status = UuidFromStringW(str_uuid, &uuid);
if (status != RPC_S_OK) {
HeapFree(GetProcessHeap(), 0, str_uuid);
free(str_uuid);
return status;
}
if (ObjUuid)
*ObjUuid = str_uuid;
else
HeapFree(GetProcessHeap(), 0, str_uuid);
free(str_uuid);
data = next+1;
}
@@ -741,14 +723,14 @@ RPC_STATUS WINAPI RpcStringBindingParseW( RPC_WSTR StringBinding, RPC_WSTR *ObjU
/* not an option, must be an endpoint */
if (endpoint_already_found) goto fail;
if (Endpoint) *Endpoint = opt;
else HeapFree(GetProcessHeap(), 0, opt);
else free(opt);
endpoint_already_found = TRUE;
} else {
if (wcsncmp(opt, ep_opt, lstrlenW(ep_opt)) == 0) {
if (wcsncmp(opt, L"endpoint=", lstrlenW(L"endpoint=")) == 0) {
/* endpoint option */
if (endpoint_already_found) goto fail;
if (Endpoint) *Endpoint = unescape_string_binding_componentW(next+1, -1);
HeapFree(GetProcessHeap(), 0, opt);
free(opt);
endpoint_already_found = TRUE;
} else {
/* network option */
@@ -756,11 +738,11 @@ RPC_STATUS WINAPI RpcStringBindingParseW( RPC_WSTR StringBinding, RPC_WSTR *ObjU
if (*Options) {
/* FIXME: this is kind of inefficient */
*Options = RPCRT4_strconcatW(*Options, opt);
HeapFree(GetProcessHeap(), 0, opt);
free(opt);
} else
*Options = opt;
} else
HeapFree(GetProcessHeap(), 0, opt);
free(opt);
}
}
}
@@ -805,7 +787,7 @@ RPC_STATUS WINAPI RpcBindingVectorFree( RPC_BINDING_VECTOR** BindingVector )
TRACE("(%p)\n", BindingVector);
for (c=0; c<(*BindingVector)->Count; c++) RpcBindingFree(&(*BindingVector)->BindingH[c]);
HeapFree(GetProcessHeap(), 0, *BindingVector);
free(*BindingVector);
*BindingVector = NULL;
return RPC_S_OK;
}
@@ -1001,11 +983,11 @@ RPC_STATUS RPC_ENTRY RpcBindingCopy(
DestBinding->ObjectUuid = SrcBinding->ObjectUuid;
DestBinding->BlockingFn = SrcBinding->BlockingFn;
DestBinding->Protseq = RPCRT4_strndupA(SrcBinding->Protseq, -1);
DestBinding->NetworkAddr = RPCRT4_strndupA(SrcBinding->NetworkAddr, -1);
DestBinding->Endpoint = RPCRT4_strndupA(SrcBinding->Endpoint, -1);
DestBinding->NetworkOptions = RPCRT4_strdupW(SrcBinding->NetworkOptions);
DestBinding->CookieAuth = RPCRT4_strdupW(SrcBinding->CookieAuth);
DestBinding->Protseq = strdup(SrcBinding->Protseq);
DestBinding->NetworkAddr = strdup(SrcBinding->NetworkAddr);
DestBinding->Endpoint = strdup(SrcBinding->Endpoint);
DestBinding->NetworkOptions = wcsdup(SrcBinding->NetworkOptions);
DestBinding->CookieAuth = wcsdup(SrcBinding->CookieAuth);
if (SrcBinding->Assoc) SrcBinding->Assoc->refs++;
DestBinding->Assoc = SrcBinding->Assoc;
@@ -1027,7 +1009,7 @@ RPC_STATUS RPC_ENTRY RpcBindingReset(RPC_BINDING_HANDLE Binding)
TRACE("(%p)\n", Binding);
RPCRT4_strfree(bind->Endpoint);
free(bind->Endpoint);
bind->Endpoint = NULL;
if (bind->Assoc) RpcAssoc_Release(bind->Assoc);
bind->Assoc = NULL;
@@ -1120,7 +1102,7 @@ RPC_STATUS RpcAuthInfo_Create(ULONG AuthnLevel, ULONG AuthnSvc,
RPC_AUTH_IDENTITY_HANDLE identity,
RpcAuthInfo **ret)
{
RpcAuthInfo *AuthInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(*AuthInfo));
RpcAuthInfo *AuthInfo = malloc(sizeof(*AuthInfo));
if (!AuthInfo)
return RPC_S_OUT_OF_MEMORY;
@@ -1138,10 +1120,10 @@ RPC_STATUS RpcAuthInfo_Create(ULONG AuthnLevel, ULONG AuthnSvc,
if (identity && has_nt_auth_identity(AuthnSvc))
{
const SEC_WINNT_AUTH_IDENTITY_W *nt_identity = identity;
AuthInfo->nt_identity = HeapAlloc(GetProcessHeap(), 0, sizeof(*AuthInfo->nt_identity));
AuthInfo->nt_identity = malloc(sizeof(*AuthInfo->nt_identity));
if (!AuthInfo->nt_identity)
{
HeapFree(GetProcessHeap(), 0, AuthInfo);
free(AuthInfo);
return RPC_S_OUT_OF_MEMORY;
}
@@ -1166,11 +1148,11 @@ RPC_STATUS RpcAuthInfo_Create(ULONG AuthnLevel, ULONG AuthnSvc,
(nt_identity->Domain && !AuthInfo->nt_identity->Domain) ||
(nt_identity->Password && !AuthInfo->nt_identity->Password))
{
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->User);
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Domain);
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Password);
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity);
HeapFree(GetProcessHeap(), 0, AuthInfo);
free(AuthInfo->nt_identity->User);
free(AuthInfo->nt_identity->Domain);
free(AuthInfo->nt_identity->Password);
free(AuthInfo->nt_identity);
free(AuthInfo);
return RPC_S_OUT_OF_MEMORY;
}
}
@@ -1194,13 +1176,13 @@ ULONG RpcAuthInfo_Release(RpcAuthInfo *AuthInfo)
FreeCredentialsHandle(&AuthInfo->cred);
if (AuthInfo->nt_identity)
{
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->User);
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Domain);
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Password);
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity);
free(AuthInfo->nt_identity->User);
free(AuthInfo->nt_identity->Domain);
free(AuthInfo->nt_identity->Password);
free(AuthInfo->nt_identity);
}
HeapFree(GetProcessHeap(), 0, AuthInfo->server_principal_name);
HeapFree(GetProcessHeap(), 0, AuthInfo);
free(AuthInfo->server_principal_name);
free(AuthInfo);
}
return refs;
@@ -1249,13 +1231,13 @@ BOOL RpcAuthInfo_IsEqual(const RpcAuthInfo *AuthInfo1, const RpcAuthInfo *AuthIn
static RPC_STATUS RpcQualityOfService_Create(const RPC_SECURITY_QOS *qos_src, BOOL unicode, RpcQualityOfService **qos_dst)
{
RpcQualityOfService *qos = HeapAlloc(GetProcessHeap(), 0, sizeof(*qos));
RpcQualityOfService *qos = malloc(sizeof(*qos));
if (!qos)
return RPC_S_OUT_OF_RESOURCES;
qos->refs = 1;
qos->qos = HeapAlloc(GetProcessHeap(), 0, sizeof(*qos->qos));
qos->qos = malloc(sizeof(*qos->qos));
if (!qos->qos) goto error;
qos->qos->Version = qos_src->Version;
qos->qos->Capabilities = qos_src->Capabilities;
@@ -1272,7 +1254,7 @@ static RPC_STATUS RpcQualityOfService_Create(const RPC_SECURITY_QOS *qos_src, BO
const RPC_HTTP_TRANSPORT_CREDENTIALS_W *http_credentials_src = qos_src2->u.HttpCredentials;
RPC_HTTP_TRANSPORT_CREDENTIALS_W *http_credentials_dst;
http_credentials_dst = HeapAlloc(GetProcessHeap(), 0, sizeof(*http_credentials_dst));
http_credentials_dst = malloc(sizeof(*http_credentials_dst));
qos->qos->u.HttpCredentials = http_credentials_dst;
if (!http_credentials_dst) goto error;
http_credentials_dst->TransportCredentials = NULL;
@@ -1284,7 +1266,7 @@ static RPC_STATUS RpcQualityOfService_Create(const RPC_SECURITY_QOS *qos_src, BO
if (http_credentials_src->TransportCredentials)
{
SEC_WINNT_AUTH_IDENTITY_W *cred_dst;
cred_dst = http_credentials_dst->TransportCredentials = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cred_dst));
cred_dst = http_credentials_dst->TransportCredentials = calloc(1, sizeof(*cred_dst));
if (!cred_dst) goto error;
cred_dst->Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
if (unicode)
@@ -1303,9 +1285,9 @@ static RPC_STATUS RpcQualityOfService_Create(const RPC_SECURITY_QOS *qos_src, BO
cred_dst->UserLength = MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->User, cred_src->UserLength, NULL, 0);
cred_dst->DomainLength = MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->Domain, cred_src->DomainLength, NULL, 0);
cred_dst->PasswordLength = MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->Password, cred_src->PasswordLength, NULL, 0);
cred_dst->User = HeapAlloc(GetProcessHeap(), 0, cred_dst->UserLength * sizeof(WCHAR));
cred_dst->Password = HeapAlloc(GetProcessHeap(), 0, cred_dst->PasswordLength * sizeof(WCHAR));
cred_dst->Domain = HeapAlloc(GetProcessHeap(), 0, cred_dst->DomainLength * sizeof(WCHAR));
cred_dst->User = malloc(cred_dst->UserLength * sizeof(WCHAR));
cred_dst->Password = malloc(cred_dst->PasswordLength * sizeof(WCHAR));
cred_dst->Domain = malloc(cred_dst->DomainLength * sizeof(WCHAR));
if (!cred_dst->Password || !cred_dst->Domain) goto error;
MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->User, cred_src->UserLength, cred_dst->User, cred_dst->UserLength);
MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->Domain, cred_src->DomainLength, cred_dst->Domain, cred_dst->DomainLength);
@@ -1314,7 +1296,7 @@ static RPC_STATUS RpcQualityOfService_Create(const RPC_SECURITY_QOS *qos_src, BO
}
if (http_credentials_src->NumberOfAuthnSchemes)
{
http_credentials_dst->AuthnSchemes = HeapAlloc(GetProcessHeap(), 0, http_credentials_src->NumberOfAuthnSchemes * sizeof(*http_credentials_dst->AuthnSchemes));
http_credentials_dst->AuthnSchemes = malloc(http_credentials_src->NumberOfAuthnSchemes * sizeof(*http_credentials_dst->AuthnSchemes));
if (!http_credentials_dst->AuthnSchemes) goto error;
memcpy(http_credentials_dst->AuthnSchemes, http_credentials_src->AuthnSchemes, http_credentials_src->NumberOfAuthnSchemes * sizeof(*http_credentials_dst->AuthnSchemes));
}
@@ -1342,18 +1324,18 @@ error:
{
if (qos->qos->u.HttpCredentials->TransportCredentials)
{
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->TransportCredentials->User);
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->TransportCredentials->Domain);
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->TransportCredentials->Password);
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->TransportCredentials);
free(qos->qos->u.HttpCredentials->TransportCredentials->User);
free(qos->qos->u.HttpCredentials->TransportCredentials->Domain);
free(qos->qos->u.HttpCredentials->TransportCredentials->Password);
free(qos->qos->u.HttpCredentials->TransportCredentials);
}
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->AuthnSchemes);
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->ServerCertificateSubject);
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials);
free(qos->qos->u.HttpCredentials->AuthnSchemes);
free(qos->qos->u.HttpCredentials->ServerCertificateSubject);
free(qos->qos->u.HttpCredentials);
}
HeapFree(GetProcessHeap(), 0, qos->qos);
free(qos->qos);
}
HeapFree(GetProcessHeap(), 0, qos);
free(qos);
return RPC_S_OUT_OF_RESOURCES;
}
@@ -1372,17 +1354,17 @@ ULONG RpcQualityOfService_Release(RpcQualityOfService *qos)
{
if (qos->qos->u.HttpCredentials->TransportCredentials)
{
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->TransportCredentials->User);
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->TransportCredentials->Domain);
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->TransportCredentials->Password);
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->TransportCredentials);
free(qos->qos->u.HttpCredentials->TransportCredentials->User);
free(qos->qos->u.HttpCredentials->TransportCredentials->Domain);
free(qos->qos->u.HttpCredentials->TransportCredentials->Password);
free(qos->qos->u.HttpCredentials->TransportCredentials);
}
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->AuthnSchemes);
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->ServerCertificateSubject);
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials);
free(qos->qos->u.HttpCredentials->AuthnSchemes);
free(qos->qos->u.HttpCredentials->ServerCertificateSubject);
free(qos->qos->u.HttpCredentials);
}
HeapFree(GetProcessHeap(), 0, qos->qos);
HeapFree(GetProcessHeap(), 0, qos);
free(qos->qos);
free(qos);
}
return refs;
}
@@ -1395,7 +1377,7 @@ BOOL RpcQualityOfService_IsEqual(const RpcQualityOfService *qos1, const RpcQuali
if (!qos1 || !qos2)
return FALSE;
TRACE("qos1 = { %d %d %d %d }, qos2 = { %d %d %d %d }\n",
TRACE("qos1 = { %ld %ld %ld %ld }, qos2 = { %ld %ld %ld %ld }\n",
qos1->qos->Capabilities, qos1->qos->IdentityTracking,
qos1->qos->ImpersonationType, qos1->qos->AdditionalSecurityInfoType,
qos2->qos->Capabilities, qos2->qos->IdentityTracking,
@@ -1486,7 +1468,7 @@ RpcBindingInqAuthInfoExA( RPC_BINDING_HANDLE Binding, RPC_CSTR *ServerPrincName,
RPC_STATUS status;
RPC_WSTR principal;
TRACE("%p %p %p %p %p %p %u %p\n", Binding, ServerPrincName, AuthnLevel,
TRACE("%p %p %p %p %p %p %lu %p\n", Binding, ServerPrincName, AuthnLevel,
AuthnSvc, AuthIdentity, AuthzSvc, RpcQosVersion, SecurityQOS);
status = RpcBindingInqAuthInfoExW(Binding, ServerPrincName ? &principal : NULL, AuthnLevel,
@@ -1511,7 +1493,7 @@ RpcBindingInqAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR *ServerPrincName,
{
RpcBinding *bind = Binding;
TRACE("%p %p %p %p %p %p %u %p\n", Binding, ServerPrincName, AuthnLevel,
TRACE("%p %p %p %p %p %p %lu %p\n", Binding, ServerPrincName, AuthnLevel,
AuthnSvc, AuthIdentity, AuthzSvc, RpcQosVersion, SecurityQOS);
if (!bind->AuthInfo) return RPC_S_BINDING_HAS_NO_AUTH;
@@ -1526,7 +1508,7 @@ RpcBindingInqAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR *ServerPrincName,
{
if (bind->AuthInfo->server_principal_name)
{
*ServerPrincName = RPCRT4_strdupW(bind->AuthInfo->server_principal_name);
*ServerPrincName = wcsdup(bind->AuthInfo->server_principal_name);
if (!*ServerPrincName) return RPC_S_OUT_OF_MEMORY;
}
else *ServerPrincName = NULL;
@@ -1600,7 +1582,7 @@ RpcBindingInqAuthClientExA( RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *
RPC_STATUS status;
RPC_WSTR principal;
TRACE("%p %p %p %p %p %p 0x%x\n", ClientBinding, Privs, ServerPrincName, AuthnLevel,
TRACE("%p %p %p %p %p %p 0x%lx\n", ClientBinding, Privs, ServerPrincName, AuthnLevel,
AuthnSvc, AuthzSvc, Flags);
status = RpcBindingInqAuthClientExW(ClientBinding, Privs, ServerPrincName ? &principal : NULL,
@@ -1625,7 +1607,7 @@ RpcBindingInqAuthClientExW( RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *
{
RpcBinding *bind;
TRACE("%p %p %p %p %p %p 0x%x\n", ClientBinding, Privs, ServerPrincName, AuthnLevel,
TRACE("%p %p %p %p %p %p 0x%lx\n", ClientBinding, Privs, ServerPrincName, AuthnLevel,
AuthnSvc, AuthzSvc, Flags);
if (!ClientBinding) ClientBinding = I_RpcGetCurrentCallHandle();
@@ -1655,8 +1637,8 @@ RpcBindingServerFromClient(RPC_BINDING_HANDLE ClientBinding, RPC_BINDING_HANDLE*
return RPC_S_INVALID_BINDING;
RPCRT4_AllocBinding(&NewBinding, TRUE);
NewBinding->Protseq = RPCRT4_strdupA(bind->Protseq);
NewBinding->NetworkAddr = RPCRT4_strdupA(bind->NetworkAddr);
NewBinding->Protseq = strdup(bind->Protseq);
NewBinding->NetworkAddr = strdup(bind->NetworkAddr);
*ServerBinding = NewBinding;
@@ -1681,21 +1663,21 @@ RpcBindingSetAuthInfoExA( RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName,
PSecPkgInfoA packages;
ULONG cbMaxToken;
TRACE("%p %s %u %u %p %u %p\n", Binding, debugstr_a((const char*)ServerPrincName),
TRACE("%p %s %lu %lu %p %lu %p\n", Binding, debugstr_a((const char*)ServerPrincName),
AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, SecurityQos);
if (SecurityQos)
{
RPC_STATUS status;
TRACE("SecurityQos { Version=%d, Capabilities=0x%x, IdentityTracking=%d, ImpersonationLevel=%d",
TRACE("SecurityQos { Version=%ld, Capabilities=0x%lx, IdentityTracking=%ld, ImpersonationLevel=%ld",
SecurityQos->Version, SecurityQos->Capabilities, SecurityQos->IdentityTracking, SecurityQos->ImpersonationType);
if (SecurityQos->Version >= 2)
{
const RPC_SECURITY_QOS_V2_A *SecurityQos2 = (const RPC_SECURITY_QOS_V2_A *)SecurityQos;
TRACE(", AdditionalSecurityInfoType=%d", SecurityQos2->AdditionalSecurityInfoType);
TRACE(", AdditionalSecurityInfoType=%ld", SecurityQos2->AdditionalSecurityInfoType);
if (SecurityQos2->AdditionalSecurityInfoType == RPC_C_AUTHN_INFO_TYPE_HTTP)
TRACE(", { %p, 0x%x, %d, %d, %p(%u), %s }",
TRACE(", { %p, 0x%lx, %ld, %ld, %p(%lu), %s }",
SecurityQos2->u.HttpCredentials->TransportCredentials,
SecurityQos2->u.HttpCredentials->Flags,
SecurityQos2->u.HttpCredentials->AuthenticationTarget,
@@ -1731,21 +1713,21 @@ RpcBindingSetAuthInfoExA( RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName,
if (AuthnLevel > RPC_C_AUTHN_LEVEL_PKT_PRIVACY)
{
FIXME("unknown AuthnLevel %u\n", AuthnLevel);
FIXME("unknown AuthnLevel %lu\n", AuthnLevel);
return RPC_S_UNKNOWN_AUTHN_LEVEL;
}
/* RPC_C_AUTHN_WINNT ignores the AuthzSvr parameter */
if (AuthzSvr && AuthnSvc != RPC_C_AUTHN_WINNT)
{
FIXME("unsupported AuthzSvr %u\n", AuthzSvr);
FIXME("unsupported AuthzSvr %lu\n", AuthzSvr);
return RPC_S_UNKNOWN_AUTHZ_SERVICE;
}
r = EnumerateSecurityPackagesA(&package_count, &packages);
if (r != SEC_E_OK)
{
ERR("EnumerateSecurityPackagesA failed with error 0x%08x\n", r);
ERR("EnumerateSecurityPackagesA failed with error 0x%08lx\n", r);
return RPC_S_SEC_PKG_ERROR;
}
@@ -1755,12 +1737,12 @@ RpcBindingSetAuthInfoExA( RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName,
if (i == package_count)
{
FIXME("unsupported AuthnSvc %u\n", AuthnSvc);
FIXME("unsupported AuthnSvc %lu\n", AuthnSvc);
FreeContextBuffer(packages);
return RPC_S_UNKNOWN_AUTHN_SERVICE;
}
TRACE("found package %s for service %u\n", packages[i].Name, AuthnSvc);
TRACE("found package %s for service %lu\n", packages[i].Name, AuthnSvc);
r = AcquireCredentialsHandleA(NULL, packages[i].Name, SECPKG_CRED_OUTBOUND, NULL,
AuthIdentity, NULL, NULL, &cred, &exp);
cbMaxToken = packages[i].cbMaxToken;
@@ -1790,7 +1772,7 @@ RpcBindingSetAuthInfoExA( RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName,
}
else
{
ERR("AcquireCredentialsHandleA failed with error 0x%08x\n", r);
ERR("AcquireCredentialsHandleA failed with error 0x%08lx\n", r);
return RPC_S_SEC_PKG_ERROR;
}
}
@@ -1812,21 +1794,21 @@ RpcBindingSetAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName,
PSecPkgInfoW packages;
ULONG cbMaxToken;
TRACE("%p %s %u %u %p %u %p\n", Binding, debugstr_w(ServerPrincName),
TRACE("%p %s %lu %lu %p %lu %p\n", Binding, debugstr_w(ServerPrincName),
AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, SecurityQos);
if (SecurityQos)
{
RPC_STATUS status;
TRACE("SecurityQos { Version=%d, Capabilities=0x%x, IdentityTracking=%d, ImpersonationLevel=%d",
TRACE("SecurityQos { Version=%ld, Capabilities=0x%lx, IdentityTracking=%ld, ImpersonationLevel=%ld",
SecurityQos->Version, SecurityQos->Capabilities, SecurityQos->IdentityTracking, SecurityQos->ImpersonationType);
if (SecurityQos->Version >= 2)
{
const RPC_SECURITY_QOS_V2_W *SecurityQos2 = (const RPC_SECURITY_QOS_V2_W *)SecurityQos;
TRACE(", AdditionalSecurityInfoType=%d", SecurityQos2->AdditionalSecurityInfoType);
TRACE(", AdditionalSecurityInfoType=%ld", SecurityQos2->AdditionalSecurityInfoType);
if (SecurityQos2->AdditionalSecurityInfoType == RPC_C_AUTHN_INFO_TYPE_HTTP)
TRACE(", { %p, 0x%x, %d, %d, %p(%u), %s }",
TRACE(", { %p, 0x%lx, %ld, %ld, %p(%lu), %s }",
SecurityQos2->u.HttpCredentials->TransportCredentials,
SecurityQos2->u.HttpCredentials->Flags,
SecurityQos2->u.HttpCredentials->AuthenticationTarget,
@@ -1862,21 +1844,21 @@ RpcBindingSetAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName,
if (AuthnLevel > RPC_C_AUTHN_LEVEL_PKT_PRIVACY)
{
FIXME("unknown AuthnLevel %u\n", AuthnLevel);
FIXME("unknown AuthnLevel %lu\n", AuthnLevel);
return RPC_S_UNKNOWN_AUTHN_LEVEL;
}
/* RPC_C_AUTHN_WINNT ignores the AuthzSvr parameter */
if (AuthzSvr && AuthnSvc != RPC_C_AUTHN_WINNT)
{
FIXME("unsupported AuthzSvr %u\n", AuthzSvr);
FIXME("unsupported AuthzSvr %lu\n", AuthzSvr);
return RPC_S_UNKNOWN_AUTHZ_SERVICE;
}
r = EnumerateSecurityPackagesW(&package_count, &packages);
if (r != SEC_E_OK)
{
ERR("EnumerateSecurityPackagesW failed with error 0x%08x\n", r);
ERR("EnumerateSecurityPackagesW failed with error 0x%08lx\n", r);
return RPC_S_SEC_PKG_ERROR;
}
@@ -1886,12 +1868,12 @@ RpcBindingSetAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName,
if (i == package_count)
{
FIXME("unsupported AuthnSvc %u\n", AuthnSvc);
FIXME("unsupported AuthnSvc %lu\n", AuthnSvc);
FreeContextBuffer(packages);
return RPC_S_UNKNOWN_AUTHN_SERVICE;
}
TRACE("found package %s for service %u\n", debugstr_w(packages[i].Name), AuthnSvc);
TRACE("found package %s for service %lu\n", debugstr_w(packages[i].Name), AuthnSvc);
r = AcquireCredentialsHandleW(NULL, packages[i].Name, SECPKG_CRED_OUTBOUND, NULL,
AuthIdentity, NULL, NULL, &cred, &exp);
cbMaxToken = packages[i].cbMaxToken;
@@ -1903,7 +1885,7 @@ RpcBindingSetAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName,
AuthIdentity, &new_auth_info);
if (r == RPC_S_OK)
{
new_auth_info->server_principal_name = RPCRT4_strdupW(ServerPrincName);
new_auth_info->server_principal_name = wcsdup(ServerPrincName);
if (!ServerPrincName || new_auth_info->server_principal_name)
{
if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
@@ -1921,7 +1903,7 @@ RpcBindingSetAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName,
}
else
{
ERR("AcquireCredentialsHandleW failed with error 0x%08x\n", r);
ERR("AcquireCredentialsHandleW failed with error 0x%08lx\n", r);
return RPC_S_SEC_PKG_ERROR;
}
}
@@ -1933,7 +1915,7 @@ RPCRTAPI RPC_STATUS RPC_ENTRY
RpcBindingSetAuthInfoA( RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName, ULONG AuthnLevel,
ULONG AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, ULONG AuthzSvr )
{
TRACE("%p %s %u %u %p %u\n", Binding, debugstr_a((const char*)ServerPrincName),
TRACE("%p %s %lu %lu %p %lu\n", Binding, debugstr_a((const char*)ServerPrincName),
AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr);
return RpcBindingSetAuthInfoExA(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, NULL);
}
@@ -1945,7 +1927,7 @@ RPCRTAPI RPC_STATUS RPC_ENTRY
RpcBindingSetAuthInfoW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, ULONG AuthnLevel,
ULONG AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, ULONG AuthzSvr )
{
TRACE("%p %s %u %u %p %u\n", Binding, debugstr_w(ServerPrincName),
TRACE("%p %s %lu %lu %p %lu\n", Binding, debugstr_w(ServerPrincName),
AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr);
return RpcBindingSetAuthInfoExW(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, NULL);
}
@@ -1955,7 +1937,7 @@ RpcBindingSetAuthInfoW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, UL
*/
RPC_STATUS WINAPI RpcBindingSetOption(RPC_BINDING_HANDLE BindingHandle, ULONG Option, ULONG_PTR OptionValue)
{
TRACE("(%p, %d, %ld)\n", BindingHandle, Option, OptionValue);
TRACE("(%p, %ld, %Id)\n", BindingHandle, Option, OptionValue);
switch (Option)
{
@@ -1966,15 +1948,15 @@ RPC_STATUS WINAPI RpcBindingSetOption(RPC_BINDING_HANDLE BindingHandle, ULONG Op
int len = MultiByteToWideChar(CP_ACP, 0, cookie->Buffer, cookie->BufferSize, NULL, 0);
WCHAR *str;
if (!(str = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)))) return RPC_S_OUT_OF_MEMORY;
if (!(str = malloc((len + 1) * sizeof(WCHAR)))) return RPC_S_OUT_OF_MEMORY;
MultiByteToWideChar(CP_ACP, 0, cookie->Buffer, cookie->BufferSize, str, len);
str[len] = 0;
HeapFree(GetProcessHeap(), 0, binding->CookieAuth);
free(binding->CookieAuth);
binding->CookieAuth = str;
break;
}
default:
FIXME("option %u not supported\n", Option);
FIXME("option %lu not supported\n", Option);
break;
}
return RPC_S_OK;
@@ -1986,6 +1968,18 @@ RPC_STATUS WINAPI RpcBindingSetOption(RPC_BINDING_HANDLE BindingHandle, ULONG Op
RPC_STATUS WINAPI I_RpcBindingInqLocalClientPID(RPC_BINDING_HANDLE ClientBinding, ULONG *ClientPID)
{
FIXME("%p %p: stub\n", ClientBinding, ClientPID);
return RPC_S_INVALID_BINDING;
RpcConnection *connection = NULL;
RpcBinding *binding;
TRACE("%p %p\n", ClientBinding, ClientPID);
binding = ClientBinding ? ClientBinding : RPCRT4_GetThreadCurrentCallHandle();
if (!binding)
return RPC_S_NO_CALL_ACTIVE;
connection = binding->FromConn;
if (!connection->ops->inquire_client_pid)
return RPC_S_INVALID_BINDING;
return connection->ops->inquire_client_pid(connection, ClientPID);
}
+33 -37
View File
@@ -118,6 +118,7 @@ struct connection_ops {
RPC_STATUS (*impersonate_client)(RpcConnection *conn);
RPC_STATUS (*revert_to_self)(RpcConnection *conn);
RPC_STATUS (*inquire_auth_client)(RpcConnection *, RPC_AUTHZ_HANDLE *, RPC_WSTR *, ULONG *, ULONG *, ULONG *, ULONG);
RPC_STATUS (*inquire_client_pid)(RpcConnection *conn, ULONG *pid);
};
/* don't know what MS's structure looks like */
@@ -142,43 +143,38 @@ typedef struct _RpcBinding
LPWSTR CookieAuth;
} RpcBinding;
LPSTR RPCRT4_strndupA(LPCSTR src, INT len) DECLSPEC_HIDDEN;
LPWSTR RPCRT4_strndupW(LPCWSTR src, INT len) DECLSPEC_HIDDEN;
LPSTR RPCRT4_strdupWtoA(LPCWSTR src) DECLSPEC_HIDDEN;
LPWSTR RPCRT4_strdupAtoW(LPCSTR src) DECLSPEC_HIDDEN;
void RPCRT4_strfree(LPSTR src) DECLSPEC_HIDDEN;
LPWSTR RPCRT4_strndupW(LPCWSTR src, INT len);
LPSTR RPCRT4_strdupWtoA(LPCWSTR src);
LPWSTR RPCRT4_strdupAtoW(LPCSTR src);
#define RPCRT4_strdupA(x) RPCRT4_strndupA((x),-1)
#define RPCRT4_strdupW(x) RPCRT4_strndupW((x),-1)
RPC_STATUS RpcAuthInfo_Create(ULONG AuthnLevel, ULONG AuthnSvc, CredHandle cred, TimeStamp exp, ULONG cbMaxToken, RPC_AUTH_IDENTITY_HANDLE identity, RpcAuthInfo **ret) DECLSPEC_HIDDEN;
ULONG RpcAuthInfo_AddRef(RpcAuthInfo *AuthInfo) DECLSPEC_HIDDEN;
ULONG RpcAuthInfo_Release(RpcAuthInfo *AuthInfo) DECLSPEC_HIDDEN;
BOOL RpcAuthInfo_IsEqual(const RpcAuthInfo *AuthInfo1, const RpcAuthInfo *AuthInfo2) DECLSPEC_HIDDEN;
ULONG RpcQualityOfService_AddRef(RpcQualityOfService *qos) DECLSPEC_HIDDEN;
ULONG RpcQualityOfService_Release(RpcQualityOfService *qos) DECLSPEC_HIDDEN;
BOOL RpcQualityOfService_IsEqual(const RpcQualityOfService *qos1, const RpcQualityOfService *qos2) DECLSPEC_HIDDEN;
RPC_STATUS RpcAuthInfo_Create(ULONG AuthnLevel, ULONG AuthnSvc, CredHandle cred, TimeStamp exp, ULONG cbMaxToken, RPC_AUTH_IDENTITY_HANDLE identity, RpcAuthInfo **ret);
ULONG RpcAuthInfo_AddRef(RpcAuthInfo *AuthInfo);
ULONG RpcAuthInfo_Release(RpcAuthInfo *AuthInfo);
BOOL RpcAuthInfo_IsEqual(const RpcAuthInfo *AuthInfo1, const RpcAuthInfo *AuthInfo2);
ULONG RpcQualityOfService_AddRef(RpcQualityOfService *qos);
ULONG RpcQualityOfService_Release(RpcQualityOfService *qos);
BOOL RpcQualityOfService_IsEqual(const RpcQualityOfService *qos1, const RpcQualityOfService *qos2);
RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPCSTR Protseq,
LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo* AuthInfo,
RpcQualityOfService *QOS, LPCWSTR CookieAuth) DECLSPEC_HIDDEN;
RpcConnection *RPCRT4_GrabConnection( RpcConnection *conn ) DECLSPEC_HIDDEN;
void RPCRT4_ReleaseConnection(RpcConnection* Connection) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_OpenClientConnection(RpcConnection* Connection) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_CloseConnection(RpcConnection* Connection) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_IsServerListening(const char *protseq, const char *endpoint) DECLSPEC_HIDDEN;
RpcQualityOfService *QOS, LPCWSTR CookieAuth);
RpcConnection *RPCRT4_GrabConnection( RpcConnection *conn );
void RPCRT4_ReleaseConnection(RpcConnection* Connection);
RPC_STATUS RPCRT4_OpenClientConnection(RpcConnection* Connection);
RPC_STATUS RPCRT4_CloseConnection(RpcConnection* Connection);
RPC_STATUS RPCRT4_IsServerListening(const char *protseq, const char *endpoint);
RPC_STATUS RPCRT4_ResolveBinding(RpcBinding* Binding, LPCSTR Endpoint) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_SetBindingObject(RpcBinding* Binding, const UUID* ObjectUuid) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_MakeBinding(RpcBinding** Binding, RpcConnection* Connection) DECLSPEC_HIDDEN;
void RPCRT4_AddRefBinding(RpcBinding* Binding) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_ReleaseBinding(RpcBinding* Binding) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_ResolveBinding(RpcBinding* Binding, LPCSTR Endpoint);
RPC_STATUS RPCRT4_SetBindingObject(RpcBinding* Binding, const UUID* ObjectUuid);
RPC_STATUS RPCRT4_MakeBinding(RpcBinding** Binding, RpcConnection* Connection);
void RPCRT4_AddRefBinding(RpcBinding* Binding);
RPC_STATUS RPCRT4_ReleaseBinding(RpcBinding* Binding);
RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection,
const RPC_SYNTAX_IDENTIFIER *TransferSyntax, const RPC_SYNTAX_IDENTIFIER *InterfaceId,
BOOL *from_cache) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_CloseBinding(RpcBinding* Binding, RpcConnection* Connection) DECLSPEC_HIDDEN;
BOOL *from_cache);
RPC_STATUS RPCRT4_CloseBinding(RpcBinding* Binding, RpcConnection* Connection);
void rpcrt4_conn_release_and_wait(RpcConnection *connection) DECLSPEC_HIDDEN;
void rpcrt4_conn_release_and_wait(RpcConnection *connection);
static inline const char *rpcrt4_conn_get_name(const RpcConnection *Connection)
{
@@ -258,14 +254,14 @@ static inline RPC_STATUS rpcrt4_conn_inquire_auth_client(
}
/* floors 3 and up */
RPC_STATUS RpcTransport_GetTopOfTower(unsigned char *tower_data, size_t *tower_size, const char *protseq, const char *networkaddr, const char *endpoint) DECLSPEC_HIDDEN;
RPC_STATUS RpcTransport_ParseTopOfTower(const unsigned char *tower_data, size_t tower_size, char **protseq, char **networkaddr, char **endpoint) DECLSPEC_HIDDEN;
RPC_STATUS RpcTransport_GetTopOfTower(unsigned char *tower_data, size_t *tower_size, const char *protseq, const char *networkaddr, const char *endpoint);
RPC_STATUS RpcTransport_ParseTopOfTower(const unsigned char *tower_data, size_t tower_size, char **protseq, char **networkaddr, char **endpoint);
void RPCRT4_SetThreadCurrentConnection(RpcConnection *Connection) DECLSPEC_HIDDEN;
void RPCRT4_SetThreadCurrentCallHandle(RpcBinding *Binding) DECLSPEC_HIDDEN;
RpcBinding *RPCRT4_GetThreadCurrentCallHandle(void) DECLSPEC_HIDDEN;
void RPCRT4_PushThreadContextHandle(NDR_SCONTEXT SContext) DECLSPEC_HIDDEN;
void RPCRT4_RemoveThreadContextHandle(NDR_SCONTEXT SContext) DECLSPEC_HIDDEN;
NDR_SCONTEXT RPCRT4_PopThreadContextHandle(void) DECLSPEC_HIDDEN;
void RPCRT4_SetThreadCurrentConnection(RpcConnection *Connection);
void RPCRT4_SetThreadCurrentCallHandle(RpcBinding *Binding);
RpcBinding *RPCRT4_GetThreadCurrentCallHandle(void);
void RPCRT4_PushThreadContextHandle(NDR_SCONTEXT SContext);
void RPCRT4_RemoveThreadContextHandle(NDR_SCONTEXT SContext);
NDR_SCONTEXT RPCRT4_PopThreadContextHandle(void);
#endif
+22 -23
View File
@@ -33,7 +33,7 @@
#include "wine/exception.h"
#include "rpc_binding.h"
#include "epm_c.h"
#include "epm.h"
#include "epm_towers.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole);
@@ -78,7 +78,6 @@ static const struct epm_endpoints
static BOOL start_rpcss(void)
{
static const WCHAR rpcssW[] = {'R','p','c','S','s',0};
SC_HANDLE scm, service;
SERVICE_STATUS_PROCESS status;
BOOL ret = FALSE;
@@ -90,7 +89,7 @@ static BOOL start_rpcss(void)
ERR( "failed to open service manager\n" );
return FALSE;
}
if (!(service = OpenServiceW( scm, rpcssW, SERVICE_START | SERVICE_QUERY_STATUS )))
if (!(service = OpenServiceW( scm, L"RpcSs", SERVICE_START | SERVICE_QUERY_STATUS )))
{
ERR( "failed to open RpcSs service\n" );
CloseServiceHandle( scm );
@@ -117,7 +116,7 @@ static BOOL start_rpcss(void)
} while (status.dwCurrentState == SERVICE_START_PENDING);
if (status.dwCurrentState != SERVICE_RUNNING)
WARN( "RpcSs failed to start %u\n", status.dwCurrentState );
WARN( "RpcSs failed to start %lu\n", status.dwCurrentState );
}
else ERR( "failed to start RpcSs service\n" );
@@ -207,24 +206,24 @@ static RPC_STATUS epm_register( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bindin
TRACE(" ifid=%s\n", debugstr_guid(&If->InterfaceId.SyntaxGUID));
for (i=0; i<BindingVector->Count; i++) {
RpcBinding* bind = BindingVector->BindingH[i];
TRACE(" protseq[%d]=%s\n", i, debugstr_a(bind->Protseq));
TRACE(" endpoint[%d]=%s\n", i, debugstr_a(bind->Endpoint));
TRACE(" protseq[%ld]=%s\n", i, debugstr_a(bind->Protseq));
TRACE(" endpoint[%ld]=%s\n", i, debugstr_a(bind->Endpoint));
}
if (UuidVector) {
for (i=0; i<UuidVector->Count; i++)
TRACE(" obj[%d]=%s\n", i, debugstr_guid(UuidVector->Uuid[i]));
TRACE(" obj[%ld]=%s\n", i, debugstr_guid(UuidVector->Uuid[i]));
}
if (!BindingVector->Count) return RPC_S_OK;
entries = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*entries) * BindingVector->Count * (UuidVector ? UuidVector->Count : 1));
entries = calloc(BindingVector->Count * (UuidVector ? UuidVector->Count : 1), sizeof(*entries));
if (!entries)
return RPC_S_OUT_OF_MEMORY;
status = get_epm_handle_server(&handle);
if (status != RPC_S_OK)
{
HeapFree(GetProcessHeap(), 0, entries);
free(entries);
return status;
}
@@ -271,7 +270,7 @@ static RPC_STATUS epm_register( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bindin
continue;
}
if (status2 != RPC_S_OK)
ERR("ept_insert failed with error %d\n", status2);
ERR("ept_insert failed with error %ld\n", status2);
status = status2; /* FIXME: convert status? */
break;
}
@@ -285,7 +284,7 @@ static RPC_STATUS epm_register( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bindin
I_RpcFree(entries[i*(UuidVector ? UuidVector->Count : 1) + j].tower);
}
HeapFree(GetProcessHeap(), 0, entries);
free(entries);
return status;
}
@@ -319,7 +318,7 @@ RPC_STATUS WINAPI RpcEpRegisterW( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bind
status = epm_register(IfSpec, BindingVector, UuidVector, (RPC_CSTR)annA, TRUE);
HeapFree(GetProcessHeap(), 0, annA);
free(annA);
return status;
}
@@ -334,7 +333,7 @@ RPC_STATUS WINAPI RpcEpRegisterNoReplaceW( RPC_IF_HANDLE IfSpec, RPC_BINDING_VEC
status = epm_register(IfSpec, BindingVector, UuidVector, (RPC_CSTR)annA, FALSE);
HeapFree(GetProcessHeap(), 0, annA);
free(annA);
return status;
}
@@ -355,22 +354,22 @@ RPC_STATUS WINAPI RpcEpUnregister( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bin
TRACE(" ifid=%s\n", debugstr_guid(&If->InterfaceId.SyntaxGUID));
for (i=0; i<BindingVector->Count; i++) {
RpcBinding* bind = BindingVector->BindingH[i];
TRACE(" protseq[%d]=%s\n", i, debugstr_a(bind->Protseq));
TRACE(" endpoint[%d]=%s\n", i, debugstr_a(bind->Endpoint));
TRACE(" protseq[%ld]=%s\n", i, debugstr_a(bind->Protseq));
TRACE(" endpoint[%ld]=%s\n", i, debugstr_a(bind->Endpoint));
}
if (UuidVector) {
for (i=0; i<UuidVector->Count; i++)
TRACE(" obj[%d]=%s\n", i, debugstr_guid(UuidVector->Uuid[i]));
TRACE(" obj[%ld]=%s\n", i, debugstr_guid(UuidVector->Uuid[i]));
}
entries = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*entries) * BindingVector->Count * (UuidVector ? UuidVector->Count : 1));
entries = calloc(BindingVector->Count * (UuidVector ? UuidVector->Count : 1), sizeof(*entries));
if (!entries)
return RPC_S_OUT_OF_MEMORY;
status = get_epm_handle_server(&handle);
if (status != RPC_S_OK)
{
HeapFree(GetProcessHeap(), 0, entries);
free(entries);
return status;
}
@@ -408,7 +407,7 @@ RPC_STATUS WINAPI RpcEpUnregister( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bin
if (status2 == RPC_S_SERVER_UNAVAILABLE)
status2 = EPT_S_NOT_REGISTERED;
if (status2 != RPC_S_OK)
ERR("ept_insert failed with error %d\n", status2);
ERR("ept_insert failed with error %ld\n", status2);
status = status2; /* FIXME: convert status? */
}
RpcBindingFree(&handle);
@@ -420,7 +419,7 @@ RPC_STATUS WINAPI RpcEpUnregister( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bin
I_RpcFree(entries[i*(UuidVector ? UuidVector->Count : 1) + j].tower);
}
HeapFree(GetProcessHeap(), 0, entries);
free(entries);
return status;
}
@@ -502,7 +501,7 @@ RPC_STATUS WINAPI RpcEpResolveBinding( RPC_BINDING_HANDLE Binding, RPC_IF_HANDLE
if (!resolved_endpoint)
{
status = TowerExplode(towers[i], NULL, NULL, NULL, &resolved_endpoint, NULL);
TRACE("status = %d\n", status);
TRACE("status = %ld\n", status);
}
I_RpcFree(towers[i]);
}
@@ -656,10 +655,10 @@ RPC_STATUS WINAPI TowerConstruct(
void __RPC_FAR * __RPC_USER MIDL_user_allocate(SIZE_T len)
{
return HeapAlloc(GetProcessHeap(), 0, len);
return malloc(len);
}
void __RPC_USER MIDL_user_free(void __RPC_FAR * ptr)
{
HeapFree(GetProcessHeap(), 0, ptr);
free(ptr);
}
+113 -117
View File
@@ -22,6 +22,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "windef.h"
@@ -105,21 +106,21 @@ static BOOL packet_does_auth_negotiation(const RpcPktHdr *Header)
}
}
static VOID RPCRT4_BuildCommonHeader(RpcPktHdr *Header, unsigned char PacketType,
static VOID RPCRT4_BuildCommonHeader(RpcPktCommonHdr *Header, unsigned char PacketType,
ULONG DataRepresentation)
{
Header->common.rpc_ver = RPC_VER_MAJOR;
Header->common.rpc_ver_minor = RPC_VER_MINOR;
Header->common.ptype = PacketType;
Header->common.drep[0] = LOBYTE(LOWORD(DataRepresentation));
Header->common.drep[1] = HIBYTE(LOWORD(DataRepresentation));
Header->common.drep[2] = LOBYTE(HIWORD(DataRepresentation));
Header->common.drep[3] = HIBYTE(HIWORD(DataRepresentation));
Header->common.auth_len = 0;
Header->common.call_id = 1;
Header->common.flags = 0;
Header->rpc_ver = RPC_VER_MAJOR;
Header->rpc_ver_minor = RPC_VER_MINOR;
Header->ptype = PacketType;
Header->drep[0] = LOBYTE(LOWORD(DataRepresentation));
Header->drep[1] = HIBYTE(LOWORD(DataRepresentation));
Header->drep[2] = LOBYTE(HIWORD(DataRepresentation));
Header->drep[3] = HIBYTE(HIWORD(DataRepresentation));
Header->auth_len = 0;
Header->call_id = 1;
Header->flags = 0;
/* Flags and fragment length are computed in RPCRT4_Send. */
}
}
static RpcPktHdr *RPCRT4_BuildRequestHeader(ULONG DataRepresentation,
ULONG BufferLength,
@@ -131,13 +132,12 @@ static RpcPktHdr *RPCRT4_BuildRequestHeader(ULONG DataRepresentation,
RPC_STATUS status;
has_object = (ObjectUuid != NULL && !UuidIsNil(ObjectUuid, &status));
header = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(header->request) + (has_object ? sizeof(UUID) : 0));
header = calloc(1, sizeof(header->request) + (has_object ? sizeof(UUID) : 0));
if (header == NULL) {
return NULL;
}
RPCRT4_BuildCommonHeader(header, PKT_REQUEST, DataRepresentation);
RPCRT4_BuildCommonHeader(&header->common, PKT_REQUEST, DataRepresentation);
header->common.frag_len = sizeof(header->request);
header->request.alloc_hint = BufferLength;
header->request.context_id = 0;
@@ -153,34 +153,34 @@ static RpcPktHdr *RPCRT4_BuildRequestHeader(ULONG DataRepresentation,
RpcPktHdr *RPCRT4_BuildResponseHeader(ULONG DataRepresentation, ULONG BufferLength)
{
RpcPktHdr *header;
RpcPktResponseHdr *header;
header = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(header->response));
header = calloc(1, sizeof(*header));
if (header == NULL) {
return NULL;
}
RPCRT4_BuildCommonHeader(header, PKT_RESPONSE, DataRepresentation);
header->common.frag_len = sizeof(header->response);
header->response.alloc_hint = BufferLength;
RPCRT4_BuildCommonHeader(&header->common, PKT_RESPONSE, DataRepresentation);
header->common.frag_len = sizeof(*header);
header->alloc_hint = BufferLength;
return header;
return (RpcPktHdr *)header;
}
RpcPktHdr *RPCRT4_BuildFaultHeader(ULONG DataRepresentation, RPC_STATUS Status)
{
RpcPktHdr *header;
RpcPktFaultHdr *header;
header = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(header->fault));
header = calloc(1, sizeof(*header));
if (header == NULL) {
return NULL;
}
RPCRT4_BuildCommonHeader(header, PKT_FAULT, DataRepresentation);
header->common.frag_len = sizeof(header->fault);
header->fault.status = Status;
RPCRT4_BuildCommonHeader(&header->common, PKT_FAULT, DataRepresentation);
header->common.frag_len = sizeof(*header);
header->status = Status;
return header;
return (RpcPktHdr *)header;
}
RpcPktHdr *RPCRT4_BuildBindHeader(ULONG DataRepresentation,
@@ -193,14 +193,13 @@ RpcPktHdr *RPCRT4_BuildBindHeader(ULONG DataRepresentation,
RpcPktHdr *header;
RpcContextElement *ctxt_elem;
header = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(header->bind) + FIELD_OFFSET(RpcContextElement, transfer_syntaxes[1]));
header = calloc(1, sizeof(header->bind) + FIELD_OFFSET(RpcContextElement, transfer_syntaxes[1]));
if (header == NULL) {
return NULL;
}
ctxt_elem = (RpcContextElement *)(&header->bind + 1);
RPCRT4_BuildCommonHeader(header, PKT_BIND, DataRepresentation);
RPCRT4_BuildCommonHeader(&header->common, PKT_BIND, DataRepresentation);
header->common.frag_len = sizeof(header->bind) + FIELD_OFFSET(RpcContextElement, transfer_syntaxes[1]);
header->bind.max_tsize = MaxTransmissionSize;
header->bind.max_rsize = MaxReceiveSize;
@@ -215,17 +214,16 @@ RpcPktHdr *RPCRT4_BuildBindHeader(ULONG DataRepresentation,
static RpcPktHdr *RPCRT4_BuildAuthHeader(ULONG DataRepresentation)
{
RpcPktHdr *header;
RpcPktAuth3Hdr *header;
header = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(header->auth3));
header = calloc(1, sizeof(*header));
if (header == NULL)
return NULL;
RPCRT4_BuildCommonHeader(header, PKT_AUTH3, DataRepresentation);
header->common.frag_len = sizeof(header->auth3);
RPCRT4_BuildCommonHeader(&header->common, PKT_AUTH3, DataRepresentation);
header->common.frag_len = sizeof(*header);
return header;
return (RpcPktHdr*)header;
}
RpcPktHdr *RPCRT4_BuildBindNackHeader(ULONG DataRepresentation,
@@ -233,21 +231,24 @@ RpcPktHdr *RPCRT4_BuildBindNackHeader(ULONG DataRepresentation,
unsigned char RpcVersionMinor,
unsigned short RejectReason)
{
RpcPktHdr *header;
RpcPktBindNAckHdr *header;
#ifndef _MSC_VER
C_ASSERT(sizeof(*header) >= FIELD_OFFSET(RpcPktBindNAckHdr, protocols[1]));
#endif
header = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET(RpcPktHdr, bind_nack.protocols[1]));
header = calloc(1, sizeof(*header));
if (header == NULL) {
return NULL;
}
RPCRT4_BuildCommonHeader(header, PKT_BIND_NACK, DataRepresentation);
header->common.frag_len = FIELD_OFFSET(RpcPktHdr, bind_nack.protocols[1]);
header->bind_nack.reject_reason = RejectReason;
header->bind_nack.protocols_count = 1;
header->bind_nack.protocols[0].rpc_ver = RpcVersion;
header->bind_nack.protocols[0].rpc_ver_minor = RpcVersionMinor;
RPCRT4_BuildCommonHeader(&header->common, PKT_BIND_NACK, DataRepresentation);
header->common.frag_len = FIELD_OFFSET(RpcPktBindNAckHdr, protocols[1]);
header->reject_reason = RejectReason;
header->protocols_count = 1;
header->protocols[0].rpc_ver = RpcVersion;
header->protocols[0].rpc_ver_minor = RpcVersionMinor;
return header;
return (RpcPktHdr *)header;
}
RpcPktHdr *RPCRT4_BuildBindAckHeader(ULONG DataRepresentation,
@@ -267,12 +268,12 @@ RpcPktHdr *RPCRT4_BuildBindAckHeader(ULONG DataRepresentation,
ROUND_UP(FIELD_OFFSET(RpcAddressString, string[strlen(ServerAddress) + 1]), 4) +
FIELD_OFFSET(RpcResultList, results[ResultCount]);
header = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, header_size);
header = calloc(1, header_size);
if (header == NULL) {
return NULL;
}
RPCRT4_BuildCommonHeader(header, PKT_BIND_ACK, DataRepresentation);
RPCRT4_BuildCommonHeader(&header->common, PKT_BIND_ACK, DataRepresentation);
header->common.frag_len = header_size;
header->bind_ack.max_tsize = MaxTransmissionSize;
header->bind_ack.max_rsize = MaxReceiveSize;
@@ -295,13 +296,13 @@ RpcPktHdr *RPCRT4_BuildHttpHeader(ULONG DataRepresentation,
{
RpcPktHdr *header;
header = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(header->http) + payload_size);
header = calloc(1, sizeof(header->http) + payload_size);
if (header == NULL) {
ERR("failed to allocate memory\n");
return NULL;
}
RPCRT4_BuildCommonHeader(header, PKT_HTTP, DataRepresentation);
RPCRT4_BuildCommonHeader(&header->common, PKT_HTTP, DataRepresentation);
/* since the packet isn't current sent using RPCRT4_Send, set the flags
* manually here */
header->common.flags = RPC_FLG_FIRST|RPC_FLG_LAST;
@@ -400,11 +401,6 @@ RpcPktHdr *RPCRT4_BuildHttpFlowControlHeader(BOOL server, ULONG bytes_transmitte
return header;
}
VOID RPCRT4_FreeHeader(RpcPktHdr *Header)
{
HeapFree(GetProcessHeap(), 0, Header);
}
NCA_STATUS RPC2NCA_STATUS(RPC_STATUS status)
{
switch (status)
@@ -524,7 +520,7 @@ BOOL RPCRT4_IsValidHttpPacket(RpcPktHdr *hdr, unsigned char *data,
data_len -= 24;
break;
default:
FIXME("unimplemented type 0x%x\n", type);
FIXME("unimplemented type 0x%lx\n", type);
break;
}
}
@@ -554,7 +550,7 @@ static unsigned char *RPCRT4_NextHttpHeaderField(unsigned char *data)
case 0x1:
return data + 24;
default:
FIXME("unimplemented type 0x%x\n", type);
FIXME("unimplemented type 0x%lx\n", type);
return data;
}
}
@@ -580,7 +576,7 @@ RPC_STATUS RPCRT4_ParseHttpPrepareHeader1(RpcPktHdr *header,
type = READ_HTTP_PAYLOAD_FIELD_TYPE(data);
if (type != 0x00000002)
{
ERR("invalid type 0x%08x\n", type);
ERR("invalid type 0x%08lx\n", type);
return RPC_S_PROTOCOL_ERROR;
}
*field1 = *(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data);
@@ -608,7 +604,7 @@ RPC_STATUS RPCRT4_ParseHttpPrepareHeader2(RpcPktHdr *header,
type = READ_HTTP_PAYLOAD_FIELD_TYPE(data);
if (type != 0x00000006)
{
ERR("invalid type for field 1: 0x%08x\n", type);
ERR("invalid type for field 1: 0x%08lx\n", type);
return RPC_S_PROTOCOL_ERROR;
}
*field1 = *(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data);
@@ -617,7 +613,7 @@ RPC_STATUS RPCRT4_ParseHttpPrepareHeader2(RpcPktHdr *header,
type = READ_HTTP_PAYLOAD_FIELD_TYPE(data);
if (type != 0x00000000)
{
ERR("invalid type for field 2: 0x%08x\n", type);
ERR("invalid type for field 2: 0x%08lx\n", type);
return RPC_S_PROTOCOL_ERROR;
}
*bytes_until_next_packet = *(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data);
@@ -626,7 +622,7 @@ RPC_STATUS RPCRT4_ParseHttpPrepareHeader2(RpcPktHdr *header,
type = READ_HTTP_PAYLOAD_FIELD_TYPE(data);
if (type != 0x00000002)
{
ERR("invalid type for field 3: 0x%08x\n", type);
ERR("invalid type for field 3: 0x%08lx\n", type);
return RPC_S_PROTOCOL_ERROR;
}
*field3 = *(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data);
@@ -655,12 +651,12 @@ RPC_STATUS RPCRT4_ParseHttpFlowControlHeader(RpcPktHdr *header,
type = READ_HTTP_PAYLOAD_FIELD_TYPE(data);
if (type != 0x0000000d)
{
ERR("invalid type for field 1: 0x%08x\n", type);
ERR("invalid type for field 1: 0x%08lx\n", type);
return RPC_S_PROTOCOL_ERROR;
}
if (*(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data) != (server ? 0x3 : 0x0))
{
ERR("invalid type for 0xd field data: 0x%08x\n", *(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data));
ERR("invalid type for 0xd field data: 0x%08lx\n", *(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data));
return RPC_S_PROTOCOL_ERROR;
}
data = RPCRT4_NextHttpHeaderField(data);
@@ -668,7 +664,7 @@ RPC_STATUS RPCRT4_ParseHttpFlowControlHeader(RpcPktHdr *header,
type = READ_HTTP_PAYLOAD_FIELD_TYPE(data);
if (type != 0x00000001)
{
ERR("invalid type for field 2: 0x%08x\n", type);
ERR("invalid type for field 2: 0x%08lx\n", type);
return RPC_S_PROTOCOL_ERROR;
}
*bytes_transmitted = *(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data);
@@ -714,7 +710,7 @@ RPC_STATUS RPCRT4_default_secure_packet(RpcConnection *Connection,
sec_status = EncryptMessage(&Connection->ctx, 0, &message, 0 /* FIXME */);
if (sec_status != SEC_E_OK)
{
ERR("EncryptMessage failed with 0x%08x\n", sec_status);
ERR("EncryptMessage failed with 0x%08lx\n", sec_status);
return RPC_S_SEC_PKG_ERROR;
}
}
@@ -723,7 +719,7 @@ RPC_STATUS RPCRT4_default_secure_packet(RpcConnection *Connection,
sec_status = MakeSignature(&Connection->ctx, 0, &message, 0 /* FIXME */);
if (sec_status != SEC_E_OK)
{
ERR("MakeSignature failed with 0x%08x\n", sec_status);
ERR("MakeSignature failed with 0x%08lx\n", sec_status);
return RPC_S_SEC_PKG_ERROR;
}
}
@@ -735,7 +731,7 @@ RPC_STATUS RPCRT4_default_secure_packet(RpcConnection *Connection,
sec_status = DecryptMessage(&Connection->ctx, &message, 0 /* FIXME */, 0);
if (sec_status != SEC_E_OK)
{
ERR("DecryptMessage failed with 0x%08x\n", sec_status);
ERR("DecryptMessage failed with 0x%08lx\n", sec_status);
return RPC_S_SEC_PKG_ERROR;
}
}
@@ -744,7 +740,7 @@ RPC_STATUS RPCRT4_default_secure_packet(RpcConnection *Connection,
sec_status = VerifySignature(&Connection->ctx, &message, 0 /* FIXME */, NULL);
if (sec_status != SEC_E_OK)
{
ERR("VerifySignature failed with 0x%08x\n", sec_status);
ERR("VerifySignature failed with 0x%08lx\n", sec_status);
return RPC_S_SEC_PKG_ERROR;
}
}
@@ -752,10 +748,10 @@ RPC_STATUS RPCRT4_default_secure_packet(RpcConnection *Connection,
return RPC_S_OK;
}
/***********************************************************************
* RPCRT4_SendWithAuth (internal)
*
*
* Transmit a packet with authorization data over connection in acceptable fragments.
*/
RPC_STATUS RPCRT4_SendWithAuth(RpcConnection *Connection, RpcPktHdr *Header,
@@ -806,7 +802,7 @@ RPC_STATUS RPCRT4_SendWithAuth(RpcConnection *Connection, RpcPktHdr *Header,
hdr_size + alen;
}
pkt = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, Header->common.frag_len);
pkt = calloc(1, Header->common.frag_len);
memcpy(pkt, Header, hdr_size);
@@ -839,7 +835,7 @@ RPC_STATUS RPCRT4_SendWithAuth(RpcConnection *Connection, RpcPktHdr *Header,
(unsigned char *)(auth_hdr + 1), Header->common.auth_len);
if (status != RPC_S_OK)
{
HeapFree(GetProcessHeap(), 0, pkt);
free(pkt);
RPCRT4_SetThreadCurrentConnection(NULL);
return status;
}
@@ -848,7 +844,7 @@ RPC_STATUS RPCRT4_SendWithAuth(RpcConnection *Connection, RpcPktHdr *Header,
write:
count = rpcrt4_conn_write(Connection, pkt, Header->common.frag_len);
HeapFree(GetProcessHeap(), 0, pkt);
free(pkt);
if (count<0) {
WARN("rpcrt4_conn_write failed (auth)\n");
RPCRT4_SetThreadCurrentConnection(NULL);
@@ -945,11 +941,11 @@ RPC_STATUS RPCRT4_default_authorize(RpcConnection *conn, BOOL first_time,
}
if (FAILED(r))
{
WARN("InitializeSecurityContext failed with error 0x%08x\n", r);
WARN("InitializeSecurityContext failed with error 0x%08lx\n", r);
goto failed;
}
TRACE("r = 0x%08x, attr = 0x%08x\n", r, conn->attr);
TRACE("r = 0x%08lx, attr = 0x%08lx\n", r, conn->attr);
continue_needed = ((r == SEC_I_CONTINUE_NEEDED) ||
(r == SEC_I_COMPLETE_AND_CONTINUE));
@@ -959,19 +955,19 @@ RPC_STATUS RPCRT4_default_authorize(RpcConnection *conn, BOOL first_time,
r = CompleteAuthToken(&conn->ctx, &out_desc);
if (FAILED(r))
{
WARN("CompleteAuthToken failed with error 0x%08x\n", r);
WARN("CompleteAuthToken failed with error 0x%08lx\n", r);
goto failed;
}
}
TRACE("cbBuffer = %d\n", out.cbBuffer);
TRACE("cbBuffer = %ld\n", out.cbBuffer);
if (!continue_needed)
{
r = QueryContextAttributesA(&conn->ctx, SECPKG_ATTR_SIZES, &secctx_sizes);
if (FAILED(r))
{
WARN("QueryContextAttributes failed with error 0x%08x\n", r);
WARN("QueryContextAttributes failed with error 0x%08lx\n", r);
goto failed;
}
conn->signature_auth_len = secctx_sizes.cbMaxSignature;
@@ -997,11 +993,11 @@ RPC_STATUS RPCRT4_ClientConnectionAuth(RpcConnection* conn, BYTE *challenge,
unsigned char *out_buffer;
unsigned int out_len = 0;
TRACE("challenge %s, %d bytes\n", challenge, count);
TRACE("challenge %s, %ld bytes\n", challenge, count);
status = rpcrt4_conn_authorize(conn, FALSE, challenge, count, NULL, &out_len);
if (status) return status;
out_buffer = HeapAlloc(GetProcessHeap(), 0, out_len);
out_buffer = malloc(out_len);
if (!out_buffer) return RPC_S_OUT_OF_RESOURCES;
status = rpcrt4_conn_authorize(conn, FALSE, challenge, count, out_buffer, &out_len);
if (status) return status;
@@ -1013,8 +1009,8 @@ RPC_STATUS RPCRT4_ClientConnectionAuth(RpcConnection* conn, BYTE *challenge,
else
status = RPC_S_OUT_OF_RESOURCES;
HeapFree(GetProcessHeap(), 0, out_buffer);
RPCRT4_FreeHeader(resp_hdr);
free(out_buffer);
free(resp_hdr);
return status;
}
@@ -1086,7 +1082,7 @@ RPC_STATUS RPCRT4_ServerConnectionAuth(RpcConnection* conn,
auth_length_in - sizeof(RpcAuthVerifier), NULL, &out_size);
if (status) return status;
out_buffer = HeapAlloc(GetProcessHeap(), 0, out_size);
out_buffer = malloc(out_size);
if (!out_buffer) return RPC_S_OUT_OF_RESOURCES;
status = rpcrt4_conn_authorize(
@@ -1094,7 +1090,7 @@ RPC_STATUS RPCRT4_ServerConnectionAuth(RpcConnection* conn,
auth_length_in - sizeof(RpcAuthVerifier), out_buffer, &out_size);
if (status != RPC_S_OK)
{
HeapFree(GetProcessHeap(), 0, out_buffer);
free(out_buffer);
return status;
}
@@ -1102,7 +1098,7 @@ RPC_STATUS RPCRT4_ServerConnectionAuth(RpcConnection* conn,
{
ERR("expected authentication to be complete but SSP returned data of "
"%u bytes to be sent back to client\n", out_size);
HeapFree(GetProcessHeap(), 0, out_buffer);
free(out_buffer);
return RPC_S_SEC_PKG_ERROR;
}
else
@@ -1138,7 +1134,7 @@ RPC_STATUS RPCRT4_default_impersonate_client(RpcConnection *conn)
return RPC_S_NO_CONTEXT_AVAILABLE;
sec_status = ImpersonateSecurityContext(&conn->ctx);
if (sec_status != SEC_E_OK)
WARN("ImpersonateSecurityContext returned 0x%08x\n", sec_status);
WARN("ImpersonateSecurityContext returned 0x%08lx\n", sec_status);
switch (sec_status)
{
case SEC_E_UNSUPPORTED_FUNCTION:
@@ -1166,7 +1162,7 @@ RPC_STATUS RPCRT4_default_revert_to_self(RpcConnection *conn)
return RPC_S_NO_CONTEXT_AVAILABLE;
sec_status = RevertSecurityContext(&conn->ctx);
if (sec_status != SEC_E_OK)
WARN("RevertSecurityContext returned 0x%08x\n", sec_status);
WARN("RevertSecurityContext returned 0x%08lx\n", sec_status);
switch (sec_status)
{
case SEC_E_UNSUPPORTED_FUNCTION:
@@ -1199,7 +1195,7 @@ RPC_STATUS RPCRT4_default_inquire_auth_client(
}
if (server_princ_name)
{
*server_princ_name = RPCRT4_strdupW(conn->AuthInfo->server_principal_name);
*server_princ_name = wcsdup(conn->AuthInfo->server_principal_name);
if (!*server_princ_name) return ERROR_OUTOFMEMORY;
}
if (authn_level) *authn_level = conn->AuthInfo->AuthnLevel;
@@ -1210,14 +1206,14 @@ RPC_STATUS RPCRT4_default_inquire_auth_client(
*authz_svc = RPC_C_AUTHZ_NONE;
}
if (flags)
FIXME("flags 0x%x not implemented\n", flags);
FIXME("flags 0x%lx not implemented\n", flags);
return RPC_S_OK;
}
/***********************************************************************
* RPCRT4_Send (internal)
*
*
* Transmit a packet over connection in acceptable fragments.
*/
RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header,
@@ -1235,7 +1231,7 @@ RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header,
r = rpcrt4_conn_authorize(Connection, TRUE, NULL, 0, NULL, &out_size);
if (r != RPC_S_OK) return r;
out_buffer = HeapAlloc(GetProcessHeap(), 0, out_size);
out_buffer = malloc(out_size);
if (!out_buffer) return RPC_S_OUT_OF_RESOURCES;
/* tack on a negotiate packet */
@@ -1243,7 +1239,7 @@ RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header,
if (r == RPC_S_OK)
r = RPCRT4_SendWithAuth(Connection, Header, Buffer, BufferLength, out_buffer, out_size);
HeapFree(GetProcessHeap(), 0, out_buffer);
free(out_buffer);
}
else
r = RPCRT4_SendWithAuth(Connection, Header, Buffer, BufferLength, NULL, 0);
@@ -1282,7 +1278,7 @@ RPC_STATUS RPCRT4_ValidateCommonHeader(const RpcPktCommonHdr *hdr)
/***********************************************************************
* RPCRT4_default_receive_fragment (internal)
*
*
* Receive a fragment from a connection.
*/
static RPC_STATUS RPCRT4_default_receive_fragment(RpcConnection *Connection, RpcPktHdr **Header, void **Payload)
@@ -1300,7 +1296,7 @@ static RPC_STATUS RPCRT4_default_receive_fragment(RpcConnection *Connection, Rpc
/* read packet common header */
dwRead = rpcrt4_conn_read(Connection, &common_hdr, sizeof(common_hdr));
if (dwRead != sizeof(common_hdr)) {
WARN("Short read of header, %d bytes\n", dwRead);
WARN("Short read of header, %ld bytes\n", dwRead);
status = RPC_S_CALL_FAILED;
goto fail;
}
@@ -1315,20 +1311,20 @@ static RPC_STATUS RPCRT4_default_receive_fragment(RpcConnection *Connection, Rpc
goto fail;
}
*Header = HeapAlloc(GetProcessHeap(), 0, hdr_length);
*Header = malloc(hdr_length);
memcpy(*Header, &common_hdr, sizeof(common_hdr));
/* read the rest of packet header */
dwRead = rpcrt4_conn_read(Connection, &(*Header)->common + 1, hdr_length - sizeof(common_hdr));
if (dwRead != hdr_length - sizeof(common_hdr)) {
WARN("bad header length, %d bytes, hdr_length %d\n", dwRead, hdr_length);
WARN("bad header length, %ld bytes, hdr_length %ld\n", dwRead, hdr_length);
status = RPC_S_CALL_FAILED;
goto fail;
}
if (common_hdr.frag_len - hdr_length)
{
*Payload = HeapAlloc(GetProcessHeap(), 0, common_hdr.frag_len - hdr_length);
*Payload = malloc(common_hdr.frag_len - hdr_length);
if (!*Payload)
{
status = RPC_S_OUT_OF_RESOURCES;
@@ -1338,7 +1334,7 @@ static RPC_STATUS RPCRT4_default_receive_fragment(RpcConnection *Connection, Rpc
dwRead = rpcrt4_conn_read(Connection, *Payload, common_hdr.frag_len - hdr_length);
if (dwRead != common_hdr.frag_len - hdr_length)
{
WARN("bad data length, %d/%d\n", dwRead, common_hdr.frag_len - hdr_length);
WARN("bad data length, %ld/%ld\n", dwRead, common_hdr.frag_len - hdr_length);
status = RPC_S_CALL_FAILED;
goto fail;
}
@@ -1351,9 +1347,9 @@ static RPC_STATUS RPCRT4_default_receive_fragment(RpcConnection *Connection, Rpc
fail:
if (status != RPC_S_OK) {
RPCRT4_FreeHeader(*Header);
free(*Header);
*Header = NULL;
HeapFree(GetProcessHeap(), 0, *Payload);
free(*Payload);
*Payload = NULL;
}
return status;
@@ -1426,7 +1422,7 @@ RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header,
first_flag = RPC_FLG_FIRST;
auth_length = (*Header)->common.auth_len;
if (auth_length) {
auth_data = HeapAlloc(GetProcessHeap(), 0, RPC_AUTH_VERIFIER_LEN(&(*Header)->common));
auth_data = malloc(RPC_AUTH_VERIFIER_LEN(&(*Header)->common));
if (!auth_data) {
status = RPC_S_OUT_OF_RESOURCES;
goto fail;
@@ -1442,14 +1438,14 @@ RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header,
if ((CurrentHeader->common.frag_len < hdr_length) ||
(CurrentHeader->common.frag_len - hdr_length < header_auth_len)) {
WARN("frag_len %d too small for hdr_length %d and auth_len %d\n",
WARN("frag_len %d too small for hdr_length %ld and auth_len %d\n",
CurrentHeader->common.frag_len, hdr_length, CurrentHeader->common.auth_len);
status = RPC_S_PROTOCOL_ERROR;
goto fail;
}
if (CurrentHeader->common.auth_len != auth_length) {
WARN("auth_len header field changed from %d to %d\n",
WARN("auth_len header field changed from %ld to %d\n",
auth_length, CurrentHeader->common.auth_len);
status = RPC_S_PROTOCOL_ERROR;
goto fail;
@@ -1463,7 +1459,7 @@ RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header,
data_length = CurrentHeader->common.frag_len - hdr_length - header_auth_len;
if (data_length + buffer_length > pMsg->BufferLength) {
TRACE("allocation hint exceeded, new buffer length = %d\n",
TRACE("allocation hint exceeded, new buffer length = %ld\n",
data_length + buffer_length);
pMsg->BufferLength = data_length + buffer_length;
status = I_RpcReAllocateBuffer(pMsg);
@@ -1507,10 +1503,10 @@ RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header,
if (*Header != CurrentHeader)
{
RPCRT4_FreeHeader(CurrentHeader);
free(CurrentHeader);
CurrentHeader = NULL;
}
HeapFree(GetProcessHeap(), 0, payload);
free(payload);
payload = NULL;
status = RPCRT4_receive_fragment(Connection, &CurrentHeader, &payload);
@@ -1529,11 +1525,11 @@ RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header,
fail:
RPCRT4_SetThreadCurrentConnection(NULL);
if (CurrentHeader != *Header)
RPCRT4_FreeHeader(CurrentHeader);
free(CurrentHeader);
if (status != RPC_S_OK) {
I_RpcFree(pMsg->Buffer);
pMsg->Buffer = NULL;
RPCRT4_FreeHeader(*Header);
free(*Header);
*Header = NULL;
}
if (auth_data_out && status == RPC_S_OK) {
@@ -1541,8 +1537,8 @@ fail:
*auth_data_out = auth_data;
}
else
HeapFree(GetProcessHeap(), 0, auth_data);
HeapFree(GetProcessHeap(), 0, payload);
free(auth_data);
free(payload);
return status;
}
@@ -1644,7 +1640,7 @@ RPC_STATUS WINAPI I_RpcGetBuffer(PRPC_MESSAGE pMsg)
if (!bind)
{
ERR("no binding\n");
WARN("no binding\n");
return RPC_S_INVALID_BINDING;
}
@@ -1672,7 +1668,7 @@ RPC_STATUS WINAPI I_RpcGetBuffer(PRPC_MESSAGE pMsg)
static RPC_STATUS I_RpcReAllocateBuffer(PRPC_MESSAGE pMsg)
{
TRACE("(%p): BufferLength=%d\n", pMsg, pMsg->BufferLength);
pMsg->Buffer = HeapReAlloc(GetProcessHeap(), 0, pMsg->Buffer, pMsg->BufferLength);
pMsg->Buffer = realloc(pMsg->Buffer, pMsg->BufferLength);
TRACE("Buffer=%p\n", pMsg->Buffer);
return pMsg->Buffer ? RPC_S_OK : ERROR_OUTOFMEMORY;
@@ -1741,7 +1737,7 @@ static DWORD WINAPI async_notifier_proc(LPVOID p)
QueueUserAPC(async_apc_notifier_proc, state->u.APC.hThread, (ULONG_PTR)state);
break;
case RpcNotificationTypeIoc:
TRACE("RpcNotificationTypeIoc %p, 0x%x, 0x%lx, %p\n",
TRACE("RpcNotificationTypeIoc %p, 0x%lx, 0x%Ix, %p\n",
state->u.IOC.hIOPort, state->u.IOC.dwNumberOfBytesTransferred,
state->u.IOC.dwCompletionKey, state->u.IOC.lpOverlapped);
PostQueuedCompletionStatus(state->u.IOC.hIOPort,
@@ -1811,7 +1807,7 @@ RPC_STATUS WINAPI I_RpcSend(PRPC_MESSAGE pMsg)
hdr->common.call_id = conn->NextCallId++;
status = RPCRT4_Send(conn, hdr, pMsg->Buffer, pMsg->BufferLength);
RPCRT4_FreeHeader(hdr);
free(hdr);
if (status == RPC_S_OK || conn->server || !from_cache)
break;
@@ -1867,7 +1863,7 @@ RPC_STATUS WINAPI I_RpcReceive(PRPC_MESSAGE pMsg)
conn = pMsg->ReservedForRuntime;
status = RPCRT4_Receive(conn, &hdr, pMsg);
if (status != RPC_S_OK) {
WARN("receive failed with error %x\n", status);
WARN("receive failed with error %lx\n", status);
goto fail;
}
@@ -1887,11 +1883,11 @@ RPC_STATUS WINAPI I_RpcReceive(PRPC_MESSAGE pMsg)
}
/* success */
RPCRT4_FreeHeader(hdr);
free(hdr);
return status;
fail:
RPCRT4_FreeHeader(hdr);
free(hdr);
RPCRT4_ReleaseConnection(conn);
pMsg->ReservedForRuntime = NULL;
return status;
@@ -1976,6 +1972,6 @@ RPC_STATUS WINAPI I_RpcAsyncSetHandle(PRPC_MESSAGE pMsg, PRPC_ASYNC_STATE pAsync
*/
RPC_STATUS WINAPI I_RpcAsyncAbortCall(PRPC_ASYNC_STATE pAsync, ULONG ExceptionCode)
{
FIXME("(%p, %d): stub\n", pAsync, ExceptionCode);
FIXME("(%p, %ld): stub\n", pAsync, ExceptionCode);
return RPC_S_INVALID_ASYNC_HANDLE;
}
+28 -29
View File
@@ -25,35 +25,34 @@
typedef unsigned int NCA_STATUS;
RpcPktHdr *RPCRT4_BuildFaultHeader(ULONG DataRepresentation, RPC_STATUS Status) DECLSPEC_HIDDEN;
RpcPktHdr *RPCRT4_BuildResponseHeader(ULONG DataRepresentation, ULONG BufferLength) DECLSPEC_HIDDEN;
RpcPktHdr *RPCRT4_BuildBindHeader(ULONG DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, ULONG AssocGroupId, const RPC_SYNTAX_IDENTIFIER *AbstractId, const RPC_SYNTAX_IDENTIFIER *TransferId) DECLSPEC_HIDDEN;
RpcPktHdr *RPCRT4_BuildBindNackHeader(ULONG DataRepresentation, unsigned char RpcVersion, unsigned char RpcVersionMinor, unsigned short RejectReason) DECLSPEC_HIDDEN;
RpcPktHdr *RPCRT4_BuildBindAckHeader(ULONG DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, ULONG AssocGroupId, LPCSTR ServerAddress, unsigned char ResultCount, const RpcResult *Results) DECLSPEC_HIDDEN;
RpcPktHdr *RPCRT4_BuildHttpHeader(ULONG DataRepresentation, unsigned short flags, unsigned short num_data_items, unsigned int payload_size) DECLSPEC_HIDDEN;
RpcPktHdr *RPCRT4_BuildHttpConnectHeader(int out_pipe, const UUID *connection_uuid, const UUID *pipe_uuid, const UUID *association_uuid) DECLSPEC_HIDDEN;
RpcPktHdr *RPCRT4_BuildHttpFlowControlHeader(BOOL server, ULONG bytes_transmitted, ULONG flow_control_increment, const UUID *pipe_uuid) DECLSPEC_HIDDEN;
VOID RPCRT4_FreeHeader(RpcPktHdr *Header) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header, void *Buffer, unsigned int BufferLength) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_SendWithAuth(RpcConnection *Connection, RpcPktHdr *Header, void *Buffer, unsigned int BufferLength, const void *Auth, unsigned int AuthLength) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header, PRPC_MESSAGE pMsg, unsigned char **auth_data_out, ULONG *auth_length_out) DECLSPEC_HIDDEN;
DWORD RPCRT4_GetHeaderSize(const RpcPktHdr *Header) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_ValidateCommonHeader(const RpcPktCommonHdr *hdr) DECLSPEC_HIDDEN;
RpcPktHdr *RPCRT4_BuildFaultHeader(ULONG DataRepresentation, RPC_STATUS Status);
RpcPktHdr *RPCRT4_BuildResponseHeader(ULONG DataRepresentation, ULONG BufferLength);
RpcPktHdr *RPCRT4_BuildBindHeader(ULONG DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, ULONG AssocGroupId, const RPC_SYNTAX_IDENTIFIER *AbstractId, const RPC_SYNTAX_IDENTIFIER *TransferId);
RpcPktHdr *RPCRT4_BuildBindNackHeader(ULONG DataRepresentation, unsigned char RpcVersion, unsigned char RpcVersionMinor, unsigned short RejectReason);
RpcPktHdr *RPCRT4_BuildBindAckHeader(ULONG DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, ULONG AssocGroupId, LPCSTR ServerAddress, unsigned char ResultCount, const RpcResult *Results);
RpcPktHdr *RPCRT4_BuildHttpHeader(ULONG DataRepresentation, unsigned short flags, unsigned short num_data_items, unsigned int payload_size);
RpcPktHdr *RPCRT4_BuildHttpConnectHeader(int out_pipe, const UUID *connection_uuid, const UUID *pipe_uuid, const UUID *association_uuid);
RpcPktHdr *RPCRT4_BuildHttpFlowControlHeader(BOOL server, ULONG bytes_transmitted, ULONG flow_control_increment, const UUID *pipe_uuid);
RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header, void *Buffer, unsigned int BufferLength);
RPC_STATUS RPCRT4_SendWithAuth(RpcConnection *Connection, RpcPktHdr *Header, void *Buffer, unsigned int BufferLength, const void *Auth, unsigned int AuthLength);
RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header, PRPC_MESSAGE pMsg, unsigned char **auth_data_out, ULONG *auth_length_out);
DWORD RPCRT4_GetHeaderSize(const RpcPktHdr *Header);
RPC_STATUS RPCRT4_ValidateCommonHeader(const RpcPktCommonHdr *hdr);
BOOL RPCRT4_IsValidHttpPacket(RpcPktHdr *hdr, unsigned char *data, unsigned short data_len) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_ParseHttpPrepareHeader1(RpcPktHdr *header, unsigned char *data, ULONG *field1) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_ParseHttpPrepareHeader2(RpcPktHdr *header, unsigned char *data, ULONG *field1, ULONG *bytes_until_next_packet, ULONG *field3) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_ParseHttpFlowControlHeader(RpcPktHdr *header, unsigned char *data, BOOL server, ULONG *bytes_transmitted, ULONG *flow_control_increment, UUID *pipe_uuid) DECLSPEC_HIDDEN;
NCA_STATUS RPC2NCA_STATUS(RPC_STATUS status) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_ClientConnectionAuth(RpcConnection* conn, BYTE *challenge, ULONG count) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_ServerConnectionAuth(RpcConnection* conn, BOOL start, RpcAuthVerifier *auth_data_in, ULONG auth_length_in, unsigned char **auth_data_out, ULONG *auth_length_out) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_AuthorizeConnection(RpcConnection* conn, BYTE *challenge, ULONG count) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_ServerGetRegisteredAuthInfo(USHORT auth_type, CredHandle *cred, TimeStamp *exp, ULONG *max_token) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_default_authorize(RpcConnection *conn, BOOL first_time, unsigned char *in_buffer, unsigned int in_size, unsigned char *out_buffer, unsigned int *out_size) DECLSPEC_HIDDEN;
BOOL RPCRT4_default_is_authorized(RpcConnection *Connection) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_default_secure_packet(RpcConnection *Connection, enum secure_packet_direction dir, RpcPktHdr *hdr, unsigned int hdr_size, unsigned char *stub_data, unsigned int stub_data_size, RpcAuthVerifier *auth_hdr, unsigned char *auth_value, unsigned int auth_value_size) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_default_impersonate_client(RpcConnection *conn) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_default_revert_to_self(RpcConnection *conn) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_default_inquire_auth_client(RpcConnection *conn, RPC_AUTHZ_HANDLE *privs, RPC_WSTR *server_princ_name, ULONG *authn_level, ULONG *authn_svc, ULONG *authz_svc, ULONG flags) DECLSPEC_HIDDEN;
BOOL RPCRT4_IsValidHttpPacket(RpcPktHdr *hdr, unsigned char *data, unsigned short data_len);
RPC_STATUS RPCRT4_ParseHttpPrepareHeader1(RpcPktHdr *header, unsigned char *data, ULONG *field1);
RPC_STATUS RPCRT4_ParseHttpPrepareHeader2(RpcPktHdr *header, unsigned char *data, ULONG *field1, ULONG *bytes_until_next_packet, ULONG *field3);
RPC_STATUS RPCRT4_ParseHttpFlowControlHeader(RpcPktHdr *header, unsigned char *data, BOOL server, ULONG *bytes_transmitted, ULONG *flow_control_increment, UUID *pipe_uuid);
NCA_STATUS RPC2NCA_STATUS(RPC_STATUS status);
RPC_STATUS RPCRT4_ClientConnectionAuth(RpcConnection* conn, BYTE *challenge, ULONG count);
RPC_STATUS RPCRT4_ServerConnectionAuth(RpcConnection* conn, BOOL start, RpcAuthVerifier *auth_data_in, ULONG auth_length_in, unsigned char **auth_data_out, ULONG *auth_length_out);
RPC_STATUS RPCRT4_AuthorizeConnection(RpcConnection* conn, BYTE *challenge, ULONG count);
RPC_STATUS RPCRT4_ServerGetRegisteredAuthInfo(USHORT auth_type, CredHandle *cred, TimeStamp *exp, ULONG *max_token);
RPC_STATUS RPCRT4_default_authorize(RpcConnection *conn, BOOL first_time, unsigned char *in_buffer, unsigned int in_size, unsigned char *out_buffer, unsigned int *out_size);
BOOL RPCRT4_default_is_authorized(RpcConnection *Connection);
RPC_STATUS RPCRT4_default_secure_packet(RpcConnection *Connection, enum secure_packet_direction dir, RpcPktHdr *hdr, unsigned int hdr_size, unsigned char *stub_data, unsigned int stub_data_size, RpcAuthVerifier *auth_hdr, unsigned char *auth_value, unsigned int auth_value_size);
RPC_STATUS RPCRT4_default_impersonate_client(RpcConnection *conn);
RPC_STATUS RPCRT4_default_revert_to_self(RpcConnection *conn);
RPC_STATUS RPCRT4_default_inquire_auth_client(RpcConnection *conn, RPC_AUTHZ_HANDLE *privs, RPC_WSTR *server_princ_name, ULONG *authn_level, ULONG *authn_svc, ULONG *authz_svc, ULONG flags);
#endif
+73 -73
View File
@@ -22,6 +22,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
@@ -164,7 +165,7 @@ static void RPCRT4_release_server_interface(RpcServerInterface *sif)
* CallsCompletedEvent is set */
if (sif->CallsCompletedEvent)
SetEvent(sif->CallsCompletedEvent);
HeapFree(GetProcessHeap(), 0, sif);
free(sif);
}
}
@@ -190,7 +191,7 @@ static RpcPktHdr *handle_bind_error(RpcConnection *conn, RPC_STATUS error)
reject_reason = REJECT_INVALID_CHECKSUM;
break;
default:
FIXME("unexpected status value %d\n", error);
FIXME("unexpected status value %ld\n", error);
/* fall through */
case RPC_S_INVALID_BOUND:
reject_reason = REJECT_REASON_NOT_SPECIFIED;
@@ -234,8 +235,7 @@ static RPC_STATUS process_bind_packet_no_send(
return RPC_S_INVALID_BOUND;
}
results = HeapAlloc(GetProcessHeap(), 0,
hdr->num_elements * sizeof(*results));
results = malloc(hdr->num_elements * sizeof(*results));
if (!results)
return RPC_S_OUT_OF_RESOURCES;
@@ -290,7 +290,7 @@ static RPC_STATUS process_bind_packet_no_send(
status = RPCRT4_MakeBinding(&conn->server_binding, conn);
if (status != RPC_S_OK)
{
HeapFree(GetProcessHeap(), 0, results);
free(results);
return status;
}
@@ -301,7 +301,7 @@ static RPC_STATUS process_bind_packet_no_send(
&conn->server_binding->Assoc);
if (status != RPC_S_OK)
{
HeapFree(GetProcessHeap(), 0, results);
free(results);
return status;
}
@@ -313,7 +313,7 @@ static RPC_STATUS process_bind_packet_no_send(
auth_length_out);
if (status != RPC_S_OK)
{
HeapFree(GetProcessHeap(), 0, results);
free(results);
return status;
}
}
@@ -324,7 +324,7 @@ static RPC_STATUS process_bind_packet_no_send(
conn->server_binding->Assoc->assoc_group_id,
conn->Endpoint, hdr->num_elements,
results);
HeapFree(GetProcessHeap(), 0, results);
free(results);
if (*ack_response)
conn->MaxTransmissionSize = hdr->max_tsize;
@@ -353,7 +353,7 @@ static RPC_STATUS process_bind_packet(RpcConnection *conn, RpcPktBindHdr *hdr,
status = RPCRT4_SendWithAuth(conn, response, NULL, 0, auth_data_out, auth_length_out);
else
status = ERROR_OUTOFMEMORY;
RPCRT4_FreeHeader(response);
free(response);
return status;
}
@@ -377,7 +377,7 @@ static RPC_STATUS process_request_packet(RpcConnection *conn, RpcPktRequestHdr *
status);
RPCRT4_Send(conn, response, NULL, 0);
RPCRT4_FreeHeader(response);
free(response);
return RPC_S_OK;
}
@@ -394,7 +394,7 @@ static RPC_STATUS process_request_packet(RpcConnection *conn, RpcPktRequestHdr *
NCA_S_UNK_IF);
RPCRT4_Send(conn, response, NULL, 0);
RPCRT4_FreeHeader(response);
free(response);
return RPC_S_OK;
}
msg->RpcInterfaceInformation = sif->If;
@@ -417,7 +417,7 @@ static RPC_STATUS process_request_packet(RpcConnection *conn, RpcPktRequestHdr *
NCA_S_OP_RNG_ERROR);
RPCRT4_Send(conn, response, NULL, 0);
RPCRT4_FreeHeader(response);
free(response);
}
func = sif->If->DispatchTable->DispatchTable[msg->ProcNum];
}
@@ -435,7 +435,7 @@ static RPC_STATUS process_request_packet(RpcConnection *conn, RpcPktRequestHdr *
__TRY {
if (func) func(msg);
} __EXCEPT_ALL {
WARN("exception caught with code 0x%08x = %d\n", GetExceptionCode(), GetExceptionCode());
WARN("exception caught with code 0x%08lx = %ld\n", GetExceptionCode(), GetExceptionCode());
exception = TRUE;
if (GetExceptionCode() == STATUS_ACCESS_VIOLATION)
status = ERROR_NOACCESS;
@@ -458,7 +458,7 @@ static RPC_STATUS process_request_packet(RpcConnection *conn, RpcPktRequestHdr *
if (response) {
status = RPCRT4_Send(conn, response, exception ? NULL : msg->Buffer,
exception ? 0 : msg->BufferLength);
RPCRT4_FreeHeader(response);
free(response);
} else
ERR("out of memory\n");
@@ -525,9 +525,9 @@ static void RPCRT4_process_packet(RpcConnection* conn, RpcPktHdr* hdr,
/* clean up */
I_RpcFree(msg->Buffer);
RPCRT4_FreeHeader(hdr);
HeapFree(GetProcessHeap(), 0, msg);
HeapFree(GetProcessHeap(), 0, auth_data);
free(hdr);
free(msg);
free(auth_data);
}
static DWORD CALLBACK RPCRT4_worker_thread(LPVOID the_arg)
@@ -536,7 +536,7 @@ static DWORD CALLBACK RPCRT4_worker_thread(LPVOID the_arg)
RPCRT4_process_packet(pkt->conn, pkt->hdr, pkt->msg, pkt->auth_data,
pkt->auth_length);
RPCRT4_ReleaseConnection(pkt->conn);
HeapFree(GetProcessHeap(), 0, pkt);
free(pkt);
return 0;
}
@@ -551,15 +551,16 @@ static DWORD CALLBACK RPCRT4_io_thread(LPVOID the_arg)
ULONG auth_length;
TRACE("(%p)\n", conn);
SetThreadDescription(GetCurrentThread(), L"wine_rpcrt4_io");
for (;;) {
msg = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RPC_MESSAGE));
msg = calloc(1, sizeof(RPC_MESSAGE));
if (!msg) break;
status = RPCRT4_ReceiveWithAuth(conn, &hdr, msg, &auth_data, &auth_length);
if (status != RPC_S_OK) {
WARN("receive failed with error %x\n", status);
HeapFree(GetProcessHeap(), 0, msg);
WARN("receive failed with error %lx\n", status);
free(msg);
break;
}
@@ -574,12 +575,12 @@ static DWORD CALLBACK RPCRT4_io_thread(LPVOID the_arg)
case PKT_REQUEST:
TRACE("got request packet\n");
packet = HeapAlloc(GetProcessHeap(), 0, sizeof(RpcPacket));
packet = malloc(sizeof(RpcPacket));
if (!packet) {
I_RpcFree(msg->Buffer);
RPCRT4_FreeHeader(hdr);
HeapFree(GetProcessHeap(), 0, msg);
HeapFree(GetProcessHeap(), 0, auth_data);
free(hdr);
free(msg);
free(auth_data);
goto exit;
}
packet->conn = RPCRT4_GrabConnection( conn );
@@ -588,8 +589,8 @@ static DWORD CALLBACK RPCRT4_io_thread(LPVOID the_arg)
packet->auth_data = auth_data;
packet->auth_length = auth_length;
if (!QueueUserWorkItem(RPCRT4_worker_thread, packet, WT_EXECUTELONGFUNCTION)) {
ERR("couldn't queue work item for worker thread, error was %d\n", GetLastError());
HeapFree(GetProcessHeap(), 0, packet);
ERR("couldn't queue work item for worker thread, error was %ld\n", GetLastError());
free(packet);
status = RPC_S_OUT_OF_RESOURCES;
} else {
continue;
@@ -608,12 +609,12 @@ static DWORD CALLBACK RPCRT4_io_thread(LPVOID the_arg)
}
I_RpcFree(msg->Buffer);
RPCRT4_FreeHeader(hdr);
HeapFree(GetProcessHeap(), 0, msg);
HeapFree(GetProcessHeap(), 0, auth_data);
free(hdr);
free(msg);
free(auth_data);
if (status != RPC_S_OK) {
WARN("processing packet failed with error %u\n", status);
WARN("processing packet failed with error %lu\n", status);
break;
}
}
@@ -627,7 +628,7 @@ void RPCRT4_new_client(RpcConnection* conn)
HANDLE thread = CreateThread(NULL, 0, RPCRT4_io_thread, conn, 0, NULL);
if (!thread) {
DWORD err = GetLastError();
ERR("failed to create thread, error=%08x\n", err);
ERR("failed to create thread, error=%08lx\n", err);
RPCRT4_ReleaseConnection(conn);
}
/* we could set conn->thread, but then we'd have to make the io_thread wait
@@ -648,6 +649,7 @@ static DWORD CALLBACK RPCRT4_server_thread(LPVOID the_arg)
BOOL set_ready_event = FALSE;
TRACE("(the_arg == ^%p)\n", the_arg);
SetThreadDescription(GetCurrentThread(), L"wine_rpcrt4_server");
for (;;) {
objs = cps->ops->get_wait_array(cps, objs, &count);
@@ -881,9 +883,7 @@ RPC_STATUS WINAPI RpcServerInqBindings( RPC_BINDING_VECTOR** BindingVector )
}
if (count) {
/* export bindings */
*BindingVector = HeapAlloc(GetProcessHeap(), 0,
sizeof(RPC_BINDING_VECTOR) +
sizeof(RPC_BINDING_HANDLE)*(count-1));
*BindingVector = malloc(sizeof(RPC_BINDING_VECTOR) + sizeof(RPC_BINDING_HANDLE) * (count - 1));
(*BindingVector)->Count = count;
count = 0;
LIST_FOR_EACH_ENTRY(ps, &protseqs, RpcServerProtseq, entry) {
@@ -957,11 +957,11 @@ static RPC_STATUS alloc_serverprotoseq(UINT MaxCalls, const char *Protseq, RpcSe
if (!*ps)
return RPC_S_OUT_OF_RESOURCES;
(*ps)->MaxCalls = MaxCalls;
(*ps)->Protseq = RPCRT4_strdupA(Protseq);
(*ps)->Protseq = strdup(Protseq);
(*ps)->ops = ops;
list_init(&(*ps)->listeners);
list_init(&(*ps)->connections);
InitializeCriticalSection(&(*ps)->cs);
InitializeCriticalSectionEx(&(*ps)->cs, 0, RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO);
(*ps)->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": RpcServerProtseq.cs");
list_add_head(&protseqs, &(*ps)->entry);
@@ -974,13 +974,13 @@ static RPC_STATUS alloc_serverprotoseq(UINT MaxCalls, const char *Protseq, RpcSe
/* must be called with server_cs held */
static void destroy_serverprotoseq(RpcServerProtseq *ps)
{
RPCRT4_strfree(ps->Protseq);
free(ps->Protseq);
ps->cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&ps->cs);
CloseHandle(ps->mgr_mutex);
CloseHandle(ps->server_ready_event);
list_remove(&ps->entry);
HeapFree(GetProcessHeap(), 0, ps);
free(ps);
}
/* Finds a given protseq or creates a new one if one doesn't already exist */
@@ -1016,7 +1016,7 @@ RPC_STATUS WINAPI RpcServerUseProtseqEpExA( RPC_CSTR Protseq, UINT MaxCalls, RPC
RpcServerProtseq* ps;
RPC_STATUS status;
TRACE("(%s,%u,%s,%p,{%u,%u,%u})\n", debugstr_a((const char *)Protseq),
TRACE("(%s,%u,%s,%p,{%u,%lu,%lu})\n", debugstr_a((const char *)Protseq),
MaxCalls, debugstr_a((const char *)Endpoint), SecurityDescriptor,
lpPolicy->Length, lpPolicy->EndpointFlags, lpPolicy->NICFlags );
@@ -1038,19 +1038,19 @@ RPC_STATUS WINAPI RpcServerUseProtseqEpExW( RPC_WSTR Protseq, UINT MaxCalls, RPC
LPSTR ProtseqA;
LPSTR EndpointA;
TRACE("(%s,%u,%s,%p,{%u,%u,%u})\n", debugstr_w( Protseq ), MaxCalls,
TRACE("(%s,%u,%s,%p,{%u,%lu,%lu})\n", debugstr_w( Protseq ), MaxCalls,
debugstr_w( Endpoint ), SecurityDescriptor,
lpPolicy->Length, lpPolicy->EndpointFlags, lpPolicy->NICFlags );
ProtseqA = RPCRT4_strdupWtoA(Protseq);
status = RPCRT4_get_or_create_serverprotseq(MaxCalls, ProtseqA, &ps);
RPCRT4_strfree(ProtseqA);
free(ProtseqA);
if (status != RPC_S_OK)
return status;
EndpointA = RPCRT4_strdupWtoA(Endpoint);
status = RPCRT4_use_protseq(ps, EndpointA);
RPCRT4_strfree(EndpointA);
free(EndpointA);
return status;
}
@@ -1084,7 +1084,7 @@ RPC_STATUS WINAPI RpcServerUseProtseqW(RPC_WSTR Protseq, unsigned int MaxCalls,
ProtseqA = RPCRT4_strdupWtoA(Protseq);
status = RPCRT4_get_or_create_serverprotseq(MaxCalls, ProtseqA, &ps);
RPCRT4_strfree(ProtseqA);
free(ProtseqA);
if (status != RPC_S_OK)
return status;
@@ -1166,13 +1166,13 @@ RPC_STATUS WINAPI RpcServerRegisterIf3( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid,
for (i=0; i<If->DispatchTable->DispatchTableCount; i++) {
TRACE(" entry %d: %p\n", i, If->DispatchTable->DispatchTable[i]);
}
TRACE(" reserved: %ld\n", If->DispatchTable->Reserved);
TRACE(" reserved: %Id\n", If->DispatchTable->Reserved);
}
TRACE(" protseq endpoint count: %d\n", If->RpcProtseqEndpointCount);
TRACE(" default manager epv: %p\n", If->DefaultManagerEpv);
TRACE(" interpreter info: %p\n", If->InterpreterInfo);
sif = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcServerInterface));
sif = calloc(1, sizeof(RpcServerInterface));
sif->If = If;
if (MgrTypeUuid) {
sif->MgrTypeUuid = *MgrTypeUuid;
@@ -1236,7 +1236,7 @@ RPC_STATUS WINAPI RpcServerUnregisterIf( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid
}
if (completed)
HeapFree(GetProcessHeap(), 0, cif);
free(cif);
else if (event) {
/* sif will be freed when the last call is completed, so be careful not to
* touch that memory here as that could happen before we get here */
@@ -1302,14 +1302,14 @@ RPC_STATUS WINAPI RpcObjectSetType( UUID* ObjUuid, UUID* TypeUuid )
prev->next = map->next;
else
RpcObjTypeMaps = map->next;
HeapFree(GetProcessHeap(), 0, map);
free(map);
}
} else {
/* ... , fail if we found it ... */
if (map)
return RPC_S_ALREADY_REGISTERED;
/* ... otherwise create a new one and add it in. */
map = HeapAlloc(GetProcessHeap(), 0, sizeof(RpcObjTypeMap));
map = malloc(sizeof(RpcObjTypeMap));
map->Object = *ObjUuid;
map->Type = *TypeUuid;
map->next = NULL;
@@ -1341,7 +1341,7 @@ static RPC_STATUS find_security_package(ULONG auth_type, SecPkgInfoW **packages_
sec_status = EnumerateSecurityPackagesW(&package_count, &packages);
if (sec_status != SEC_E_OK)
{
ERR("EnumerateSecurityPackagesW failed with error 0x%08x\n", sec_status);
ERR("EnumerateSecurityPackagesW failed with error 0x%08lx\n", sec_status);
return RPC_S_SEC_PKG_ERROR;
}
@@ -1351,12 +1351,12 @@ static RPC_STATUS find_security_package(ULONG auth_type, SecPkgInfoW **packages_
if (i == package_count)
{
WARN("unsupported AuthnSvc %u\n", auth_type);
WARN("unsupported AuthnSvc %lu\n", auth_type);
FreeContextBuffer(packages);
return RPC_S_UNKNOWN_AUTHN_SERVICE;
}
TRACE("found package %s for service %u\n", debugstr_w(packages[i].Name), auth_type);
TRACE("found package %s for service %lu\n", debugstr_w(packages[i].Name), auth_type);
*packages_buf = packages;
*ret = packages + i;
return RPC_S_OK;
@@ -1400,9 +1400,9 @@ void RPCRT4_ServerFreeAllRegisteredAuthInfo(void)
EnterCriticalSection(&server_auth_info_cs);
LIST_FOR_EACH_ENTRY_SAFE(auth_info, cursor2, &server_registered_auth_info, struct rpc_server_registered_auth_info, entry)
{
HeapFree(GetProcessHeap(), 0, auth_info->package_name);
HeapFree(GetProcessHeap(), 0, auth_info->principal);
HeapFree(GetProcessHeap(), 0, auth_info);
free(auth_info->package_name);
free(auth_info->principal);
free(auth_info);
}
LeaveCriticalSection(&server_auth_info_cs);
DeleteCriticalSection(&server_auth_info_cs);
@@ -1417,14 +1417,14 @@ RPC_STATUS WINAPI RpcServerRegisterAuthInfoA( RPC_CSTR ServerPrincName, ULONG Au
WCHAR *principal_name = NULL;
RPC_STATUS status;
TRACE("(%s,%u,%p,%p)\n", ServerPrincName, AuthnSvc, GetKeyFn, Arg);
TRACE("(%s,%lu,%p,%p)\n", ServerPrincName, AuthnSvc, GetKeyFn, Arg);
if(ServerPrincName && !(principal_name = RPCRT4_strdupAtoW((const char*)ServerPrincName)))
return RPC_S_OUT_OF_RESOURCES;
status = RpcServerRegisterAuthInfoW(principal_name, AuthnSvc, GetKeyFn, Arg);
HeapFree(GetProcessHeap(), 0, principal_name);
free(principal_name);
return status;
}
@@ -1440,27 +1440,27 @@ RPC_STATUS WINAPI RpcServerRegisterAuthInfoW( RPC_WSTR ServerPrincName, ULONG Au
ULONG max_token;
RPC_STATUS status;
TRACE("(%s,%u,%p,%p)\n", debugstr_w(ServerPrincName), AuthnSvc, GetKeyFn, Arg);
TRACE("(%s,%lu,%p,%p)\n", debugstr_w(ServerPrincName), AuthnSvc, GetKeyFn, Arg);
status = find_security_package(AuthnSvc, &packages, &package);
if (status != RPC_S_OK)
return status;
package_name = RPCRT4_strdupW(package->Name);
package_name = wcsdup(package->Name);
max_token = package->cbMaxToken;
FreeContextBuffer(packages);
if (!package_name)
return RPC_S_OUT_OF_RESOURCES;
auth_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*auth_info));
auth_info = calloc(1, sizeof(*auth_info));
if (!auth_info) {
HeapFree(GetProcessHeap(), 0, package_name);
free(package_name);
return RPC_S_OUT_OF_RESOURCES;
}
if (ServerPrincName && !(auth_info->principal = RPCRT4_strdupW(ServerPrincName))) {
HeapFree(GetProcessHeap(), 0, package_name);
HeapFree(GetProcessHeap(), 0, auth_info);
if (ServerPrincName && !(auth_info->principal = wcsdup(ServerPrincName))) {
free(package_name);
free(auth_info);
return RPC_S_OUT_OF_RESOURCES;
}
@@ -1483,7 +1483,7 @@ RPC_STATUS RPC_ENTRY RpcServerInqDefaultPrincNameA(ULONG AuthnSvc, RPC_CSTR *Pri
RPC_STATUS ret;
RPC_WSTR principalW;
TRACE("%u, %p\n", AuthnSvc, PrincName);
TRACE("%lu, %p\n", AuthnSvc, PrincName);
if ((ret = RpcServerInqDefaultPrincNameW( AuthnSvc, &principalW )) == RPC_S_OK)
{
@@ -1500,14 +1500,14 @@ RPC_STATUS RPC_ENTRY RpcServerInqDefaultPrincNameW(ULONG AuthnSvc, RPC_WSTR *Pri
{
ULONG len = 0;
FIXME("%u, %p\n", AuthnSvc, PrincName);
FIXME("%lu, %p\n", AuthnSvc, PrincName);
if (AuthnSvc != RPC_C_AUTHN_WINNT) return RPC_S_UNKNOWN_AUTHN_SERVICE;
GetUserNameExW( NameSamCompatible, NULL, &len );
if (GetLastError() != ERROR_MORE_DATA) return RPC_S_INTERNAL_ERROR;
if (!(*PrincName = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
if (!(*PrincName = malloc(len * sizeof(WCHAR))))
return RPC_S_OUT_OF_MEMORY;
GetUserNameExW( NameSamCompatible, *PrincName, &len );
@@ -1575,7 +1575,7 @@ RPC_STATUS WINAPI RpcMgmtWaitServerListen( void )
if (!wait_thread)
break;
TRACE("waiting for thread %u\n", GetThreadId(wait_thread));
TRACE("waiting for thread %lu\n", GetThreadId(wait_thread));
LeaveCriticalSection(&listen_cs);
WaitForSingleObject(wait_thread, INFINITE);
CloseHandle(wait_thread);
@@ -1639,7 +1639,7 @@ RPC_STATUS WINAPI I_RpcServerStopListening( void )
*/
UINT WINAPI I_RpcWindowProc( void *hWnd, UINT Message, UINT wParam, ULONG lParam )
{
FIXME( "(%p,%08x,%08x,%08x): stub\n", hWnd, Message, wParam, lParam );
FIXME( "(%p,%08x,%08x,%08lx): stub\n", hWnd, Message, wParam, lParam );
return 0;
}
@@ -1662,7 +1662,7 @@ RPC_STATUS WINAPI RpcMgmtInqStats(RPC_BINDING_HANDLE Binding, RPC_STATS_VECTOR *
FIXME("(%p,%p)\n", Binding, Statistics);
if ((stats = HeapAlloc(GetProcessHeap(), 0, sizeof(RPC_STATS_VECTOR))))
if ((stats = malloc(sizeof(RPC_STATS_VECTOR))))
{
stats->Count = 1;
stats->Stats[0] = 0;
@@ -1681,7 +1681,7 @@ RPC_STATUS WINAPI RpcMgmtStatsVectorFree(RPC_STATS_VECTOR **StatsVector)
if (StatsVector)
{
HeapFree(GetProcessHeap(), 0, *StatsVector);
free(*StatsVector);
*StatsVector = NULL;
}
return RPC_S_OK;
@@ -1693,7 +1693,7 @@ RPC_STATUS WINAPI RpcMgmtStatsVectorFree(RPC_STATS_VECTOR **StatsVector)
RPC_STATUS WINAPI RpcMgmtEpEltInqBegin(RPC_BINDING_HANDLE Binding, ULONG InquiryType,
RPC_IF_ID *IfId, ULONG VersOption, UUID *ObjectUuid, RPC_EP_INQ_HANDLE* InquiryContext)
{
FIXME("(%p,%u,%p,%u,%p,%p): stub\n",
FIXME("(%p,%lu,%p,%lu,%p,%p): stub\n",
Binding, InquiryType, IfId, VersOption, ObjectUuid, InquiryContext);
return RPC_S_INVALID_BINDING;
}
@@ -1733,7 +1733,7 @@ RPC_STATUS WINAPI RpcMgmtSetAuthorizationFn(RPC_MGMT_AUTHORIZATION_FN fn)
*/
RPC_STATUS WINAPI RpcMgmtSetServerStackSize(ULONG ThreadStackSize)
{
FIXME("(0x%x): stub\n", ThreadStackSize);
FIXME("(0x%lx): stub\n", ThreadStackSize);
return RPC_S_OK;
}
+4 -4
View File
@@ -77,10 +77,10 @@ typedef struct _RpcServerInterface
BOOL Delete; /* delete when the last call finishes */
} RpcServerInterface;
void RPCRT4_new_client(RpcConnection* conn) DECLSPEC_HIDDEN;
const struct protseq_ops *rpcrt4_get_protseq_ops(const char *protseq) DECLSPEC_HIDDEN;
void RPCRT4_new_client(RpcConnection* conn);
const struct protseq_ops *rpcrt4_get_protseq_ops(const char *protseq);
void RPCRT4_destroy_all_protseqs(void) DECLSPEC_HIDDEN;
void RPCRT4_ServerFreeAllRegisteredAuthInfo(void) DECLSPEC_HIDDEN;
void RPCRT4_destroy_all_protseqs(void);
void RPCRT4_ServerFreeAllRegisteredAuthInfo(void);
#endif /* __WINE_RPC_SERVER_H */
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+62 -31
View File
@@ -95,6 +95,12 @@ struct threaddata
struct context_handle_list *context_handle_list;
};
struct interface_header
{
unsigned int length;
RPC_SYNTAX_IDENTIFIER id;
};
/***********************************************************************
* DllMain
*
@@ -130,7 +136,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
ERR("tdata->connection should be NULL but is still set to %p\n", tdata->connection);
if (tdata->server_binding)
ERR("tdata->server_binding should be NULL but is still set to %p\n", tdata->server_binding);
HeapFree(GetProcessHeap(), 0, tdata);
free(tdata);
}
break;
@@ -157,7 +163,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
*/
RPC_STATUS WINAPI RpcStringFreeA(RPC_CSTR* String)
{
HeapFree( GetProcessHeap(), 0, *String);
free(*String);
if (String) *String = NULL;
return RPC_S_OK;
@@ -174,12 +180,31 @@ RPC_STATUS WINAPI RpcStringFreeA(RPC_CSTR* String)
*/
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR* String)
{
HeapFree( GetProcessHeap(), 0, *String);
free(*String);
if (String) *String = NULL;
return RPC_S_OK;
}
/*************************************************************************
* RpcIfInqId [RPCRT4.@]
*
* Get interface UUID and version.
*/
RPC_STATUS WINAPI RpcIfInqId(RPC_IF_HANDLE if_handle, RPC_IF_ID *if_id)
{
struct interface_header *header = (struct interface_header *)if_handle;
TRACE("(%p,%p)\n", if_handle, if_id);
if_id->Uuid = header->id.SyntaxGUID;
if_id->VersMajor = header->id.SyntaxVersion.MajorVersion;
if_id->VersMinor = header->id.SyntaxVersion.MinorVersion;
TRACE("UUID:%s VersMajor:%hu VersMinor:%hu.\n", debugstr_guid(&if_id->Uuid), if_id->VersMajor,
if_id->VersMinor);
return RPC_S_OK;
}
/*************************************************************************
* RpcRaiseException [RPCRT4.@]
*
@@ -347,11 +372,11 @@ static RPC_STATUS RPC_UuidGetNodeAddress(BYTE *address)
DWORD status = RPC_S_OK;
ULONG buflen = sizeof(IP_ADAPTER_INFO);
PIP_ADAPTER_INFO adapter = HeapAlloc(GetProcessHeap(), 0, buflen);
PIP_ADAPTER_INFO adapter = malloc(buflen);
if (GetAdaptersInfo(adapter, &buflen) == ERROR_BUFFER_OVERFLOW) {
HeapFree(GetProcessHeap(), 0, adapter);
adapter = HeapAlloc(GetProcessHeap(), 0, buflen);
free(adapter);
adapter = malloc(buflen);
}
if (GetAdaptersInfo(adapter, &buflen) == NO_ERROR) {
@@ -367,7 +392,7 @@ static RPC_STATUS RPC_UuidGetNodeAddress(BYTE *address)
status = RPC_S_UUID_LOCAL_ONLY;
}
HeapFree(GetProcessHeap(), 0, adapter);
free(adapter);
return status;
}
@@ -513,18 +538,26 @@ unsigned short WINAPI UuidHash(UUID *uuid, RPC_STATUS *Status)
*/
RPC_STATUS WINAPI UuidToStringA(UUID *Uuid, RPC_CSTR* StringUuid)
{
*StringUuid = HeapAlloc( GetProcessHeap(), 0, sizeof(char) * 37);
*StringUuid = malloc(37);
if(!(*StringUuid))
return RPC_S_OUT_OF_MEMORY;
if (!Uuid) Uuid = &uuid_nil;
#ifdef __REACTOS__
sprintf( (char*)*StringUuid, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
Uuid->Data1, Uuid->Data2, Uuid->Data3,
Uuid->Data4[0], Uuid->Data4[1], Uuid->Data4[2],
Uuid->Data4[3], Uuid->Data4[4], Uuid->Data4[5],
Uuid->Data4[6], Uuid->Data4[7] );
#else
sprintf( (char*)*StringUuid, "%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
Uuid->Data1, Uuid->Data2, Uuid->Data3,
Uuid->Data4[0], Uuid->Data4[1], Uuid->Data4[2],
Uuid->Data4[3], Uuid->Data4[4], Uuid->Data4[5],
Uuid->Data4[6], Uuid->Data4[7] );
#endif
return RPC_S_OK;
}
@@ -543,11 +576,19 @@ RPC_STATUS WINAPI UuidToStringW(UUID *Uuid, RPC_WSTR* StringUuid)
if (!Uuid) Uuid = &uuid_nil;
#ifdef __REACTOS__
sprintf(buf, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
Uuid->Data1, Uuid->Data2, Uuid->Data3,
Uuid->Data4[0], Uuid->Data4[1], Uuid->Data4[2],
Uuid->Data4[3], Uuid->Data4[4], Uuid->Data4[5],
Uuid->Data4[6], Uuid->Data4[7] );
#else
sprintf(buf, "%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
Uuid->Data1, Uuid->Data2, Uuid->Data3,
Uuid->Data4[0], Uuid->Data4[1], Uuid->Data4[2],
Uuid->Data4[3], Uuid->Data4[4], Uuid->Data4[5],
Uuid->Data4[6], Uuid->Data4[7] );
#endif
*StringUuid = RPCRT4_strdupAtoW(buf);
@@ -647,16 +688,6 @@ RPC_STATUS WINAPI UuidFromStringW(RPC_WSTR s, UUID *uuid)
return RPC_S_OK;
}
/***********************************************************************
* DllRegisterServer (RPCRT4.@)
*/
HRESULT WINAPI DllRegisterServer( void )
{
FIXME( "(): stub\n" );
return S_OK;
}
#define MAX_RPC_ERROR_TEXT 256
/******************************************************************************
@@ -715,7 +746,7 @@ RPC_STATUS RPC_ENTRY DceErrorInqTextA (RPC_STATUS e, RPC_CSTR buffer)
*/
void * WINAPI I_RpcAllocate(unsigned int Size)
{
return HeapAlloc(GetProcessHeap(), 0, Size);
return malloc(Size);
}
/******************************************************************************
@@ -723,7 +754,7 @@ void * WINAPI I_RpcAllocate(unsigned int Size)
*/
void WINAPI I_RpcFree(void *Object)
{
HeapFree(GetProcessHeap(), 0, Object);
free(Object);
}
/******************************************************************************
@@ -739,7 +770,7 @@ void WINAPI I_RpcFree(void *Object)
*/
LONG WINAPI I_RpcMapWin32Status(RPC_STATUS status)
{
TRACE("(%d)\n", status);
TRACE("(%ld)\n", status);
switch (status)
{
case ERROR_ACCESS_DENIED: return STATUS_ACCESS_DENIED;
@@ -858,7 +889,7 @@ LONG WINAPI I_RpcMapWin32Status(RPC_STATUS status)
*/
int WINAPI RpcExceptionFilter(ULONG ExceptionCode)
{
TRACE("0x%x\n", ExceptionCode);
TRACE("0x%lx\n", ExceptionCode);
switch (ExceptionCode)
{
case STATUS_DATATYPE_MISALIGNMENT:
@@ -907,7 +938,7 @@ RPC_STATUS RPC_ENTRY RpcErrorSaveErrorInfo(RPC_ERROR_ENUM_HANDLE *EnumHandle, vo
*/
RPC_STATUS RPC_ENTRY RpcErrorLoadErrorInfo(void *ErrorBlob, SIZE_T BlobSize, RPC_ERROR_ENUM_HANDLE *EnumHandle)
{
FIXME("(%p %lu %p): stub\n", ErrorBlob, BlobSize, EnumHandle);
FIXME("(%p %Iu %p): stub\n", ErrorBlob, BlobSize, EnumHandle);
return ERROR_CALL_NOT_IMPLEMENTED;
}
@@ -925,7 +956,7 @@ RPC_STATUS RPC_ENTRY RpcErrorGetNextRecord(RPC_ERROR_ENUM_HANDLE *EnumHandle, BO
*/
RPC_STATUS RPC_ENTRY RpcMgmtSetCancelTimeout(LONG Timeout)
{
FIXME("(%d): stub\n", Timeout);
FIXME("(%ld): stub\n", Timeout);
return RPC_S_OK;
}
@@ -934,10 +965,10 @@ static struct threaddata *get_or_create_threaddata(void)
struct threaddata *tdata = NtCurrentTeb()->ReservedForNtRpc;
if (!tdata)
{
tdata = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*tdata));
tdata = calloc(1, sizeof(*tdata));
if (!tdata) return NULL;
InitializeCriticalSection(&tdata->cs);
InitializeCriticalSectionEx(&tdata->cs, 0, RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO);
tdata->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": threaddata.cs");
tdata->thread_id = GetCurrentThreadId();
@@ -984,7 +1015,7 @@ void RPCRT4_PushThreadContextHandle(NDR_SCONTEXT SContext)
if (!tdata) return;
context_handle_list = HeapAlloc(GetProcessHeap(), 0, sizeof(*context_handle_list));
context_handle_list = malloc(sizeof(*context_handle_list));
if (!context_handle_list) return;
context_handle_list->context_handle = SContext;
@@ -1007,7 +1038,7 @@ void RPCRT4_RemoveThreadContextHandle(NDR_SCONTEXT SContext)
prev->next = current->next;
else
tdata->context_handle_list = current->next;
HeapFree(GetProcessHeap(), 0, current);
free(current);
return;
}
}
@@ -1026,7 +1057,7 @@ NDR_SCONTEXT RPCRT4_PopThreadContextHandle(void)
tdata->context_handle_list = context_handle_list->next;
context_handle = context_handle_list->context_handle;
HeapFree(GetProcessHeap(), 0, context_handle_list);
free(context_handle_list);
return context_handle;
}
@@ -1064,7 +1095,7 @@ RPC_STATUS RPC_ENTRY RpcCancelThreadEx(void* ThreadHandle, LONG Timeout)
{
DWORD target_tid;
FIXME("(%p, %d)\n", ThreadHandle, Timeout);
FIXME("(%p, %ld)\n", ThreadHandle, Timeout);
target_tid = GetThreadId(ThreadHandle);
if (!target_tid)
@@ -1072,7 +1103,7 @@ RPC_STATUS RPC_ENTRY RpcCancelThreadEx(void* ThreadHandle, LONG Timeout)
if (Timeout)
{
FIXME("(%p, %d)\n", ThreadHandle, Timeout);
FIXME("(%p, %ld)\n", ThreadHandle, Timeout);
return RPC_S_OK;
}
else
+114
View File
@@ -0,0 +1,114 @@
#if defined(_M_IX86) || defined(_M_AMD64)
#include <asm.inc>
#elif defined(_M_ARM)
#include <kxarm.h>
#endif
#ifdef _M_IX86
.code32
THUNK_ENTRY MACRO num:REQ
ALIGN 4
PUBLIC _ObjectStublessClient&num
_ObjectStublessClient&num:
mov eax, num
jmp _call_stubless_func
ENDM
THUNK_ENTRY_VTBL MACRO num:REQ
ALIGN 4
PUBLIC _NdrProxyForwardingFunction&num
_NdrProxyForwardingFunction&num:
mov eax, [esp + 4]
mov eax, [eax + 16]
mov [esp + 4], eax
mov eax, [eax]
DB 0ffh, 0a0h /* jmp *offset(%eax) */
DD 4 * num
ENDM
#elif defined(_M_AMD64)
.code64
THUNK_ENTRY MACRO num:REQ
ALIGN 4
PUBLIC ObjectStublessClient&num
ObjectStublessClient&num:
mov r10d, num
jmp call_stubless_func
ENDM
THUNK_ENTRY_VTBL MACRO num:REQ
ALIGN 4
PUBLIC NdrProxyForwardingFunction&num
NdrProxyForwardingFunction&num:
mov rcx, [rcx + 020h]
mov rax, [rcx]
DB 0ffh, 0a0h /* jmp *offset(%rax) */
DD 8 * num
ENDM
#elif defined(_M_ARM)
.code32
// FIXME: this is probably broken
THUNK_ENTRY MACRO num:REQ
ldr ip, .number
b.w call_stubless_func
.number DB num
ENDM
THUNK_ENTRY_VTBL MACRO num:REQ
ALIGN 4
ldr r0, [r0, 10h]
ldr ip, [r0]
ldr pc, [ip, 4 * num]
ENDM
#elif defined(_M_ARM64)
.code64
// FIXME: this is probably broken
THUNK_ENTRY MACRO num:REQ
mov w16, num
b call_stubless_func
ENDM
THUNK_ENTRY_VTBL MACRO num:REQ
ldr x0, [x0, 20h]
ldr x16, [x0]
mov x17, num
ldr x16, [x16, x17, lsl 3]
br x16
ENDM
#endif
ALL_THUNK_ENTRIES MACRO entry
blk = 3
REPT 1021
entry %blk
blk = blk + 1
ENDM
ENDM
#ifdef _M_IX86
EXTERN _call_stubless_func:PROC
PUBLIC _stubless_thunks
_stubless_thunks:
ALL_THUNK_ENTRIES THUNK_ENTRY
PUBLIC _vtbl_thunks
_vtbl_thunks:
ALL_THUNK_ENTRIES THUNK_ENTRY_VTBL
#else
EXTERN call_stubless_func:PROC
PUBLIC stubless_thunks
stubless_thunks:
ALL_THUNK_ENTRIES THUNK_ENTRY
PUBLIC vtbl_thunks
vtbl_thunks:
ALL_THUNK_ENTRIES THUNK_ENTRY_VTBL
#endif
END
+543
View File
@@ -0,0 +1,543 @@
/*
* vtbl thunks
*
* Copyright 2009, 2023 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#if 0
#pragma makedep arm64ec_x64
#endif
#define COBJMACROS
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "rpcproxy.h"
#include "cpsf.h"
#include "ndrtypes.h"
#include "ndr_stubless.h"
#include "wine/asm.h"
#define ALL_THUNK_ENTRIES \
T(3) T(4) T(5) T(6) T(7) T(8) T(9) T(10) T(11) T(12) T(13) T(14) T(15) \
T(16) T(17) T(18) T(19) T(20) T(21) T(22) T(23) T(24) T(25) T(26) T(27) T(28) T(29) T(30) T(31) \
T(32) T(33) T(34) T(35) T(36) T(37) T(38) T(39) T(40) T(41) T(42) T(43) T(44) T(45) T(46) T(47) \
T(48) T(49) T(50) T(51) T(52) T(53) T(54) T(55) T(56) T(57) T(58) T(59) T(60) T(61) T(62) T(63) \
T(64) T(65) T(66) T(67) T(68) T(69) T(70) T(71) T(72) T(73) T(74) T(75) T(76) T(77) T(78) T(79) \
T(80) T(81) T(82) T(83) T(84) T(85) T(86) T(87) T(88) T(89) T(90) T(91) T(92) T(93) T(94) T(95) \
T(96) T(97) T(98) T(99) T(100) T(101) T(102) T(103) T(104) T(105) T(106) T(107) T(108) T(109) T(110) T(111) \
T(112) T(113) T(114) T(115) T(116) T(117) T(118) T(119) T(120) T(121) T(122) T(123) T(124) T(125) T(126) T(127) \
T(128) T(129) T(130) T(131) T(132) T(133) T(134) T(135) T(136) T(137) T(138) T(139) T(140) T(141) T(142) T(143) \
T(144) T(145) T(146) T(147) T(148) T(149) T(150) T(151) T(152) T(153) T(154) T(155) T(156) T(157) T(158) T(159) \
T(160) T(161) T(162) T(163) T(164) T(165) T(166) T(167) T(168) T(169) T(170) T(171) T(172) T(173) T(174) T(175) \
T(176) T(177) T(178) T(179) T(180) T(181) T(182) T(183) T(184) T(185) T(186) T(187) T(188) T(189) T(190) T(191) \
T(192) T(193) T(194) T(195) T(196) T(197) T(198) T(199) T(200) T(201) T(202) T(203) T(204) T(205) T(206) T(207) \
T(208) T(209) T(210) T(211) T(212) T(213) T(214) T(215) T(216) T(217) T(218) T(219) T(220) T(221) T(222) T(223) \
T(224) T(225) T(226) T(227) T(228) T(229) T(230) T(231) T(232) T(233) T(234) T(235) T(236) T(237) T(238) T(239) \
T(240) T(241) T(242) T(243) T(244) T(245) T(246) T(247) T(248) T(249) T(250) T(251) T(252) T(253) T(254) T(255) \
T(256) T(257) T(258) T(259) T(260) T(261) T(262) T(263) T(264) T(265) T(266) T(267) T(268) T(269) T(270) T(271) \
T(272) T(273) T(274) T(275) T(276) T(277) T(278) T(279) T(280) T(281) T(282) T(283) T(284) T(285) T(286) T(287) \
T(288) T(289) T(290) T(291) T(292) T(293) T(294) T(295) T(296) T(297) T(298) T(299) T(300) T(301) T(302) T(303) \
T(304) T(305) T(306) T(307) T(308) T(309) T(310) T(311) T(312) T(313) T(314) T(315) T(316) T(317) T(318) T(319) \
T(320) T(321) T(322) T(323) T(324) T(325) T(326) T(327) T(328) T(329) T(330) T(331) T(332) T(333) T(334) T(335) \
T(336) T(337) T(338) T(339) T(340) T(341) T(342) T(343) T(344) T(345) T(346) T(347) T(348) T(349) T(350) T(351) \
T(352) T(353) T(354) T(355) T(356) T(357) T(358) T(359) T(360) T(361) T(362) T(363) T(364) T(365) T(366) T(367) \
T(368) T(369) T(370) T(371) T(372) T(373) T(374) T(375) T(376) T(377) T(378) T(379) T(380) T(381) T(382) T(383) \
T(384) T(385) T(386) T(387) T(388) T(389) T(390) T(391) T(392) T(393) T(394) T(395) T(396) T(397) T(398) T(399) \
T(400) T(401) T(402) T(403) T(404) T(405) T(406) T(407) T(408) T(409) T(410) T(411) T(412) T(413) T(414) T(415) \
T(416) T(417) T(418) T(419) T(420) T(421) T(422) T(423) T(424) T(425) T(426) T(427) T(428) T(429) T(430) T(431) \
T(432) T(433) T(434) T(435) T(436) T(437) T(438) T(439) T(440) T(441) T(442) T(443) T(444) T(445) T(446) T(447) \
T(448) T(449) T(450) T(451) T(452) T(453) T(454) T(455) T(456) T(457) T(458) T(459) T(460) T(461) T(462) T(463) \
T(464) T(465) T(466) T(467) T(468) T(469) T(470) T(471) T(472) T(473) T(474) T(475) T(476) T(477) T(478) T(479) \
T(480) T(481) T(482) T(483) T(484) T(485) T(486) T(487) T(488) T(489) T(490) T(491) T(492) T(493) T(494) T(495) \
T(496) T(497) T(498) T(499) T(500) T(501) T(502) T(503) T(504) T(505) T(506) T(507) T(508) T(509) T(510) T(511) \
T(512) T(513) T(514) T(515) T(516) T(517) T(518) T(519) T(520) T(521) T(522) T(523) T(524) T(525) T(526) T(527) \
T(528) T(529) T(530) T(531) T(532) T(533) T(534) T(535) T(536) T(537) T(538) T(539) T(540) T(541) T(542) T(543) \
T(544) T(545) T(546) T(547) T(548) T(549) T(550) T(551) T(552) T(553) T(554) T(555) T(556) T(557) T(558) T(559) \
T(560) T(561) T(562) T(563) T(564) T(565) T(566) T(567) T(568) T(569) T(570) T(571) T(572) T(573) T(574) T(575) \
T(576) T(577) T(578) T(579) T(580) T(581) T(582) T(583) T(584) T(585) T(586) T(587) T(588) T(589) T(590) T(591) \
T(592) T(593) T(594) T(595) T(596) T(597) T(598) T(599) T(600) T(601) T(602) T(603) T(604) T(605) T(606) T(607) \
T(608) T(609) T(610) T(611) T(612) T(613) T(614) T(615) T(616) T(617) T(618) T(619) T(620) T(621) T(622) T(623) \
T(624) T(625) T(626) T(627) T(628) T(629) T(630) T(631) T(632) T(633) T(634) T(635) T(636) T(637) T(638) T(639) \
T(640) T(641) T(642) T(643) T(644) T(645) T(646) T(647) T(648) T(649) T(650) T(651) T(652) T(653) T(654) T(655) \
T(656) T(657) T(658) T(659) T(660) T(661) T(662) T(663) T(664) T(665) T(666) T(667) T(668) T(669) T(670) T(671) \
T(672) T(673) T(674) T(675) T(676) T(677) T(678) T(679) T(680) T(681) T(682) T(683) T(684) T(685) T(686) T(687) \
T(688) T(689) T(690) T(691) T(692) T(693) T(694) T(695) T(696) T(697) T(698) T(699) T(700) T(701) T(702) T(703) \
T(704) T(705) T(706) T(707) T(708) T(709) T(710) T(711) T(712) T(713) T(714) T(715) T(716) T(717) T(718) T(719) \
T(720) T(721) T(722) T(723) T(724) T(725) T(726) T(727) T(728) T(729) T(730) T(731) T(732) T(733) T(734) T(735) \
T(736) T(737) T(738) T(739) T(740) T(741) T(742) T(743) T(744) T(745) T(746) T(747) T(748) T(749) T(750) T(751) \
T(752) T(753) T(754) T(755) T(756) T(757) T(758) T(759) T(760) T(761) T(762) T(763) T(764) T(765) T(766) T(767) \
T(768) T(769) T(770) T(771) T(772) T(773) T(774) T(775) T(776) T(777) T(778) T(779) T(780) T(781) T(782) T(783) \
T(784) T(785) T(786) T(787) T(788) T(789) T(790) T(791) T(792) T(793) T(794) T(795) T(796) T(797) T(798) T(799) \
T(800) T(801) T(802) T(803) T(804) T(805) T(806) T(807) T(808) T(809) T(810) T(811) T(812) T(813) T(814) T(815) \
T(816) T(817) T(818) T(819) T(820) T(821) T(822) T(823) T(824) T(825) T(826) T(827) T(828) T(829) T(830) T(831) \
T(832) T(833) T(834) T(835) T(836) T(837) T(838) T(839) T(840) T(841) T(842) T(843) T(844) T(845) T(846) T(847) \
T(848) T(849) T(850) T(851) T(852) T(853) T(854) T(855) T(856) T(857) T(858) T(859) T(860) T(861) T(862) T(863) \
T(864) T(865) T(866) T(867) T(868) T(869) T(870) T(871) T(872) T(873) T(874) T(875) T(876) T(877) T(878) T(879) \
T(880) T(881) T(882) T(883) T(884) T(885) T(886) T(887) T(888) T(889) T(890) T(891) T(892) T(893) T(894) T(895) \
T(896) T(897) T(898) T(899) T(900) T(901) T(902) T(903) T(904) T(905) T(906) T(907) T(908) T(909) T(910) T(911) \
T(912) T(913) T(914) T(915) T(916) T(917) T(918) T(919) T(920) T(921) T(922) T(923) T(924) T(925) T(926) T(927) \
T(928) T(929) T(930) T(931) T(932) T(933) T(934) T(935) T(936) T(937) T(938) T(939) T(940) T(941) T(942) T(943) \
T(944) T(945) T(946) T(947) T(948) T(949) T(950) T(951) T(952) T(953) T(954) T(955) T(956) T(957) T(958) T(959) \
T(960) T(961) T(962) T(963) T(964) T(965) T(966) T(967) T(968) T(969) T(970) T(971) T(972) T(973) T(974) T(975) \
T(976) T(977) T(978) T(979) T(980) T(981) T(982) T(983) T(984) T(985) T(986) T(987) T(988) T(989) T(990) T(991) \
T(992) T(993) T(994) T(995) T(996) T(997) T(998) T(999) T(1000) T(1001) T(1002) T(1003) T(1004) T(1005) T(1006) T(1007) \
T(1008) T(1009) T(1010) T(1011) T(1012) T(1013) T(1014) T(1015) T(1016) T(1017) T(1018) T(1019) T(1020) T(1021) T(1022) T(1023)
#ifdef __i386__
__ASM_GLOBAL_FUNC( call_stubless_func,
"movl 4(%esp),%ecx\n\t" /* This pointer */
"movl (%ecx),%ecx\n\t" /* This->lpVtbl */
"movl -8(%ecx),%ecx\n\t" /* MIDL_STUBLESS_PROXY_INFO */
"movl 8(%ecx),%edx\n\t" /* info->FormatStringOffset */
"movzwl (%edx,%eax,2),%edx\n\t" /* FormatStringOffset[index] */
"addl 4(%ecx),%edx\n\t" /* info->ProcFormatString + offset */
"movzbl 1(%edx),%eax\n\t" /* Oi_flags */
"andl $0x08,%eax\n\t" /* Oi_HAS_RPCFLAGS */
"shrl $1,%eax\n\t"
"movzwl 4(%edx,%eax),%eax\n\t" /* arguments size */
"pushl %eax\n\t"
__ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
"pushl $0\n\t" /* fpu_stack */
__ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
"leal 12(%esp),%eax\n\t" /* &This */
"pushl %eax\n\t"
__ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
"pushl %edx\n\t" /* format string */
__ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
"pushl (%ecx)\n\t" /* info->pStubDesc */
__ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
"call " __ASM_STDCALL("NdrpClientCall2",16) "\n\t"
__ASM_CFI(".cfi_adjust_cfa_offset -16\n\t")
"popl %edx\n\t" /* arguments size */
__ASM_CFI(".cfi_adjust_cfa_offset -4\n\t")
"movl (%esp),%ecx\n\t" /* return address */
"addl %edx,%esp\n\t"
"jmp *%ecx" )
#define T(num) \
".balign 4\n\t" \
".globl " __ASM_NAME("ObjectStublessClient" #num) "\n" \
__ASM_NAME("ObjectStublessClient" #num) ":\n\t" \
"movl $"#num",%eax\n\t" \
".byte 0xe9\n\t" /* jmp */ \
".long " __ASM_NAME("call_stubless_func") "-1f\n" \
"1:\n\t"
#elif defined __x86_64__
__ASM_GLOBAL_FUNC( call_stubless_func,
"subq $0x38,%rsp\n\t"
__ASM_SEH(".seh_stackalloc 0x38\n\t")
__ASM_SEH(".seh_endprologue\n\t")
__ASM_CFI(".cfi_adjust_cfa_offset 0x38\n\t")
"movq %rcx,0x40(%rsp)\n\t"
"movq %rdx,0x48(%rsp)\n\t"
"movq %r8,0x50(%rsp)\n\t"
"movq %r9,0x58(%rsp)\n\t"
"leaq 0x40(%rsp),%rdx\n\t" /* args */
"movq %xmm1,0x20(%rsp)\n\t"
"movq %xmm2,0x28(%rsp)\n\t"
"movq %xmm3,0x30(%rsp)\n\t"
"leaq 0x18(%rsp),%r8\n\t" /* fpu_regs */
"movl %r10d,%ecx\n\t" /* index */
"call " __ASM_NAME("ndr_stubless_client_call") "\n\t"
"addq $0x38,%rsp\n\t"
__ASM_CFI(".cfi_adjust_cfa_offset -0x38\n\t")
"ret" )
#define T(num) \
".balign 4\n\t" \
".globl " __ASM_NAME("ObjectStublessClient" #num) "\n" \
__ASM_NAME("ObjectStublessClient" #num) ":\n\t" \
"movl $"#num",%r10d\n\t" \
".byte 0xe9\n\t" /* jmp */ \
".long " __ASM_NAME("call_stubless_func") "-1f\n" \
"1:\n\t"
#elif defined __aarch64__
__ASM_GLOBAL_FUNC( call_stubless_func,
"stp x29, x30, [sp, #-0x90]!\n\t"
".seh_save_fplr_x 0x90\n\t"
"mov x29, sp\n\t"
".seh_set_fp\n\t"
".seh_endprologue\n\t"
"stp d0, d1, [sp, #0x10]\n\t"
"stp d2, d3, [sp, #0x20]\n\t"
"stp d4, d5, [sp, #0x30]\n\t"
"stp d6, d7, [sp, #0x40]\n\t"
"stp x0, x1, [sp, #0x50]\n\t"
"stp x2, x3, [sp, #0x60]\n\t"
"stp x4, x5, [sp, #0x70]\n\t"
"stp x6, x7, [sp, #0x80]\n\t"
"mov w0, w16\n\t" /* index */
"add x1, sp, #0x50\n\t" /* args */
"add x2, sp, #0x10\n\t" /* fpu_regs */
"bl ndr_stubless_client_call\n\t"
"ldp x29, x30, [sp], #0x90\n\t"
"ret" )
#define T(num) \
".globl ObjectStublessClient" #num "\n" \
"ObjectStublessClient" #num ":\n\t" \
"mov w16,#"#num"\n\t" \
"b call_stubless_func\n\t"
#elif defined __arm__
__ASM_GLOBAL_FUNC( call_stubless_func,
"push {r0-r3}\n\t"
".seh_save_regs {r0-r3}\n\t"
"push {fp,lr}\n\t"
".seh_save_regs_w {fp,lr}\n\t"
"mov fp, sp\n\t"
".seh_save_sp fp\n\t"
".seh_endprologue\n\t"
"mov r0, ip\n\t" /* index */
"add r1, sp, #8\n\t" /* args */
"vpush {s0-s15}\n\t" /* store the s0-s15/d0-d7 arguments */
"mov r2, sp\n\t" /* fpu_regs */
"bl ndr_stubless_client_call\n\t"
"mov sp, fp\n\t"
"pop {fp,lr}\n\t"
"add sp, #16\n\t"
"bx lr" )
#define T(num) \
".globl ObjectStublessClient" #num "\n" \
"ObjectStublessClient" #num ":\n\t" \
"ldr ip,1f\n\t" \
"b.w call_stubless_func\n" \
"1:\t.long "#num"\n\t"
#endif /* __i386__ */
__ASM_GLOBAL_FUNC( stubless_thunks, ALL_THUNK_ENTRIES )
#undef T
/* The idea here is to replace the first param on the stack
ie. This (which will point to cstdstubbuffer_delegating_t)
with This->stub_buffer.pvServerObject and then jump to the
relevant offset in This->stub_buffer.pvServerObject's vtbl.
*/
#ifdef __i386__
#define T(num) \
".balign 4\n\t" \
".globl " __ASM_NAME("NdrProxyForwardingFunction" #num) "\n" \
__ASM_NAME("NdrProxyForwardingFunction" #num) ":\n\t" \
"mov 4(%esp),%eax\n\t" \
"mov 0x10(%eax),%eax\n\t" \
"mov %eax,4(%esp)\n\t" \
"mov (%eax),%eax\n\t" \
".byte 0xff,0xa0\n\t" /* jmp *offset(%eax) */ \
".long 4*"#num"\n\t"
#elif defined __x86_64__
#define T(num) \
".balign 4\n\t" \
".globl " __ASM_NAME("NdrProxyForwardingFunction" #num) "\n" \
__ASM_NAME("NdrProxyForwardingFunction" #num) ":\n\t" \
"movq 0x20(%rcx),%rcx\n\t" \
"movq (%rcx),%rax\n\t" \
".byte 0xff,0xa0\n\t" /* jmp *offset(%rax) */ \
".long 8*"#num"\n\t"
#elif defined __aarch64__
#define T(num) \
".globl NdrProxyForwardingFunction" #num "\n" \
"NdrProxyForwardingFunction" #num ":\n\t" \
"ldr x0, [x0, #0x20]\n\t" \
"ldr x16, [x0]\n\t" \
"mov x17, #"#num"\n\t" \
"ldr x16, [x16, x17, lsl #3]\n\t" \
"br x16\n\t"
#elif defined __arm__
#define T(num) \
".balign 4\n\t" \
".globl NdrProxyForwardingFunction" #num "\n" \
"NdrProxyForwardingFunction" #num ":\n\t" \
"ldr r0, [r0, #0x10]\n\t" \
"ldr ip, [r0]\n\t" \
"ldr pc, [ip, #(4*"#num")]\n\t"
#endif /* __i386__ */
__ASM_GLOBAL_FUNC( vtbl_thunks, ALL_THUNK_ENTRIES )
#undef T
static HRESULT WINAPI delegating_QueryInterface(IUnknown *pUnk, REFIID iid, void **ppv)
{
*ppv = pUnk;
return S_OK;
}
static ULONG WINAPI delegating_AddRef(IUnknown *pUnk)
{
return 1;
}
static ULONG WINAPI delegating_Release(IUnknown *pUnk)
{
return 1;
}
#define T(num) extern void NdrProxyForwardingFunction##num(void);
ALL_THUNK_ENTRIES
#undef T
const struct delegating_vtbl delegating_vtbl =
{
{ delegating_QueryInterface, delegating_AddRef, delegating_Release },
{
#define T(num) (void *)NdrProxyForwardingFunction##num,
ALL_THUNK_ENTRIES
#undef T
}
};
#if defined(__aarch64__) || defined(__arm__)
static void __attribute__((used)) args_stack_to_regs( void **args, void **regs, void **stack,
const NDR_PROC_PARTIAL_OIF_HEADER *header )
{
const NDR_PROC_HEADER_EXTS *ext = (const NDR_PROC_HEADER_EXTS *)(header + 1);
unsigned int i, size, count, pos;
unsigned char *data;
#ifdef __arm__
const NDR_PARAM_OIF *params = (const NDR_PARAM_OIF *)((const char *)ext + ext->Size);
for (i = 0; i < header->number_of_params; i++)
if (params[i].attr.IsIn && params[i].attr.IsBasetype)
{
int *arg = (int *)((char *)args + params[i].stack_offset);
switch (params[i].u.type_format_char)
{
case FC_BYTE:
case FC_USMALL:
*arg = (unsigned char)*arg;
break;
case FC_CHAR:
case FC_SMALL:
*arg = (signed char)*arg;
break;
case FC_WCHAR:
case FC_USHORT:
*arg = (unsigned short)*arg;
break;
case FC_SHORT:
*arg = (short)*arg;
break;
}
}
#endif
if (ext->Size < sizeof(*ext) + 3) return;
data = (unsigned char *)(ext + 1);
size = min( ext->Size - sizeof(*ext) - 3, data[2] );
data += 3;
for (i = pos = 0; i < size; i++, pos++)
{
if (data[i] < 0x80) continue;
else if (data[i] < 0x94) regs[data[i] - 0x80] = args[pos];
else if (data[i] == 0x9d) /* repeat */
{
if (i + 3 >= size) break;
count = data[i + 2] + (data[i + 3] << 8);
memcpy( &stack[pos + (signed char)data[i + 1]], &args[pos], count * sizeof(*args) );
pos += count - 1;
i += 3;
}
else if (data[i] < 0xa0) continue;
else stack[pos + (signed char)data[i]] = args[pos];
}
}
#endif
/* Call a function with the specified arguments, restoring the stack
* properly afterwards as we don't know the calling convention of the
* function */
#if defined __i386__ && defined _MSC_VER && defined __REACTOS__ // Wine has removed this :(
__declspec(naked) LONG_PTR __cdecl call_server_func(SERVER_ROUTINE func, unsigned char * args, unsigned int stack_size,
const NDR_PROC_PARTIAL_OIF_HEADER *header )
{
__asm
{
push ebp
mov ebp, esp
push edi ; Save registers
push esi
mov eax, [ebp+16] ; Get stack size
sub esp, eax ; Make room in stack for arguments
and esp, 0xFFFFFFF0
mov edi, esp
mov ecx, eax
mov esi, [ebp+12]
shr ecx, 2
cld
rep movsd ; Copy dword blocks
call [ebp+8] ; Call function
lea esp, [ebp-8] ; Restore stack
pop esi ; Restore registers
pop edi
pop ebp
ret
}
}
#elif defined __i386__ // remove above, replace here with #ifdef __i386__
__ASM_GLOBAL_FUNC( call_server_func,
"pushl %ebp\n\t"
__ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
__ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
"movl %esp,%ebp\n\t"
__ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
"pushl %edi\n\t" /* Save registers */
__ASM_CFI(".cfi_rel_offset %edi,-4\n\t")
"pushl %esi\n\t"
__ASM_CFI(".cfi_rel_offset %esi,-8\n\t")
"movl 16(%ebp), %eax\n\t" /* Get stack size */
"subl %eax, %esp\n\t" /* Make room in stack for arguments */
"andl $~15, %esp\n\t" /* Make sure stack has 16-byte alignment for Mac OS X */
"movl %esp, %edi\n\t"
"movl %eax, %ecx\n\t"
"movl 12(%ebp), %esi\n\t"
"shrl $2, %ecx\n\t" /* divide by 4 */
"cld\n\t"
"rep; movsl\n\t" /* Copy dword blocks */
"call *8(%ebp)\n\t" /* Call function */
"leal -8(%ebp), %esp\n\t" /* Restore stack */
"popl %esi\n\t" /* Restore registers */
__ASM_CFI(".cfi_same_value %esi\n\t")
"popl %edi\n\t"
__ASM_CFI(".cfi_same_value %edi\n\t")
"popl %ebp\n\t"
__ASM_CFI(".cfi_def_cfa %esp,4\n\t")
__ASM_CFI(".cfi_same_value %ebp\n\t")
"ret" )
#elif defined __x86_64__
__ASM_GLOBAL_FUNC( call_server_func,
"pushq %rbp\n\t"
__ASM_SEH(".seh_pushreg %rbp\n\t")
__ASM_CFI(".cfi_adjust_cfa_offset 8\n\t")
__ASM_CFI(".cfi_rel_offset %rbp,0\n\t")
"movq %rsp,%rbp\n\t"
__ASM_SEH(".seh_setframe %rbp,0\n\t")
__ASM_CFI(".cfi_def_cfa_register %rbp\n\t")
"pushq %rsi\n\t"
__ASM_SEH(".seh_pushreg %rsi\n\t")
__ASM_CFI(".cfi_rel_offset %rsi,-8\n\t")
"pushq %rdi\n\t"
__ASM_SEH(".seh_pushreg %rdi\n\t")
__ASM_SEH(".seh_endprologue\n\t")
__ASM_CFI(".cfi_rel_offset %rdi,-16\n\t")
"movq %rcx,%rax\n\t" /* function to call */
"movq $32,%rcx\n\t" /* allocate max(32,stack_size) bytes of stack space */
"cmpq %rcx,%r8\n\t"
"cmovgq %r8,%rcx\n\t"
"subq %rcx,%rsp\n\t"
"andq $~15,%rsp\n\t"
"movq %r8,%rcx\n\t"
"shrq $3,%rcx\n\t"
"movq %rsp,%rdi\n\t"
"movq %rdx,%rsi\n\t"
"rep; movsq\n\t" /* copy arguments */
"movq 0(%rsp),%rcx\n\t"
"movq 8(%rsp),%rdx\n\t"
"movq 16(%rsp),%r8\n\t"
"movq 24(%rsp),%r9\n\t"
"movq 0(%rsp),%xmm0\n\t"
"movq 8(%rsp),%xmm1\n\t"
"movq 16(%rsp),%xmm2\n\t"
"movq 24(%rsp),%xmm3\n\t"
"callq *%rax\n\t"
"leaq -16(%rbp),%rsp\n\t" /* restore stack */
"popq %rdi\n\t"
__ASM_CFI(".cfi_same_value %rdi\n\t")
"popq %rsi\n\t"
__ASM_CFI(".cfi_same_value %rsi\n\t")
__ASM_CFI(".cfi_def_cfa_register %rsp\n\t")
"popq %rbp\n\t"
__ASM_CFI(".cfi_adjust_cfa_offset -8\n\t")
__ASM_CFI(".cfi_same_value %rbp\n\t")
"ret" )
#elif defined __arm__
__ASM_GLOBAL_FUNC( call_server_func,
"push {r4,r5,fp,lr}\n\t"
".seh_save_regs_w {r4,r5,fp,lr}\n\t"
"mov fp, sp\n\t"
".seh_save_sp fp\n\t"
".seh_endprologue\n\t"
"add r2, r2, #20*4+8+4\n\t"
"and r2, r2, #~7\n\t"
"sub sp, sp, r2\n\t"
"mov r4, r0\n\t" /* func */
"mov r0, r1\n\t" /* args */
"add r1, sp, #8\n\t" /* regs */
"add r2, r1, #20*4\n\t" /* stack */
"bl args_stack_to_regs\n\t"
"add sp, sp, #8\n\t"
"pop {r0-r3}\n\t"
"vpop {s0-s15}\n\t"
"blx r4\n\t"
"mov sp, fp\n\t"
"pop {r4,r5,fp,pc}" )
#elif defined __aarch64__
__ASM_GLOBAL_FUNC( call_server_func,
"stp x29, x30, [sp, #-0x20]!\n\t"
".seh_save_fplr_x 0x20\n\t"
"stp x19, x20, [sp, #0x10]\n\t"
".seh_save_regp x19, 0x10\n\t"
"mov x29, sp\n\t"
".seh_set_fp\n\t"
".seh_endprologue\n\t"
"add x9, x2, #16*8+15\n\t"
"lsr x9, x9, #4\n\t"
"sub sp, sp, x9, lsl #4\n\t"
"mov x19, x0\n\t" /* func */
"mov x0, x1\n\t" /* args */
"mov x1, sp\n\t" /* regs */
"add x2, sp, #16*8\n\t" /* stack */
"bl args_stack_to_regs\n\t"
"ldp x2, x3, [sp, #0x10]\n\t"
"ldp x4, x5, [sp, #0x20]\n\t"
"ldp x6, x7, [sp, #0x30]\n\t"
"ldp d0, d1, [sp, #0x40]\n\t"
"ldp d2, d3, [sp, #0x50]\n\t"
"ldp d4, d5, [sp, #0x60]\n\t"
"ldp d6, d7, [sp, #0x70]\n\t"
"ldp x0, x1, [sp], #0x80\n\t"
"blr x19\n\t"
"mov sp, x29\n\t"
"ldp x19, x20, [sp, #0x10]\n\t"
"ldp x29, x30, [sp], #0x20\n\t"
"ret" )
#endif
+3
View File
@@ -21,6 +21,9 @@ sdk/tools/unicode # Synced to WineStaging-4.18
sdk/tools/widl # Synced to Wine-10.0
sdk/tools/wpp # Synced to Wine-10.0 (Module was moved into wrc tool)
The following headers are shared with Wine.
sdk/include/psdk/rpcproxy.h # Synced to Wine-10.0
The following libraries are shared with Wine.
dll/directx/wine/amstream # Synced to WineStaging-3.9
@@ -2,9 +2,12 @@
remove_definitions(-DWINVER=0x502 -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x502)
add_definitions(
-DCONST_VTABLE
-DUSE_WINE_TODOS
-DWINETEST_USE_DBGSTR_LONGLONG
-DPROXY_DELEGATION)
-DPROXY_DELEGATION
-Dstrdup=_strdup
)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(OLD_IDL_FLAGS ${IDL_FLAGS})
@@ -12,6 +15,10 @@ set(IDL_FLAGS ${IDL_FLAGS} --prefix-server=s_ -Os --prefix-client=mixed_)
add_rpc_files(client server.idl)
add_rpc_files(server server.idl)
set(IDL_FLAGS ${OLD_IDL_FLAGS})
set(IDL_FLAGS ${IDL_FLAGS} --prefix-server=s_ -Os --prefix-client=)
add_rpc_files(client explicit_handle.idl)
add_rpc_files(server explicit_handle.idl)
set(IDL_FLAGS ${OLD_IDL_FLAGS})
set(IDL_FLAGS ${IDL_FLAGS} --prefix-server=s_ -Oicf --prefix-client=interp_)
add_rpc_files(client server_interp.idl)
add_rpc_files(server server_interp.idl)
@@ -27,6 +34,8 @@ list(APPEND SOURCE
server.c
testlist.c
${CMAKE_CURRENT_BINARY_DIR}/cstub_p.c
${CMAKE_CURRENT_BINARY_DIR}/explicit_handle_c.c
${CMAKE_CURRENT_BINARY_DIR}/explicit_handle_s.c
${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c
${CMAKE_CURRENT_BINARY_DIR}/server_c.c
${CMAKE_CURRENT_BINARY_DIR}/server_s.c
+194 -63
View File
@@ -22,9 +22,6 @@
#include <stdio.h>
#define COBJMACROS
#ifdef __REACTOS__
#define CONST_VTABLE
#endif
#include <windef.h>
#include <winbase.h>
@@ -37,7 +34,6 @@
#include "rpcdce.h"
#include "rpcproxy.h"
#include "wine/heap.h"
#include "wine/test.h"
#include "cstub_p.h"
@@ -66,13 +62,13 @@ static int my_free_called;
static void * CALLBACK my_alloc(SIZE_T size)
{
my_alloc_called++;
return NdrOleAllocate(size);
return malloc(size);
}
static void CALLBACK my_free(void *ptr)
{
my_free_called++;
NdrOleFree(ptr);
free(ptr);
}
typedef struct _MIDL_PROC_FORMAT_STRING
@@ -502,13 +498,13 @@ static IPSFactoryBuffer *test_NdrDllGetClassObject(void)
r = NdrDllGetClassObject(&CLSID_Unknown, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
&CLSID_psfact, &PSFactoryBuffer);
ok(r == CLASS_E_CLASSNOTAVAILABLE, "NdrDllGetClassObject with unknown clsid should have returned CLASS_E_CLASSNOTAVAILABLE instead of 0x%x\n", r);
ok(r == CLASS_E_CLASSNOTAVAILABLE, "NdrDllGetClassObject with unknown clsid should have returned CLASS_E_CLASSNOTAVAILABLE instead of 0x%lx\n", r);
ok(ppsf == NULL, "NdrDllGetClassObject should have set ppsf to NULL on failure\n");
r = NdrDllGetClassObject(&CLSID_psfact, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
&CLSID_psfact, &PSFactoryBuffer);
ok(r == S_OK, "ret %08x\n", r);
ok(r == S_OK, "ret %08lx\n", r);
ok(ppsf != NULL, "ppsf == NULL\n");
proxy_vtbl = PSFactoryBuffer.pProxyFileList[0]->pProxyVtblList;
@@ -625,31 +621,31 @@ static IPSFactoryBuffer *test_NdrDllGetClassObject(void)
ok( proxy_vtbl[i]->header.piid == interfaces[i],
"wrong proxy %u iid %p/%p\n", i, proxy_vtbl[i]->header.piid, interfaces[i] );
ok(PSFactoryBuffer.RefCount == 1, "ref count %d\n", PSFactoryBuffer.RefCount);
ok(PSFactoryBuffer.RefCount == 1, "ref count %ld\n", PSFactoryBuffer.RefCount);
IPSFactoryBuffer_Release(ppsf);
/* One can also search by IID */
r = NdrDllGetClassObject(&IID_if3, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
&CLSID_psfact, &PSFactoryBuffer);
ok(r == S_OK, "ret %08x\n", r);
ok(r == S_OK, "ret %08lx\n", r);
ok(ppsf != NULL, "ppsf == NULL\n");
IPSFactoryBuffer_Release(ppsf);
r = NdrDllGetClassObject(&IID_if3, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
NULL, &PSFactoryBuffer);
ok(r == S_OK, "ret %08x\n", r);
ok(r == S_OK, "ret %08lx\n", r);
ok(ppsf != NULL, "ppsf == NULL\n");
IPSFactoryBuffer_Release(ppsf);
/* but only if the PS factory implements it */
r = NdrDllGetClassObject(&IID_IDispatch, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
&CLSID_psfact, &PSFactoryBuffer);
ok(r == CLASS_E_CLASSNOTAVAILABLE, "ret %08x\n", r);
ok(r == CLASS_E_CLASSNOTAVAILABLE, "ret %08lx\n", r);
/* Create it again to return */
r = NdrDllGetClassObject(&CLSID_psfact, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
&CLSID_psfact, &PSFactoryBuffer);
ok(r == S_OK, "ret %08x\n", r);
ok(r == S_OK, "ret %08lx\n", r);
ok(ppsf != NULL, "ppsf == NULL\n");
/* Because this PS factory is not loaded as a dll in the normal way, Windows 8 / 10
@@ -657,13 +653,13 @@ static IPSFactoryBuffer *test_NdrDllGetClassObject(void)
Registering the ifaces fixes this (in fact calling CoRegisterPSClsid() with any IID / CLSID is enough). */
r = CoRegisterPSClsid(&IID_if1, &CLSID_psfact);
ok(r == S_OK, "ret %08x\n", r);
ok(r == S_OK, "ret %08lx\n", r);
r = CoRegisterPSClsid(&IID_if2, &CLSID_psfact);
ok(r == S_OK, "ret %08x\n", r);
ok(r == S_OK, "ret %08lx\n", r);
r = CoRegisterPSClsid(&IID_if3, &CLSID_psfact);
ok(r == S_OK, "ret %08x\n", r);
ok(r == S_OK, "ret %08lx\n", r);
r = CoRegisterPSClsid(&IID_if4, &CLSID_psfact);
ok(r == S_OK, "ret %08x\n", r);
ok(r == S_OK, "ret %08lx\n", r);
return ppsf;
}
@@ -715,7 +711,7 @@ static IRpcStubBuffer *create_stub(IPSFactoryBuffer *ppsf, REFIID iid, IUnknown
HRESULT r;
r = IPSFactoryBuffer_CreateStub(ppsf, iid, obj, &pstub);
ok(r == expected_result, "CreateStub returned %08x expected %08x\n", r, expected_result);
ok(r == expected_result, "CreateStub returned %08lx expected %08lx\n", r, expected_result);
return pstub;
}
@@ -792,25 +788,25 @@ static void create_proxy_test( IPSFactoryBuffer *ppsf, REFIID iid, const void *e
ULONG count;
r = IPSFactoryBuffer_CreateProxy(ppsf, NULL, iid, &proxy, (void **)&iface);
ok( r == S_OK, "IPSFactoryBuffer_CreateProxy failed %x\n", r );
ok( r == S_OK, "IPSFactoryBuffer_CreateProxy failed %lx\n", r );
ok( *(void **)iface == expected_vtbl, "wrong iface pointer %p/%p\n", *(void **)iface, expected_vtbl );
count = IUnknown_Release( iface );
ok( count == 1, "wrong refcount %u\n", count );
ok( count == 1, "wrong refcount %lu\n", count );
count = IRpcProxyBuffer_Release( proxy );
ok( count == 0, "wrong refcount %u\n", count );
ok( count == 0, "wrong refcount %lu\n", count );
dummy_unknown.ref = 4;
r = IPSFactoryBuffer_CreateProxy(ppsf, &dummy_unknown.IUnknown_iface, iid, &proxy,
(void **)&iface);
ok( r == S_OK, "IPSFactoryBuffer_CreateProxy failed %x\n", r );
ok( dummy_unknown.ref == 5, "wrong refcount %u\n", dummy_unknown.ref );
ok( r == S_OK, "IPSFactoryBuffer_CreateProxy failed %lx\n", r );
ok( dummy_unknown.ref == 5, "wrong refcount %lu\n", dummy_unknown.ref );
ok( *(void **)iface == expected_vtbl, "wrong iface pointer %p/%p\n", *(void **)iface, expected_vtbl );
count = IUnknown_Release( iface );
ok( count == 4, "wrong refcount %u\n", count );
ok( dummy_unknown.ref == 4, "wrong refcount %u\n", dummy_unknown.ref );
ok( count == 4, "wrong refcount %lu\n", count );
ok( dummy_unknown.ref == 4, "wrong refcount %lu\n", dummy_unknown.ref );
count = IRpcProxyBuffer_Release( proxy );
ok( count == 0, "wrong refcount %u\n", count );
ok( dummy_unknown.ref == 4, "wrong refcount %u\n", dummy_unknown.ref );
ok( count == 0, "wrong refcount %lu\n", count );
ok( dummy_unknown.ref == 4, "wrong refcount %lu\n", dummy_unknown.ref );
}
static void test_CreateProxy( IPSFactoryBuffer *ppsf )
@@ -830,7 +826,7 @@ static void test_CreateStub(IPSFactoryBuffer *ppsf)
const CInterfaceStubHeader *header = &CONTAINING_RECORD(cstd_stub->lpVtbl, const CInterfaceStubVtbl, Vtbl)->header;
ok(IsEqualIID(header->piid, &IID_if1), "header iid differs\n");
ok(cstd_stub->RefCount == 1, "ref count %d\n", cstd_stub->RefCount);
ok(cstd_stub->RefCount == 1, "ref count %ld\n", cstd_stub->RefCount);
/* 0xdeadbeef returned from create_stub_test_QI */
ok(cstd_stub->pvServerObject == (void*)0xdeadbeef, "pvServerObject %p\n", cstd_stub->pvServerObject);
ok(cstd_stub->pPSFactory != NULL, "pPSFactory was NULL\n");
@@ -839,7 +835,7 @@ static void test_CreateStub(IPSFactoryBuffer *ppsf)
vtbl = &create_stub_test_fail_vtbl;
pstub = create_stub(ppsf, &IID_if1, obj, E_NOINTERFACE);
ok(pstub == NULL, "create_stub failed: %u\n", GetLastError());
ok(pstub == NULL, "create_stub failed: %lu\n", GetLastError());
}
@@ -929,14 +925,14 @@ static void test_Connect(IPSFactoryBuffer *ppsf)
obj = (IUnknown*)&new_vtbl;
r = IRpcStubBuffer_Connect(pstub, obj);
ok(r == S_OK, "r %08x\n", r);
ok(r == S_OK, "r %08lx\n", r);
ok(connect_test_orig_release_called == 1, "release called %d\n", connect_test_orig_release_called);
ok(cstd_stub->pvServerObject == (void*)0xcafebabe, "pvServerObject %p\n", cstd_stub->pvServerObject);
cstd_stub->pvServerObject = (IUnknown*)&orig_vtbl;
obj = (IUnknown*)&new_fail_vtbl;
r = IRpcStubBuffer_Connect(pstub, obj);
ok(r == E_NOINTERFACE, "r %08x\n", r);
ok(r == E_NOINTERFACE, "r %08lx\n", r);
ok(cstd_stub->pvServerObject == (void*)0xdeadbeef, "pvServerObject %p\n", cstd_stub->pvServerObject);
ok(connect_test_orig_release_called == 2, "release called %d\n", connect_test_orig_release_called);
@@ -957,7 +953,7 @@ static void test_Connect(IPSFactoryBuffer *ppsf)
obj = (IUnknown*)&new_vtbl;
r = IRpcStubBuffer_Connect(pstub, obj);
ok(r == S_OK, "r %08x\n", r);
ok(r == S_OK, "r %08lx\n", r);
ok(connect_test_base_Connect_called == 1, "connect_test_bsae_Connect called %d times\n",
connect_test_base_Connect_called);
ok(connect_test_orig_release_called == 3, "release called %d\n", connect_test_orig_release_called);
@@ -1007,21 +1003,21 @@ static void test_Release(IPSFactoryBuffer *ppsf)
facbuf_refs = PSFactoryBuffer.RefCount;
/* This shows that NdrCStdStubBuffer_Release doesn't call Disconnect */
ok(cstd_stub->RefCount == 1, "ref count %d\n", cstd_stub->RefCount);
ok(cstd_stub->RefCount == 1, "ref count %ld\n", cstd_stub->RefCount);
connect_test_orig_release_called = 0;
IRpcStubBuffer_Release(pstub);
todo_wine {
ok(connect_test_orig_release_called == 0, "release called %d\n", connect_test_orig_release_called);
}
ok(PSFactoryBuffer.RefCount == facbuf_refs - 1, "factory buffer refs %d orig %d\n", PSFactoryBuffer.RefCount, facbuf_refs);
ok(PSFactoryBuffer.RefCount == facbuf_refs - 1, "factory buffer refs %ld orig %ld\n", PSFactoryBuffer.RefCount, facbuf_refs);
/* This shows that NdrCStdStubBuffer_Release calls Release on its 2nd arg, rather than on This->pPSFactory
(which are usually the same and indeed it's odd that _Release requires this 2nd arg). */
pstub = create_stub(ppsf, &IID_if1, obj, S_OK);
ok(PSFactoryBuffer.RefCount == facbuf_refs, "factory buffer refs %d orig %d\n", PSFactoryBuffer.RefCount, facbuf_refs);
ok(PSFactoryBuffer.RefCount == facbuf_refs, "factory buffer refs %ld orig %ld\n", PSFactoryBuffer.RefCount, facbuf_refs);
NdrCStdStubBuffer_Release(pstub, (IPSFactoryBuffer*)pretend_psfacbuf);
ok(release_test_psfacbuf_release_called == 1, "pretend_psfacbuf_release called %d\n", release_test_psfacbuf_release_called);
ok(PSFactoryBuffer.RefCount == facbuf_refs, "factory buffer refs %d orig %d\n", PSFactoryBuffer.RefCount, facbuf_refs);
ok(PSFactoryBuffer.RefCount == facbuf_refs, "factory buffer refs %ld orig %ld\n", PSFactoryBuffer.RefCount, facbuf_refs);
}
static HRESULT WINAPI delegating_invoke_test_QI(ITypeLib *pUnk, REFIID iid, void** ppv)
@@ -1085,7 +1081,7 @@ static HRESULT WINAPI delegating_invoke_chan_get_buffer(IRpcChannelBuffer *pchan
RPCOLEMESSAGE *msg,
REFIID iid)
{
msg->Buffer = HeapAlloc(GetProcessHeap(), 0, msg->cbBuffer);
msg->Buffer = malloc(msg->cbBuffer);
return S_OK;
}
@@ -1145,14 +1141,14 @@ static void test_delegating_Invoke(IPSFactoryBuffer *ppsf)
msg.dataRepresentation = NDR_LOCAL_DATA_REPRESENTATION;
msg.iMethod = 3;
r = IRpcStubBuffer_Invoke(pstub, &msg, pchan);
ok(r == S_OK, "ret %08x\n", r);
ok(r == S_OK, "ret %08lx\n", r);
if(r == S_OK)
{
ok(*(DWORD*)msg.Buffer == 0xabcdef, "buf[0] %08x\n", *(DWORD*)msg.Buffer);
ok(*((DWORD*)msg.Buffer + 1) == S_OK, "buf[1] %08x\n", *((DWORD*)msg.Buffer + 1));
ok(*(DWORD*)msg.Buffer == 0xabcdef, "buf[0] %08lx\n", *(DWORD*)msg.Buffer);
ok(*((DWORD*)msg.Buffer + 1) == S_OK, "buf[1] %08lx\n", *((DWORD*)msg.Buffer + 1));
}
/* free the buffer allocated by delegating_invoke_chan_get_buffer */
HeapFree(GetProcessHeap(), 0, msg.Buffer);
free(msg.Buffer);
IRpcStubBuffer_Release(pstub);
}
static const CInterfaceProxyVtbl *cstub_ProxyVtblList2[] =
@@ -1203,19 +1199,19 @@ static void test_NdrDllRegisterProxy( void )
res = NdrDllRegisterProxy(NULL, NULL, NULL);
ok(res == E_HANDLE, "Incorrect return code %x\n",res);
ok(res == E_HANDLE, "Incorrect return code %lx\n",res);
pf = NULL;
res = NdrDllRegisterProxy(hmod, &pf, NULL);
ok(res == E_NOINTERFACE, "Incorrect return code %x\n",res);
ok(res == E_NOINTERFACE, "Incorrect return code %lx\n",res);
res = NdrDllRegisterProxy(hmod, proxy_file_list2, NULL);
ok(res == E_NOINTERFACE, "Incorrect return code %x\n",res);
ok(res == E_NOINTERFACE, "Incorrect return code %lx\n",res);
/* This fails on Vista and Windows 7 due to permissions */
res = NdrDllRegisterProxy(hmod, proxy_file_list, NULL);
ok(res == S_OK || res == E_ACCESSDENIED, "NdrDllRegisterProxy failed %x\n",res);
ok(res == S_OK || res == E_ACCESSDENIED, "NdrDllRegisterProxy failed %lx\n",res);
if (res == S_OK)
{
res = NdrDllUnregisterProxy(hmod,proxy_file_list, NULL);
ok(res == S_OK, "NdrDllUnregisterProxy failed %x\n",res);
ok(res == S_OK, "NdrDllUnregisterProxy failed %lx\n",res);
}
}
@@ -1231,7 +1227,7 @@ static HANDLE create_process(const char *arg)
winetest_get_mainargs(&argv);
sprintf(cmdline, "\"%s\" %s %s", argv[0], argv[1], arg);
ret = CreateProcessA(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
ok(ret, "CreateProcess failed: %u\n", GetLastError());
ok(ret, "CreateProcess failed: %lu\n", GetLastError());
CloseHandle(pi.hThread);
return pi.hProcess;
}
@@ -1303,7 +1299,7 @@ static ULONG WINAPI test_cf_Release(IClassFactory *iface)
static HRESULT WINAPI test_cf_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID iid, void **out)
{
ITest1 *obj = heap_alloc(sizeof(*obj));
ITest1 *obj = malloc(sizeof(*obj));
obj->lpVtbl = &test1_vtbl;
@@ -1343,30 +1339,30 @@ static void local_server_proc(void)
hr = CoRegisterClassObject(&CLSID_test1, (IUnknown *)&test_cf,
CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &obj_cookie);
ok(hr == S_OK, "got %#x\n", hr);
ok(hr == S_OK, "got %#lx\n", hr);
hr = NdrDllGetClassObject(&CLSID_test_ps, &IID_IPSFactoryBuffer, (void **)&ps,
&aProxyFileList, &CLSID_test_ps, &gPFactory);
ok(hr == S_OK, "got %#x\n", hr);
ok(hr == S_OK, "got %#lx\n", hr);
hr = CoRegisterClassObject(&CLSID_test_ps, (IUnknown *)ps,
CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &ps_cookie);
ok(hr == S_OK, "got %#x\n", hr);
ok(hr == S_OK, "got %#lx\n", hr);
hr = CoRegisterPSClsid(&IID_ITest1, &CLSID_test_ps);
ok(hr == S_OK, "got %#x\n", hr);
ok(hr == S_OK, "got %#lx\n", hr);
SetEvent(ready_event);
hr = CoWaitForMultipleHandles(0, 1000, 1, &stop_event, &index);
ok(hr == S_OK, "got %#x\n", hr);
ok(!index, "got %u\n", index);
ok(hr == S_OK, "got %#lx\n", hr);
ok(!index, "got %lu\n", index);
hr = CoRevokeClassObject(ps_cookie);
ok(hr == S_OK, "got %#x\n", hr);
ok(hr == S_OK, "got %#lx\n", hr);
hr = CoRevokeClassObject(obj_cookie);
ok(hr == S_OK, "got %#x\n", hr);
ok(hr == S_OK, "got %#lx\n", hr);
CoUninitialize();
ExitProcess(0);
@@ -1386,27 +1382,27 @@ static void test_delegated_methods(void)
ready_event = CreateEventA(NULL, TRUE, FALSE, "wine_cstub_test_server_ready");
process = create_process("server");
ok(!WaitForSingleObject(ready_event, 1000), "wait failed\n");
ok(!WaitForSingleObject(ready_event, 5000), "wait failed\n");
hr = NdrDllGetClassObject(&CLSID_test_ps, &IID_IPSFactoryBuffer, (void **)&ps,
&aProxyFileList, &CLSID_test_ps, &gPFactory);
ok(hr == S_OK, "got %#x\n", hr);
ok(hr == S_OK, "got %#lx\n", hr);
hr = CoRegisterClassObject(&CLSID_test_ps, (IUnknown *)ps,
CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &ps_cookie);
ok(hr == S_OK, "got %#x\n", hr);
ok(hr == S_OK, "got %#lx\n", hr);
hr = CoRegisterPSClsid(&IID_ITest1, &CLSID_test_ps);
ok(hr == S_OK, "got %#x\n", hr);
ok(hr == S_OK, "got %#lx\n", hr);
hr = CoCreateInstance(&CLSID_test1, NULL, CLSCTX_LOCAL_SERVER, &IID_ITest1, (void **)&test_obj);
ok(hr == S_OK, "got %#x\n", hr);
ok(hr == S_OK, "got %#lx\n", hr);
ret = ITest1_square(test_obj, 3);
ok(ret == 9, "got %d\n", ret);
hr = ITest1_GetClassID(test_obj, &clsid);
ok(hr == S_OK, "got %#x\n", hr);
ok(hr == S_OK, "got %#lx\n", hr);
ok(IsEqualGUID(&clsid, &CLSID_test1), "got %s\n", wine_dbgstr_guid(&clsid));
ITest1_Release(test_obj);
@@ -1415,7 +1411,141 @@ static void test_delegated_methods(void)
ok(!WaitForSingleObject(process, 1000), "wait failed\n");
hr = CoRevokeClassObject(ps_cookie);
ok(hr == S_OK, "got %#x\n", hr);
ok(hr == S_OK, "got %#lx\n", hr);
}
typedef struct tagChannelBufferRefCount
{
IRpcChannelBuffer IRpcChannelBuffer_iface;
LONG RefCount;
} CChannelBufferRefCount;
static CChannelBufferRefCount* impl_from_IRpcChannelBuffer(IRpcChannelBuffer* iface)
{
return CONTAINING_RECORD(iface, CChannelBufferRefCount, IRpcChannelBuffer_iface);
}
static HRESULT WINAPI test_chanbuf_refcount_chan_query_interface(IRpcChannelBuffer* pchan,
REFIID iid,
void** ppv)
{
if (IsEqualGUID(&IID_IRpcChannelBuffer, iid))
{
*ppv = pchan;
IRpcChannelBuffer_AddRef(pchan);
return S_OK;
}
return E_NOINTERFACE;
}
static ULONG WINAPI test_chanbuf_refcount_chan_add_ref(IRpcChannelBuffer* pchan)
{
CChannelBufferRefCount* This = impl_from_IRpcChannelBuffer(pchan);
return InterlockedIncrement(&This->RefCount);
}
static ULONG WINAPI test_chanbuf_refcount_chan_release(IRpcChannelBuffer* pchan)
{
CChannelBufferRefCount* This = impl_from_IRpcChannelBuffer(pchan);
return InterlockedDecrement(&This->RefCount);
}
static HRESULT WINAPI test_chanbuf_refcount_chan_get_buffer(IRpcChannelBuffer* pchan,
RPCOLEMESSAGE* msg,
REFIID iid)
{
ok(0, "call to GetBuffer not expected\n");
return E_NOTIMPL;
}
static HRESULT WINAPI test_chanbuf_refcount_chan_send_receive(IRpcChannelBuffer* pchan,
RPCOLEMESSAGE* pMessage,
ULONG* pStatus)
{
ok(0, "call to SendReceive not expected\n");
return E_NOTIMPL;
}
static HRESULT WINAPI test_chanbuf_refcount_chan_free_buffer(IRpcChannelBuffer* pchan,
RPCOLEMESSAGE* pMessage)
{
ok(0, "call to FreeBuffer not expected\n");
return E_NOTIMPL;
}
static HRESULT WINAPI test_chanbuf_refcount_chan_get_dest_ctx(IRpcChannelBuffer* pchan,
DWORD* pdwDestContext,
void** ppvDestContext)
{
*pdwDestContext = MSHCTX_LOCAL;
*ppvDestContext = NULL;
return S_OK;
}
static HRESULT WINAPI test_chanbuf_refcount_chan_is_connected(IRpcChannelBuffer* pchan)
{
ok(0, "call to IsConnected not expected\n");
return E_NOTIMPL;
}
static IRpcChannelBufferVtbl test_chanbuf_refcount_test_rpc_chan_vtbl =
{
test_chanbuf_refcount_chan_query_interface,
test_chanbuf_refcount_chan_add_ref,
test_chanbuf_refcount_chan_release,
test_chanbuf_refcount_chan_get_buffer,
test_chanbuf_refcount_chan_send_receive,
test_chanbuf_refcount_chan_free_buffer,
test_chanbuf_refcount_chan_get_dest_ctx,
test_chanbuf_refcount_chan_is_connected
};
static void test_ChannelBufferRefCount(IPSFactoryBuffer *ppsf)
{
IRpcProxyBuffer* proxy_buffer = NULL;
IUnknown* proxy_if1 = NULL;
CChannelBufferRefCount test_chanbuf = {{&test_chanbuf_refcount_test_rpc_chan_vtbl}, 1};
RPC_MESSAGE rpcMessage = {0};
MIDL_STUB_MESSAGE stubMessage = {0};
MIDL_STUB_DESC stubDesc = {0};
ULONG refs;
HRESULT hr = IPSFactoryBuffer_CreateProxy(ppsf, NULL, &IID_if1, &proxy_buffer, (void**)&proxy_if1);
ok(hr == S_OK, "got %#lx\n", hr);
ok(test_chanbuf.RefCount == 1, "got %ld\n", test_chanbuf.RefCount);
hr = IRpcProxyBuffer_Connect(proxy_buffer, &test_chanbuf.IRpcChannelBuffer_iface);
ok(hr == S_OK, "got %#lx\n", hr);
/* proxy_buffer should have acquired its own refcount on test_chanbuf */
ok(test_chanbuf.RefCount == 2, "got %ld\n", test_chanbuf.RefCount);
/* which therefore survives releasing the initial one */
refs = IRpcChannelBuffer_Release(&test_chanbuf.IRpcChannelBuffer_iface);
ok(refs == 1, "got %ld\n", refs);
NdrProxyInitialize(proxy_if1, &rpcMessage, &stubMessage, &stubDesc, 0);
/* stubMessage should add its own refcount on test_chanbuf */
ok(test_chanbuf.RefCount == 2, "got %ld\n", test_chanbuf.RefCount);
ok(stubMessage.pRpcChannelBuffer != NULL, "NULL pRocChannelBuffer\n");
/* stubMessage doesn't add its own refcounts on proxy_if1 or proxy_buffer,
* so it's possible these are freed out from under it.
* E.g. an event sink might unadvise upon receiving the event it was waiting for;
* this unadvise could be reentrant to Invoke because SendReceive pumps STA messages.
* The source would then erase that connection point entry and Release the proxy. */
IRpcProxyBuffer_Disconnect(proxy_buffer);
ok(test_chanbuf.RefCount == 1, "got %ld\n", test_chanbuf.RefCount);
IRpcProxyBuffer_Release(proxy_buffer);
refs = IUnknown_Release(proxy_if1);
ok(refs == 0, "got %ld\n", refs);
ok(test_chanbuf.RefCount == 1, "got %ld\n", test_chanbuf.RefCount);
/* NdrProxyFreeBuffer must not dereference the now-freed proxy_if1,
* yet should still free the remaining reference on test_chanbuf */
NdrProxyFreeBuffer(proxy_if1, &stubMessage);
ok(test_chanbuf.RefCount == 0, "got %ld\n", test_chanbuf.RefCount);
ok(!stubMessage.pRpcChannelBuffer, "dangling pRpcChannelBuffer = %p\n", stubMessage.pRpcChannelBuffer);
}
START_TEST( cstub )
@@ -1443,6 +1573,7 @@ START_TEST( cstub )
test_delegating_Invoke(ppsf);
test_NdrDllRegisterProxy();
test_delegated_methods();
test_ChannelBufferRefCount(ppsf);
OleUninitialize();
}
@@ -0,0 +1,2 @@
#include "explicit_handle_s.h"
@@ -0,0 +1,32 @@
/*
* Copyright 2023 Haoyang Chen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#pragma makedep client
#pragma makedep server
[
uuid(00000000-4114-0704-2301-000000000002),
explicit_handle
]
interface RPCExplicitHandle
{
int add([in] handle_t hBinding, [in] int a, [in] int b);
int getNum([in] int a, [in] handle_t hBinding);
void Shutdown([in] handle_t hBinding);
}
+38 -12
View File
@@ -31,7 +31,7 @@
#if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
# define _TYPE_ALIGNMENT(type) __alignof(type)
#elif defined(__GNUC__)
#elif defined(__GNUC__) || defined(__clang__)
# define _TYPE_ALIGNMENT(type) __alignof__(type)
#else
/*
@@ -53,23 +53,23 @@
* Test helper macros
*/
#define TEST_TYPE_SIZE(type, size) C_ASSERT(sizeof(type) == size);
#define TEST_TYPE_SIZE(type, size) C_ASSERT(sizeof(type) == size);
#ifdef TYPE_ALIGNMENT
# define TEST_TYPE_ALIGN(type, align) C_ASSERT(TYPE_ALIGNMENT(type) == align);
# define TEST_TYPE_ALIGN(type, align) C_ASSERT(TYPE_ALIGNMENT(type) == align);
#else
# define TEST_TYPE_ALIGN(type, align)
#endif
#ifdef _TYPE_ALIGNMENT
# define TEST_TARGET_ALIGN(type, align) C_ASSERT(_TYPE_ALIGNMENT(*(type)0) == align);
# define TEST_FIELD_ALIGN(type, field, align) C_ASSERT(_TYPE_ALIGNMENT(((type*)0)->field) == align);
# define TEST_TARGET_ALIGN(type, align) C_ASSERT(_TYPE_ALIGNMENT(*(type)0) == align);
# define TEST_FIELD_ALIGN(type, field, align) C_ASSERT(_TYPE_ALIGNMENT(((type*)0)->field) == align);
#else
# define TEST_TARGET_ALIGN(type, align)
# define TEST_FIELD_ALIGN(type, field, align)
#endif
#define TEST_FIELD_OFFSET(type, field, offset) C_ASSERT(FIELD_OFFSET(type, field) == offset);
#define TEST_FIELD_OFFSET(type, field, offset) C_ASSERT(FIELD_OFFSET(type, field) == offset);
#define TEST_TARGET_SIZE(type, size) TEST_TYPE_SIZE(*(type)0, size)
#define TEST_FIELD_SIZE(type, field, size) TEST_TYPE_SIZE((((type*)0)->field), size)
@@ -91,6 +91,7 @@ static void test_pack_RPC_STATUS(void)
/* RPC_STATUS */
TEST_TYPE_SIZE (RPC_STATUS, 4)
TEST_TYPE_ALIGN (RPC_STATUS, 4)
TEST_TYPE_SIGNED (RPC_STATUS)
}
static void test_pack_PRPC_POLICY(void)
@@ -593,6 +594,15 @@ static void test_pack_MIDL_STUB_MESSAGE(void)
TEST_FIELD_SIZE (MIDL_STUB_MESSAGE, Memory, 8)
TEST_FIELD_ALIGN (MIDL_STUB_MESSAGE, Memory, 8)
TEST_FIELD_OFFSET(MIDL_STUB_MESSAGE, Memory, 48)
TEST_FIELD_SIZE (MIDL_STUB_MESSAGE, IsClient, 1)
TEST_FIELD_ALIGN (MIDL_STUB_MESSAGE, IsClient, 1)
TEST_FIELD_OFFSET(MIDL_STUB_MESSAGE, IsClient, 56)
TEST_FIELD_SIZE (MIDL_STUB_MESSAGE, Pad, 1)
TEST_FIELD_ALIGN (MIDL_STUB_MESSAGE, Pad, 1)
TEST_FIELD_OFFSET(MIDL_STUB_MESSAGE, Pad, 57)
TEST_FIELD_SIZE (MIDL_STUB_MESSAGE, uFlags2, 2)
TEST_FIELD_ALIGN (MIDL_STUB_MESSAGE, uFlags2, 2)
TEST_FIELD_OFFSET(MIDL_STUB_MESSAGE, uFlags2, 58)
TEST_FIELD_SIZE (MIDL_STUB_MESSAGE, ReuseBuffer, 4)
TEST_FIELD_ALIGN (MIDL_STUB_MESSAGE, ReuseBuffer, 4)
TEST_FIELD_OFFSET(MIDL_STUB_MESSAGE, ReuseBuffer, 60)
@@ -614,6 +624,9 @@ static void test_pack_MIDL_STUB_MESSAGE(void)
TEST_FIELD_SIZE (MIDL_STUB_MESSAGE, uFlags, 1)
TEST_FIELD_ALIGN (MIDL_STUB_MESSAGE, uFlags, 1)
TEST_FIELD_OFFSET(MIDL_STUB_MESSAGE, uFlags, 97)
TEST_FIELD_SIZE (MIDL_STUB_MESSAGE, UniquePtrCount, 2)
TEST_FIELD_ALIGN (MIDL_STUB_MESSAGE, UniquePtrCount, 2)
TEST_FIELD_OFFSET(MIDL_STUB_MESSAGE, UniquePtrCount, 98)
TEST_FIELD_SIZE (MIDL_STUB_MESSAGE, MaxCount, 8)
TEST_FIELD_ALIGN (MIDL_STUB_MESSAGE, MaxCount, 8)
TEST_FIELD_OFFSET(MIDL_STUB_MESSAGE, MaxCount, 104)
@@ -673,9 +686,9 @@ static void test_pack_MIDL_SYNTAX_INFO(void)
TEST_FIELD_SIZE (MIDL_SYNTAX_INFO, aUserMarshalQuadruple, 8)
TEST_FIELD_ALIGN (MIDL_SYNTAX_INFO, aUserMarshalQuadruple, 8)
TEST_FIELD_OFFSET(MIDL_SYNTAX_INFO, aUserMarshalQuadruple, 56)
TEST_FIELD_SIZE (MIDL_SYNTAX_INFO, pReserved1, 8)
TEST_FIELD_ALIGN (MIDL_SYNTAX_INFO, pReserved1, 8)
TEST_FIELD_OFFSET(MIDL_SYNTAX_INFO, pReserved1, 64)
TEST_FIELD_SIZE (MIDL_SYNTAX_INFO, pMethodProperties, 8)
TEST_FIELD_ALIGN (MIDL_SYNTAX_INFO, pMethodProperties, 8)
TEST_FIELD_OFFSET(MIDL_SYNTAX_INFO, pMethodProperties, 64)
TEST_FIELD_SIZE (MIDL_SYNTAX_INFO, pReserved2, 8)
TEST_FIELD_ALIGN (MIDL_SYNTAX_INFO, pReserved2, 8)
TEST_FIELD_OFFSET(MIDL_SYNTAX_INFO, pReserved2, 72)
@@ -940,6 +953,7 @@ static void test_pack_RPC_STATUS(void)
/* RPC_STATUS */
TEST_TYPE_SIZE (RPC_STATUS, 4)
TEST_TYPE_ALIGN (RPC_STATUS, 4)
TEST_TYPE_SIGNED (RPC_STATUS)
}
static void test_pack_PRPC_POLICY(void)
@@ -1442,6 +1456,15 @@ static void test_pack_MIDL_STUB_MESSAGE(void)
TEST_FIELD_SIZE (MIDL_STUB_MESSAGE, Memory, 4)
TEST_FIELD_ALIGN (MIDL_STUB_MESSAGE, Memory, 4)
TEST_FIELD_OFFSET(MIDL_STUB_MESSAGE, Memory, 28)
TEST_FIELD_SIZE (MIDL_STUB_MESSAGE, IsClient, 1)
TEST_FIELD_ALIGN (MIDL_STUB_MESSAGE, IsClient, 1)
TEST_FIELD_OFFSET(MIDL_STUB_MESSAGE, IsClient, 32)
TEST_FIELD_SIZE (MIDL_STUB_MESSAGE, Pad, 1)
TEST_FIELD_ALIGN (MIDL_STUB_MESSAGE, Pad, 1)
TEST_FIELD_OFFSET(MIDL_STUB_MESSAGE, Pad, 33)
TEST_FIELD_SIZE (MIDL_STUB_MESSAGE, uFlags2, 2)
TEST_FIELD_ALIGN (MIDL_STUB_MESSAGE, uFlags2, 2)
TEST_FIELD_OFFSET(MIDL_STUB_MESSAGE, uFlags2, 34)
TEST_FIELD_SIZE (MIDL_STUB_MESSAGE, ReuseBuffer, 4)
TEST_FIELD_ALIGN (MIDL_STUB_MESSAGE, ReuseBuffer, 4)
TEST_FIELD_OFFSET(MIDL_STUB_MESSAGE, ReuseBuffer, 36)
@@ -1463,6 +1486,9 @@ static void test_pack_MIDL_STUB_MESSAGE(void)
TEST_FIELD_SIZE (MIDL_STUB_MESSAGE, uFlags, 1)
TEST_FIELD_ALIGN (MIDL_STUB_MESSAGE, uFlags, 1)
TEST_FIELD_OFFSET(MIDL_STUB_MESSAGE, uFlags, 57)
TEST_FIELD_SIZE (MIDL_STUB_MESSAGE, UniquePtrCount, 2)
TEST_FIELD_ALIGN (MIDL_STUB_MESSAGE, UniquePtrCount, 2)
TEST_FIELD_OFFSET(MIDL_STUB_MESSAGE, UniquePtrCount, 58)
TEST_FIELD_SIZE (MIDL_STUB_MESSAGE, MaxCount, 4)
TEST_FIELD_ALIGN (MIDL_STUB_MESSAGE, MaxCount, 4)
TEST_FIELD_OFFSET(MIDL_STUB_MESSAGE, MaxCount, 60)
@@ -1522,9 +1548,9 @@ static void test_pack_MIDL_SYNTAX_INFO(void)
TEST_FIELD_SIZE (MIDL_SYNTAX_INFO, aUserMarshalQuadruple, 4)
TEST_FIELD_ALIGN (MIDL_SYNTAX_INFO, aUserMarshalQuadruple, 4)
TEST_FIELD_OFFSET(MIDL_SYNTAX_INFO, aUserMarshalQuadruple, 36)
TEST_FIELD_SIZE (MIDL_SYNTAX_INFO, pReserved1, 4)
TEST_FIELD_ALIGN (MIDL_SYNTAX_INFO, pReserved1, 4)
TEST_FIELD_OFFSET(MIDL_SYNTAX_INFO, pReserved1, 40)
TEST_FIELD_SIZE (MIDL_SYNTAX_INFO, pMethodProperties, 4)
TEST_FIELD_ALIGN (MIDL_SYNTAX_INFO, pMethodProperties, 4)
TEST_FIELD_OFFSET(MIDL_SYNTAX_INFO, pMethodProperties, 40)
TEST_FIELD_SIZE (MIDL_SYNTAX_INFO, pReserved2, 4)
TEST_FIELD_ALIGN (MIDL_SYNTAX_INFO, pReserved2, 4)
TEST_FIELD_OFFSET(MIDL_SYNTAX_INFO, pReserved2, 44)
File diff suppressed because it is too large Load Diff
+226 -163
View File
@@ -40,6 +40,10 @@
#include "rpcdce.h"
#include "secext.h"
#ifdef __REACTOS__ // I_RpcExceptionFilter is Vista+
#define RpcExceptionFilter I_RpcExceptionFilter
#endif
typedef unsigned int unsigned32;
typedef struct twr_t
{
@@ -78,35 +82,49 @@ static BOOL Uuid_Comparison_Grid[11][11] = {
{ TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE }
};
static void UuidConversionAndComparison(void) {
static void test_UuidEqual(void)
{
UUID Uuid1, Uuid2, *PUuid1, *PUuid2;
RPC_STATUS status;
int i1, i2;
/* Uuid Equality */
for (i1 = 0; i1 < 11; i1++)
{
for (i2 = 0; i2 < 11; i2++)
{
if (i1 < 10)
{
Uuid1 = Uuid_Table[i1];
PUuid1 = &Uuid1;
}
else
PUuid1 = NULL;
if (i2 < 10)
{
Uuid2 = Uuid_Table[i2];
PUuid2 = &Uuid2;
}
else
PUuid2 = NULL;
ok(UuidEqual(PUuid1, PUuid2, &status) == Uuid_Comparison_Grid[i1][i2], "UUID Equality\n" );
}
}
}
static void test_UuidFromString(void)
{
CHAR strx[100], x;
LPSTR str = strx;
WCHAR wstrx[100], wx;
LPWSTR wstr = wstrx;
UUID Uuid1, Uuid2, *PUuid1, *PUuid2;
UUID Uuid1, Uuid2;
RPC_STATUS rslt;
int i1,i2;
/* Uuid Equality */
for (i1 = 0; i1 < 11; i1++)
for (i2 = 0; i2 < 11; i2++) {
if (i1 < 10) {
Uuid1 = Uuid_Table[i1];
PUuid1 = &Uuid1;
} else {
PUuid1 = NULL;
}
if (i2 < 10) {
Uuid2 = Uuid_Table[i2];
PUuid2 = &Uuid2;
} else {
PUuid2 = NULL;
}
ok( (UuidEqual(PUuid1, PUuid2, &rslt) == Uuid_Comparison_Grid[i1][i2]), "UUID Equality\n" );
}
/* Uuid to String to Uuid (char) */
for (i1 = 0; i1 < 10; i1++) {
Uuid1 = Uuid_Table[i1];
@@ -141,44 +159,30 @@ static void UuidConversionAndComparison(void) {
}
}
static void TestDceErrorInqText (void)
static void test_DceErrorInqTextA(void)
{
char bufferInvalid [1024];
char buffer [1024]; /* The required size is not documented but would
* appear to be 256.
*/
char buffer [1024];
DWORD dwCount;
RPC_STATUS status;
dwCount = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
RPC_S_NOT_RPC_ERROR, 0, bufferInvalid, ARRAY_SIZE(bufferInvalid), NULL);
ok(dwCount, "Cannot set up for DceErrorInqText\n");
/* A random sample of DceErrorInqText */
/* 0 is success */
ok ((DceErrorInqTextA (0, (unsigned char*)buffer) == RPC_S_OK),
"DceErrorInqTextA(0...)\n");
/* A real RPC_S error */
ok ((DceErrorInqTextA (RPC_S_INVALID_STRING_UUID, (unsigned char*)buffer) == RPC_S_OK),
"DceErrorInqTextA(valid...)\n");
status = DceErrorInqTextA(0, (unsigned char*)buffer);
ok(status == RPC_S_OK, "got %lx\n", status);
if (dwCount)
{
/* A message for which FormatMessage should fail
* which should return RPC_S_OK and the
* fixed "not valid" message
*/
ok ((DceErrorInqTextA (35, (unsigned char*)buffer) == RPC_S_OK &&
strcmp (buffer, bufferInvalid) == 0),
"DceErrorInqTextA(unformattable...)\n");
/* One for which FormatMessage should succeed but
* DceErrorInqText should "fail"
* 3814 is generally quite a long message
*/
ok ((DceErrorInqTextA (3814, (unsigned char*)buffer) == RPC_S_OK &&
strcmp (buffer, bufferInvalid) == 0),
"DceErrorInqTextA(deviation...)\n");
}
else
ok (0, "Cannot set up for DceErrorInqText\n");
/* A real RPC_S error */
status = DceErrorInqTextA(RPC_S_INVALID_STRING_UUID, (unsigned char*)buffer);
ok(status == RPC_S_OK, "got %lx\n", status);
/* A message for which FormatMessage should fail which should return RPC_S_OK and the
* fixed "not valid" message */
status = DceErrorInqTextA(35, (unsigned char*)buffer);
ok(status == RPC_S_OK, "got %lx\n", status);
ok(!strcmp(buffer, bufferInvalid), "got %s vs %s\n", wine_dbgstr_a(buffer), wine_dbgstr_a(bufferInvalid));
}
static RPC_DISPATCH_FUNCTION IFoo_table[] =
@@ -228,48 +232,48 @@ static void test_rpc_ncacn_ip_tcp(void)
status = RpcMgmtStopServerListening(NULL);
ok(status == RPC_S_NOT_LISTENING,
"wrong RpcMgmtStopServerListening error (%u)\n", status);
"wrong RpcMgmtStopServerListening error (%lu)\n", status);
status = RpcMgmtWaitServerListen();
ok(status == RPC_S_NOT_LISTENING,
"wrong RpcMgmtWaitServerListen error status (%u)\n", status);
"wrong RpcMgmtWaitServerListen error status (%lu)\n", status);
status = RpcServerListen(1, 20, FALSE);
ok(status == RPC_S_NO_PROTSEQS_REGISTERED,
"wrong RpcServerListen error (%u)\n", status);
"wrong RpcServerListen error (%lu)\n", status);
status = RpcServerUseProtseqEpA(ncacn_ip_tcp, 20, endpoint, NULL);
ok(status == RPC_S_OK, "RpcServerUseProtseqEp failed (%u)\n", status);
ok(status == RPC_S_OK, "RpcServerUseProtseqEp failed (%lu)\n", status);
status = RpcServerRegisterIf(IFoo_v0_0_s_ifspec, NULL, NULL);
ok(status == RPC_S_OK, "RpcServerRegisterIf failed (%u)\n", status);
ok(status == RPC_S_OK, "RpcServerRegisterIf failed (%lu)\n", status);
status = RpcServerListen(1, 20, TRUE);
ok(status == RPC_S_OK, "RpcServerListen failed (%u)\n", status);
ok(status == RPC_S_OK, "RpcServerListen failed (%lu)\n", status);
status = RpcServerListen(1, 20, TRUE);
ok(status == RPC_S_ALREADY_LISTENING,
"wrong RpcServerListen error (%u)\n", status);
"wrong RpcServerListen error (%lu)\n", status);
status = RpcStringBindingComposeA(NULL, ncacn_ip_tcp, address,
endpoint, NULL, &binding);
ok(status == RPC_S_OK, "RpcStringBindingCompose failed (%u)\n", status);
ok(status == RPC_S_OK, "RpcStringBindingCompose failed (%lu)\n", status);
status = RpcBindingFromStringBindingA(binding, &IFoo_IfHandle);
ok(status == RPC_S_OK, "RpcBindingFromStringBinding failed (%u)\n",
ok(status == RPC_S_OK, "RpcBindingFromStringBinding failed (%lu)\n",
status);
status = RpcBindingSetAuthInfoA(IFoo_IfHandle, NULL, RPC_C_AUTHN_LEVEL_NONE,
RPC_C_AUTHN_WINNT, NULL, RPC_C_AUTHZ_NAME);
ok(status == RPC_S_OK, "RpcBindingSetAuthInfo failed (%u)\n", status);
ok(status == RPC_S_OK, "RpcBindingSetAuthInfo failed (%lu)\n", status);
status = RpcBindingInqAuthInfoA(IFoo_IfHandle, NULL, NULL, NULL, NULL, NULL);
ok(status == RPC_S_BINDING_HAS_NO_AUTH, "RpcBindingInqAuthInfo failed (%u)\n",
ok(status == RPC_S_BINDING_HAS_NO_AUTH, "RpcBindingInqAuthInfo failed (%lu)\n",
status);
status = RpcBindingSetAuthInfoA(IFoo_IfHandle, spn, RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
RPC_C_AUTHN_WINNT, NULL, RPC_C_AUTHZ_NAME);
ok(status == RPC_S_OK, "RpcBindingSetAuthInfo failed (%u)\n", status);
ok(status == RPC_S_OK, "RpcBindingSetAuthInfo failed (%lu)\n", status);
level = authnsvc = authzsvc = 0;
principal = (unsigned char *)0xdeadbeef;
@@ -277,33 +281,33 @@ static void test_rpc_ncacn_ip_tcp(void)
status = RpcBindingInqAuthInfoA(IFoo_IfHandle, &principal, &level, &authnsvc,
&identity, &authzsvc);
ok(status == RPC_S_OK, "RpcBindingInqAuthInfo failed (%u)\n", status);
ok(status == RPC_S_OK, "RpcBindingInqAuthInfo failed (%lu)\n", status);
ok(identity == NULL, "expected NULL identity, got %p\n", identity);
ok(principal != (unsigned char *)0xdeadbeef, "expected valid principal, got %p\n", principal);
ok(level == RPC_C_AUTHN_LEVEL_PKT_PRIVACY, "expected RPC_C_AUTHN_LEVEL_PKT_PRIVACY, got %d\n", level);
ok(authnsvc == RPC_C_AUTHN_WINNT, "expected RPC_C_AUTHN_WINNT, got %d\n", authnsvc);
todo_wine ok(authzsvc == RPC_C_AUTHZ_NAME, "expected RPC_C_AUTHZ_NAME, got %d\n", authzsvc);
ok(level == RPC_C_AUTHN_LEVEL_PKT_PRIVACY, "expected RPC_C_AUTHN_LEVEL_PKT_PRIVACY, got %ld\n", level);
ok(authnsvc == RPC_C_AUTHN_WINNT, "expected RPC_C_AUTHN_WINNT, got %ld\n", authnsvc);
todo_wine ok(authzsvc == RPC_C_AUTHZ_NAME, "expected RPC_C_AUTHZ_NAME, got %ld\n", authzsvc);
if (status == RPC_S_OK) RpcStringFreeA(&principal);
status = RpcMgmtStopServerListening(NULL);
ok(status == RPC_S_OK, "RpcMgmtStopServerListening failed (%u)\n",
ok(status == RPC_S_OK, "RpcMgmtStopServerListening failed (%lu)\n",
status);
status = RpcMgmtStopServerListening(NULL);
ok(status == RPC_S_OK, "RpcMgmtStopServerListening failed (%u)\n",
ok(status == RPC_S_OK, "RpcMgmtStopServerListening failed (%lu)\n",
status);
status = RpcServerUnregisterIf(NULL, NULL, FALSE);
ok(status == RPC_S_OK, "RpcServerUnregisterIf failed (%u)\n", status);
ok(status == RPC_S_OK, "RpcServerUnregisterIf failed (%lu)\n", status);
status = RpcMgmtWaitServerListen();
ok(status == RPC_S_OK, "RpcMgmtWaitServerListen failed (%u)\n", status);
ok(status == RPC_S_OK, "RpcMgmtWaitServerListen failed (%lu)\n", status);
status = RpcStringFreeA(&binding);
ok(status == RPC_S_OK, "RpcStringFree failed (%u)\n", status);
ok(status == RPC_S_OK, "RpcStringFree failed (%lu)\n", status);
status = RpcBindingFree(&IFoo_IfHandle);
ok(status == RPC_S_OK, "RpcBindingFree failed (%u)\n", status);
ok(status == RPC_S_OK, "RpcBindingFree failed (%lu)\n", status);
}
/* this is what's generated with MS/RPC - it includes an extra 2
@@ -349,7 +353,7 @@ static void test_towers(void)
ret = TowerConstruct(&mapi_if_id, &ndr_syntax, "ncacn_ip_tcp", "135", "10.0.0.1", &tower);
ok(ret == RPC_S_OK ||
broken(ret == RPC_S_INVALID_RPC_PROTSEQ), /* Vista */
"TowerConstruct failed with error %d\n", ret);
"TowerConstruct failed with error %ld\n", ret);
if (ret == RPC_S_INVALID_RPC_PROTSEQ)
{
/* Windows Vista fails with this error and crashes if we continue */
@@ -382,7 +386,7 @@ static void test_towers(void)
}
ret = TowerExplode(tower, &object, &syntax, &protseq, &endpoint, &address);
ok(ret == RPC_S_OK, "TowerExplode failed with error %d\n", ret);
ok(ret == RPC_S_OK, "TowerExplode failed with error %ld\n", ret);
ok(!memcmp(&object, &mapi_if_id, sizeof(mapi_if_id)), "object id didn't match\n");
ok(!memcmp(&syntax, &ndr_syntax, sizeof(syntax)), "syntax id didn't match\n");
ok(!strcmp(protseq, "ncacn_ip_tcp"), "protseq was \"%s\" instead of \"ncacn_ip_tcp\"\n", protseq);
@@ -394,15 +398,15 @@ static void test_towers(void)
I_RpcFree(address);
ret = TowerExplode(tower, NULL, NULL, NULL, NULL, NULL);
ok(ret == RPC_S_OK, "TowerExplode failed with error %d\n", ret);
ok(ret == RPC_S_OK, "TowerExplode failed with error %ld\n", ret);
I_RpcFree(tower);
/* test the behaviour for ip_tcp with name instead of dotted IP notation */
ret = TowerConstruct(&mapi_if_id, &ndr_syntax, "ncacn_ip_tcp", "135", "localhost", &tower);
ok(ret == RPC_S_OK, "TowerConstruct failed with error %d\n", ret);
ok(ret == RPC_S_OK, "TowerConstruct failed with error %ld\n", ret);
ret = TowerExplode(tower, NULL, NULL, NULL, NULL, &address);
ok(ret == RPC_S_OK, "TowerExplode failed with error %d\n", ret);
ok(ret == RPC_S_OK, "TowerExplode failed with error %ld\n", ret);
ok(!strcmp(address, "0.0.0.0") ||
broken(!strcmp(address, "255.255.255.255")),
"address was \"%s\" instead of \"0.0.0.0\"\n", address);
@@ -412,11 +416,11 @@ static void test_towers(void)
/* test the behaviour for np with no address */
ret = TowerConstruct(&mapi_if_id, &ndr_syntax, "ncacn_np", "\\pipe\\test", NULL, &tower);
ok(ret == RPC_S_OK, "TowerConstruct failed with error %d\n", ret);
ok(ret == RPC_S_OK, "TowerConstruct failed with error %ld\n", ret);
ret = TowerExplode(tower, NULL, NULL, NULL, NULL, &address);
ok(ret == RPC_S_OK ||
broken(ret != RPC_S_OK), /* win2k, indeterminate */
"TowerExplode failed with error %d\n", ret);
"TowerExplode failed with error %ld\n", ret);
/* Windows XP SP3 sets address to NULL */
ok(!address || !strcmp(address, ""), "address was \"%s\" instead of \"\" or NULL (XP SP3)\n", address);
@@ -562,7 +566,7 @@ static void test_I_RpcMapWin32Status(void)
ok(win32status == expected_win32status ||
broken(missing && win32status == rpc_status),
"I_RpcMapWin32Status(%d) should have returned 0x%x instead of 0x%x%s\n",
"I_RpcMapWin32Status(%ld) should have returned 0x%lx instead of 0x%lx%s\n",
rpc_status, expected_win32status, win32status,
broken(missing) ? " (or have returned with the given status)" : "");
}
@@ -584,7 +588,7 @@ static void test_RpcStringBindingParseA(void)
/* test all parameters */
status = RpcStringBindingParseA(valid_binding, &uuid, &protseq, &network_addr, &endpoint, &options);
ok(status == RPC_S_OK, "RpcStringBindingParseA failed with error %d\n", status);
ok(status == RPC_S_OK, "RpcStringBindingParseA failed with error %ld\n", status);
ok(!strcmp((char *)uuid, "00000000-0000-0000-c000-000000000046"), "uuid should have been 00000000-0000-0000-C000-000000000046 instead of %s\n", uuid);
ok(!strcmp((char *)protseq, "ncacn_np"), "protseq should have been ncacn_np instead of %s\n", protseq);
ok(!strcmp((char *)network_addr, "."), "network_addr should have been . instead of %s\n", network_addr);
@@ -601,7 +605,7 @@ static void test_RpcStringBindingParseA(void)
/* test all parameters with different type of string binding */
status = RpcStringBindingParseA(valid_binding2, &uuid, &protseq, &network_addr, &endpoint, &options);
ok(status == RPC_S_OK, "RpcStringBindingParseA failed with error %d\n", status);
ok(status == RPC_S_OK, "RpcStringBindingParseA failed with error %ld\n", status);
ok(!strcmp((char *)uuid, "00000000-0000-0000-c000-000000000046"), "uuid should have been 00000000-0000-0000-C000-000000000046 instead of %s\n", uuid);
ok(!strcmp((char *)protseq, "ncacn_np"), "protseq should have been ncacn_np instead of %s\n", protseq);
ok(!strcmp((char *)network_addr, "."), "network_addr should have been . instead of %s\n", network_addr);
@@ -618,27 +622,30 @@ static void test_RpcStringBindingParseA(void)
/* test with as many parameters NULL as possible */
status = RpcStringBindingParseA(valid_binding, NULL, &protseq, NULL, NULL, NULL);
ok(status == RPC_S_OK, "RpcStringBindingParseA failed with error %d\n", status);
ok(status == RPC_S_OK, "RpcStringBindingParseA failed with error %ld\n", status);
ok(!strcmp((char *)protseq, "ncacn_np"), "protseq should have been ncacn_np instead of %s\n", protseq);
RpcStringFreeA(&protseq);
/* test with invalid uuid */
status = RpcStringBindingParseA(invalid_uuid_binding, NULL, &protseq, NULL, NULL, NULL);
ok(status == RPC_S_INVALID_STRING_UUID, "RpcStringBindingParseA should have returned RPC_S_INVALID_STRING_UUID instead of %d\n", status);
ok(status == RPC_S_INVALID_STRING_UUID, "RpcStringBindingParseA should have returned RPC_S_INVALID_STRING_UUID instead of %ld\n", status);
ok(protseq == NULL, "protseq was %p instead of NULL\n", protseq);
/* test with invalid endpoint */
status = RpcStringBindingParseA(invalid_ep_binding, NULL, &protseq, NULL, NULL, NULL);
ok(status == RPC_S_OK, "RpcStringBindingParseA failed with error %d\n", status);
ok(status == RPC_S_OK, "RpcStringBindingParseA failed with error %ld\n", status);
RpcStringFreeA(&protseq);
/* test with invalid binding */
status = RpcStringBindingParseA(invalid_binding, &uuid, &protseq, &network_addr, &endpoint, &options);
ok(status == RPC_S_INVALID_STRING_BINDING, "RpcStringBindingParseA should have returned RPC_S_INVALID_STRING_BINDING instead of %d\n", status);
todo_wine
ok(status == RPC_S_INVALID_STRING_BINDING, "RpcStringBindingParseA should have returned RPC_S_INVALID_STRING_BINDING instead of %ld\n", status);
todo_wine
ok(uuid == NULL, "uuid was %p instead of NULL\n", uuid);
if (uuid)
RpcStringFreeA(&uuid);
ok(protseq == NULL, "protseq was %p instead of NULL\n", protseq);
todo_wine
ok(network_addr == NULL, "network_addr was %p instead of NULL\n", network_addr);
if (network_addr)
RpcStringFreeA(&network_addr);
@@ -646,17 +653,10 @@ static void test_RpcStringBindingParseA(void)
ok(options == NULL, "options was %p instead of NULL\n", options);
}
static void test_RpcExceptionFilter(const char *func_name)
static void test_RpcExceptionFilter(void)
{
int retval, retval2;
ULONG exception;
int retval;
int (WINAPI *pRpcExceptionFilter)(ULONG) = (void *)GetProcAddress(GetModuleHandleA("rpcrt4.dll"), func_name);
if (!pRpcExceptionFilter)
{
win_skip("%s not exported\n", func_name);
return;
}
for (exception = 0; exception < STATUS_REG_NAT_CONSUMPTION; exception++)
{
@@ -665,7 +665,8 @@ static void test_RpcExceptionFilter(const char *func_name)
if (exception == 0x40000005) exception = 0x80000000;
if (exception == 0x80000005) exception = 0xc0000000;
retval = pRpcExceptionFilter(exception);
retval = RpcExceptionFilter(exception);
retval2 = I_RpcExceptionFilter(exception);
switch (exception)
{
case STATUS_DATATYPE_MISALIGNMENT:
@@ -676,17 +677,25 @@ static void test_RpcExceptionFilter(const char *func_name)
case STATUS_INSTRUCTION_MISALIGNMENT:
case STATUS_STACK_OVERFLOW:
case STATUS_POSSIBLE_DEADLOCK:
ok(retval == EXCEPTION_CONTINUE_SEARCH, "%s(0x%x) should have returned %d instead of %d\n",
func_name, exception, EXCEPTION_CONTINUE_SEARCH, retval);
ok(retval == EXCEPTION_CONTINUE_SEARCH, "RpcExceptionFilter(0x%lx) should have returned %d instead of %d\n",
exception, EXCEPTION_CONTINUE_SEARCH, retval);
ok(retval2 == EXCEPTION_CONTINUE_SEARCH, "I_RpcExceptionFilter(0x%lx) should have returned %d instead of %d\n",
exception, EXCEPTION_CONTINUE_SEARCH, retval);
break;
case STATUS_GUARD_PAGE_VIOLATION:
case STATUS_IN_PAGE_ERROR:
case STATUS_HANDLE_NOT_CLOSABLE:
trace("%s(0x%x) returned %d\n", func_name, exception, retval);
todo_wine
{
ok(!retval, "Unexpected return value %d.\n", retval);
ok(!retval2, "Unexpected return value %d.\n", retval2);
}
break;
default:
ok(retval == EXCEPTION_EXECUTE_HANDLER, "%s(0x%x) should have returned %d instead of %d\n",
func_name, exception, EXCEPTION_EXECUTE_HANDLER, retval);
ok(retval == EXCEPTION_EXECUTE_HANDLER, "RpcExceptionFilter(0x%lx) should have returned %d instead of %d\n",
exception, EXCEPTION_EXECUTE_HANDLER, retval);
ok(retval2 == EXCEPTION_EXECUTE_HANDLER, "I_RpcExceptionFilter(0x%lx) should have returned %d instead of %d\n",
exception, EXCEPTION_EXECUTE_HANDLER, retval);
}
}
}
@@ -702,21 +711,21 @@ static void test_RpcStringBindingFromBinding(void)
status = RpcStringBindingComposeA(NULL, ncacn_np, address,
endpoint, NULL, &binding);
ok(status == RPC_S_OK, "RpcStringBindingCompose failed (%u)\n", status);
ok(status == RPC_S_OK, "RpcStringBindingCompose failed (%lu)\n", status);
status = RpcBindingFromStringBindingA(binding, &handle);
ok(status == RPC_S_OK, "RpcBindingFromStringBinding failed (%u)\n", status);
ok(status == RPC_S_OK, "RpcBindingFromStringBinding failed (%lu)\n", status);
RpcStringFreeA(&binding);
status = RpcBindingToStringBindingA(handle, &binding);
ok(status == RPC_S_OK, "RpcStringBindingFromBinding failed with error %u\n", status);
ok(status == RPC_S_OK, "RpcStringBindingFromBinding failed with error %lu\n", status);
ok(!strcmp((const char *)binding, "ncacn_np:.[\\\\pipe\\\\wine_rpc_test]"),
"binding string didn't match what was expected: \"%s\"\n", binding);
RpcStringFreeA(&binding);
status = RpcBindingFree(&handle);
ok(status == RPC_S_OK, "RpcBindingFree failed with error %u\n", status);
ok(status == RPC_S_OK, "RpcBindingFree failed with error %lu\n", status);
}
static void test_UuidCreate(void)
@@ -793,7 +802,7 @@ static void test_UuidCreateSequential(void)
ret = pUuidCreateSequential(&guid1);
ok(!ret || ret == RPC_S_UUID_LOCAL_ONLY,
"expected RPC_S_OK or RPC_S_UUID_LOCAL_ONLY, got %08x\n", ret);
"expected RPC_S_OK or RPC_S_UUID_LOCAL_ONLY, got %08lx\n", ret);
version = (guid1.Data3 & 0xf000) >> 12;
ok(version == 1, "unexpected version %d\n", version);
if (version == 1)
@@ -823,7 +832,7 @@ static void test_UuidCreateSequential(void)
*/
ret = pUuidCreateSequential(&guid2);
ok(!ret || ret == RPC_S_UUID_LOCAL_ONLY,
"expected RPC_S_OK or RPC_S_UUID_LOCAL_ONLY, got %08x\n", ret);
"expected RPC_S_OK or RPC_S_UUID_LOCAL_ONLY, got %08lx\n", ret);
version = (guid2.Data3 & 0xf000) >> 12;
ok(version == 1, "unexpected version %d\n", version);
ok(!memcmp(guid1.Data4, guid2.Data4, sizeof(guid2.Data4)),
@@ -847,10 +856,11 @@ static void test_RpcBindingFree(void)
status = RpcBindingFree(&binding);
ok(status == RPC_S_INVALID_BINDING,
"RpcBindingFree should have returned RPC_S_INVALID_BINDING instead of %d\n",
"RpcBindingFree should have returned RPC_S_INVALID_BINDING instead of %ld\n",
status);
}
#ifdef __REACTOS__
static void test_RpcStringFree(void)
{
RPC_WSTR string = NULL;
@@ -866,6 +876,56 @@ static void test_RpcStringFree(void)
ok(string == NULL, "String is %p expected NULL!\n", string);
}
#endif
static void test_RpcIfInqId(void)
{
static const GUID guid = {0x12345678, 0xdead, 0xbeef, {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}};
static RPC_STATUS (WINAPI *pRpcIfInqId)(RPC_IF_HANDLE, RPC_IF_ID *);
RPC_SERVER_INTERFACE server_interface;
RPC_CLIENT_INTERFACE client_interface;
RPC_IF_HANDLE test_handles[2];
RPC_STATUS status;
RPC_IF_ID if_id;
UINT test_idx;
pRpcIfInqId = (void *)GetProcAddress(GetModuleHandleA("rpcrt4.dll"), "RpcIfInqId");
memset(&server_interface, 0, sizeof(server_interface));
memset(&client_interface, 0, sizeof(client_interface));
server_interface.InterfaceId.SyntaxGUID = guid;
server_interface.InterfaceId.SyntaxVersion.MajorVersion = 1;
server_interface.InterfaceId.SyntaxVersion.MinorVersion = 2;
client_interface.InterfaceId.SyntaxGUID = guid;
client_interface.InterfaceId.SyntaxVersion.MajorVersion = 1;
client_interface.InterfaceId.SyntaxVersion.MinorVersion = 2;
/* Crash on Windows */
if (0)
{
status = pRpcIfInqId(NULL, &if_id);
ok(status == RPC_S_INVALID_ARG, "Expected %#x, got %#lx.\n", RPC_S_INVALID_ARG, status);
status = pRpcIfInqId((RPC_IF_HANDLE)&server_interface, NULL);
ok(status == RPC_S_INVALID_ARG, "Expected %#x, got %#lx.\n", RPC_S_INVALID_ARG, status);
}
test_handles[0] = (RPC_IF_HANDLE)&server_interface;
test_handles[1] = (RPC_IF_HANDLE)&client_interface;
for (test_idx = 0; test_idx < ARRAY_SIZE(test_handles); ++test_idx)
{
memset(&if_id, 0, sizeof(if_id));
status = pRpcIfInqId(test_handles[test_idx], &if_id);
ok(status == RPC_S_OK, "Test %u: Expected %#x, got %#lx.\n", test_idx, RPC_S_OK, status);
ok(!memcmp(&if_id.Uuid, &guid, sizeof(guid)), "Test %u: Expected UUID %s, got %s.\n", test_idx,
wine_dbgstr_guid(&guid), wine_dbgstr_guid(&if_id.Uuid));
ok(if_id.VersMajor == 1, "Test %u: Expected major version 1, got %hu.\n", test_idx,
if_id.VersMajor);
ok(if_id.VersMinor == 2, "Test %u: Expected minor version 2, got %hu.\n", test_idx,
if_id.VersMinor);
}
}
static void test_RpcServerInqDefaultPrincName(void)
{
@@ -875,42 +935,42 @@ static void test_RpcServerInqDefaultPrincName(void)
ULONG len = 0;
GetUserNameExA( NameSamCompatible, NULL, &len );
username = HeapAlloc( GetProcessHeap(), 0, len );
username = malloc( len );
GetUserNameExA( NameSamCompatible, username, &len );
ret = RpcServerInqDefaultPrincNameA( 0, NULL );
ok( ret == RPC_S_UNKNOWN_AUTHN_SERVICE, "got %u\n", ret );
ok( ret == RPC_S_UNKNOWN_AUTHN_SERVICE, "got %lu\n", ret );
ret = RpcServerInqDefaultPrincNameA( RPC_C_AUTHN_DEFAULT, NULL );
ok( ret == RPC_S_UNKNOWN_AUTHN_SERVICE, "got %u\n", ret );
ok( ret == RPC_S_UNKNOWN_AUTHN_SERVICE, "got %lu\n", ret );
principal = (RPC_CSTR)0xdeadbeef;
ret = RpcServerInqDefaultPrincNameA( RPC_C_AUTHN_DEFAULT, &principal );
ok( ret == RPC_S_UNKNOWN_AUTHN_SERVICE, "got %u\n", ret );
ok( ret == RPC_S_UNKNOWN_AUTHN_SERVICE, "got %lu\n", ret );
ok( principal == (RPC_CSTR)0xdeadbeef, "got unexpected principal\n" );
saved_principal = (RPC_CSTR)0xdeadbeef;
ret = RpcServerInqDefaultPrincNameA( RPC_C_AUTHN_WINNT, &saved_principal );
ok( ret == RPC_S_OK, "got %u\n", ret );
ok( ret == RPC_S_OK, "got %lu\n", ret );
ok( saved_principal != (RPC_CSTR)0xdeadbeef, "expected valid principal\n" );
ok( !strcmp( (const char *)saved_principal, username ), "got \'%s\'\n", saved_principal );
trace("%s\n", saved_principal);
ret = RpcServerRegisterAuthInfoA( (RPC_CSTR)"wine\\test", RPC_C_AUTHN_WINNT, NULL, NULL );
ok( ret == RPC_S_OK, "got %u\n", ret );
ok( ret == RPC_S_OK, "got %lu\n", ret );
principal = (RPC_CSTR)0xdeadbeef;
ret = RpcServerInqDefaultPrincNameA( RPC_C_AUTHN_WINNT, &principal );
ok( ret == RPC_S_OK, "got %u\n", ret );
ok( ret == RPC_S_OK, "got %lu\n", ret );
ok( principal != (RPC_CSTR)0xdeadbeef, "expected valid principal\n" );
ok( !strcmp( (const char *)principal, username ), "got \'%s\'\n", principal );
RpcStringFreeA( &principal );
ret = RpcServerRegisterAuthInfoA( saved_principal, RPC_C_AUTHN_WINNT, NULL, NULL );
ok( ret == RPC_S_OK, "got %u\n", ret );
ok( ret == RPC_S_OK, "got %lu\n", ret );
RpcStringFreeA( &saved_principal );
HeapFree( GetProcessHeap(), 0, username );
free( username );
}
static void test_RpcServerRegisterAuthInfo(void)
@@ -918,7 +978,7 @@ static void test_RpcServerRegisterAuthInfo(void)
RPC_STATUS status;
status = RpcServerRegisterAuthInfoW(NULL, 600, NULL, NULL);
ok(status == RPC_S_UNKNOWN_AUTHN_SERVICE, "status = %x\n", status);
ok(status == RPC_S_UNKNOWN_AUTHN_SERVICE, "status = %lx\n", status);
}
static void test_RpcServerUseProtseq(void)
@@ -941,12 +1001,12 @@ static void test_RpcServerUseProtseq(void)
else
{
binding_count_before = bindings->Count;
ok(status == RPC_S_OK, "RpcServerInqBindings failed with status %d\n", status);
ok(status == RPC_S_OK, "RpcServerInqBindings failed with status %ld\n", status);
for (i = 0; i < bindings->Count; i++)
{
RPC_CSTR str_bind;
status = RpcBindingToStringBindingA(bindings->BindingH[i], &str_bind);
ok(status == RPC_S_OK, "RpcBindingToStringBinding failed with status %d\n", status);
ok(status == RPC_S_OK, "RpcBindingToStringBinding failed with status %ld\n", status);
if (lstrlenA((const char *)str_bind) > 12 && !memcmp(str_bind, "ncacn_ip_tcp", 12))
iptcp_registered = TRUE;
if (lstrlenA((const char *)str_bind) > 8 && !memcmp(str_bind, "ncacn_np", 8))
@@ -962,7 +1022,7 @@ static void test_RpcServerUseProtseq(void)
* RpcServerUseProtseq(...) */
status = RpcServerUseProtseqEpA(ncalrpc, 0, NULL, NULL);
ok(status == RPC_S_OK || broken(status == RPC_S_INVALID_ENDPOINT_FORMAT),
"RpcServerUseProtseqEp with NULL endpoint failed with status %d\n",
"RpcServerUseProtseqEp with NULL endpoint failed with status %ld\n",
status);
/* register protocol sequences without explicit endpoints */
@@ -970,28 +1030,28 @@ static void test_RpcServerUseProtseq(void)
if (status == RPC_S_PROTSEQ_NOT_SUPPORTED)
win_skip("ncacn_np not supported\n");
else
ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_np) failed with status %d\n", status);
ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_np) failed with status %ld\n", status);
if (status == RPC_S_OK && !np_registered) endpoints_registered++;
status = RpcServerUseProtseqA(iptcp, 0, NULL);
ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_ip_tcp) failed with status %d\n", status);
ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_ip_tcp) failed with status %ld\n", status);
if (status == RPC_S_OK && !iptcp_registered) endpoints_registered++;
status = RpcServerUseProtseqA(ncalrpc, 0, NULL);
ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncalrpc) failed with status %d\n", status);
ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncalrpc) failed with status %ld\n", status);
if (status == RPC_S_OK && !ncalrpc_registered) endpoints_registered++;
status = RpcServerInqBindings(&bindings);
ok(status == RPC_S_OK, "RpcServerInqBindings failed with status %d\n", status);
ok(status == RPC_S_OK, "RpcServerInqBindings failed with status %ld\n", status);
binding_count_after1 = bindings->Count;
ok(binding_count_after1 == binding_count_before + endpoints_registered,
"wrong binding count - before: %u, after %u, endpoints registered %u\n",
"wrong binding count - before: %lu, after %lu, endpoints registered %lu\n",
binding_count_before, binding_count_after1, endpoints_registered);
for (i = 0; i < bindings->Count; i++)
{
RPC_CSTR str_bind;
status = RpcBindingToStringBindingA(bindings->BindingH[i], &str_bind);
ok(status == RPC_S_OK, "RpcBindingToStringBinding failed with status %d\n", status);
ok(status == RPC_S_OK, "RpcBindingToStringBinding failed with status %ld\n", status);
trace("string binding: %s\n", str_bind);
RpcStringFreeA(&str_bind);
}
@@ -1002,19 +1062,19 @@ static void test_RpcServerUseProtseq(void)
if (status == RPC_S_PROTSEQ_NOT_SUPPORTED)
win_skip("ncacn_np not supported\n");
else
ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_np) failed with status %d\n", status);
ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_np) failed with status %ld\n", status);
status = RpcServerUseProtseqA(iptcp, 0, NULL);
ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_ip_tcp) failed with status %d\n", status);
ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_ip_tcp) failed with status %ld\n", status);
status = RpcServerUseProtseqA(ncalrpc, 0, NULL);
ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncalrpc) failed with status %d\n", status);
ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncalrpc) failed with status %ld\n", status);
status = RpcServerInqBindings(&bindings);
ok(status == RPC_S_OK, "RpcServerInqBindings failed with status %d\n", status);
ok(status == RPC_S_OK, "RpcServerInqBindings failed with status %ld\n", status);
binding_count_after2 = bindings->Count;
ok(binding_count_after2 == binding_count_after1,
"bindings should have been re-used - after1: %u after2: %u\n",
"bindings should have been re-used - after1: %lu after2: %lu\n",
binding_count_after1, binding_count_after2);
RpcBindingVectorFree(&bindings);
}
@@ -1028,48 +1088,48 @@ static void test_endpoint_mapper(RPC_CSTR protseq, RPC_CSTR address)
unsigned char *binding;
status = RpcServerRegisterIf(IFoo_v0_0_s_ifspec, NULL, NULL);
ok(status == RPC_S_OK, "%s: RpcServerRegisterIf failed (%u)\n", protseq, status);
ok(status == RPC_S_OK, "%s: RpcServerRegisterIf failed (%lu)\n", protseq, status);
status = RpcServerInqBindings(&binding_vector);
ok(status == RPC_S_OK, "%s: RpcServerInqBindings failed with error %u\n", protseq, status);
ok(status == RPC_S_OK, "%s: RpcServerInqBindings failed with error %lu\n", protseq, status);
/* register endpoints created in test_RpcServerUseProtseq */
status = RpcEpRegisterA(IFoo_v0_0_s_ifspec, binding_vector, NULL, annotation);
ok(status == RPC_S_OK, "%s: RpcEpRegisterA failed with error %u\n", protseq, status);
ok(status == RPC_S_OK, "%s: RpcEpRegisterA failed with error %lu\n", protseq, status);
/* reregister the same endpoint with no annotation */
status = RpcEpRegisterA(IFoo_v0_0_s_ifspec, binding_vector, NULL, NULL);
ok(status == RPC_S_OK, "%s: RpcEpRegisterA failed with error %u\n", protseq, status);
ok(status == RPC_S_OK, "%s: RpcEpRegisterA failed with error %lu\n", protseq, status);
status = RpcStringBindingComposeA(NULL, protseq, address,
NULL, NULL, &binding);
ok(status == RPC_S_OK, "%s: RpcStringBindingCompose failed (%u)\n", protseq, status);
ok(status == RPC_S_OK, "%s: RpcStringBindingCompose failed (%lu)\n", protseq, status);
status = RpcBindingFromStringBindingA(binding, &handle);
ok(status == RPC_S_OK, "%s: RpcBindingFromStringBinding failed (%u)\n", protseq, status);
ok(status == RPC_S_OK, "%s: RpcBindingFromStringBinding failed (%lu)\n", protseq, status);
RpcStringFreeA(&binding);
status = RpcBindingReset(handle);
ok(status == RPC_S_OK, "%s: RpcBindingReset failed with error %u\n", protseq, status);
ok(status == RPC_S_OK, "%s: RpcBindingReset failed with error %lu\n", protseq, status);
status = RpcEpResolveBinding(handle, IFoo_v0_0_s_ifspec);
ok(status == RPC_S_OK || broken(status == RPC_S_SERVER_UNAVAILABLE), /* win9x */
"%s: RpcEpResolveBinding failed with error %u\n", protseq, status);
"%s: RpcEpResolveBinding failed with error %lu\n", protseq, status);
status = RpcBindingReset(handle);
ok(status == RPC_S_OK, "%s: RpcBindingReset failed with error %u\n", protseq, status);
ok(status == RPC_S_OK, "%s: RpcBindingReset failed with error %lu\n", protseq, status);
status = RpcBindingFree(&handle);
ok(status == RPC_S_OK, "%s: RpcBindingFree failed with error %u\n", protseq, status);
ok(status == RPC_S_OK, "%s: RpcBindingFree failed with error %lu\n", protseq, status);
status = RpcServerUnregisterIf(NULL, NULL, FALSE);
ok(status == RPC_S_OK, "%s: RpcServerUnregisterIf failed (%u)\n", protseq, status);
ok(status == RPC_S_OK, "%s: RpcServerUnregisterIf failed (%lu)\n", protseq, status);
status = RpcEpUnregister(IFoo_v0_0_s_ifspec, binding_vector, NULL);
ok(status == RPC_S_OK, "%s: RpcEpUnregisterA failed with error %u\n", protseq, status);
ok(status == RPC_S_OK, "%s: RpcEpUnregisterA failed with error %lu\n", protseq, status);
status = RpcBindingVectorFree(&binding_vector);
ok(status == RPC_S_OK, "%s: RpcBindingVectorFree failed with error %u\n", protseq, status);
ok(status == RPC_S_OK, "%s: RpcBindingVectorFree failed with error %lu\n", protseq, status);
}
static BOOL is_process_elevated(void)
@@ -1100,18 +1160,18 @@ static BOOL is_firewall_enabled(void)
hr = CoCreateInstance( &CLSID_NetFwMgr, NULL, CLSCTX_INPROC_SERVER, &IID_INetFwMgr,
(void **)&mgr );
ok( hr == S_OK, "got %08x\n", hr );
ok( hr == S_OK, "got %08lx\n", hr );
if (hr != S_OK) goto done;
hr = INetFwMgr_get_LocalPolicy( mgr, &policy );
ok( hr == S_OK, "got %08x\n", hr );
ok( hr == S_OK, "got %08lx\n", hr );
if (hr != S_OK) goto done;
hr = INetFwPolicy_get_CurrentProfile( policy, &profile );
if (hr != S_OK) goto done;
hr = INetFwProfile_get_FirewallEnabled( profile, &enabled );
ok( hr == S_OK, "got %08x\n", hr );
ok( hr == S_OK, "got %08lx\n", hr );
done:
if (policy) INetFwPolicy_Release( policy );
@@ -1129,7 +1189,6 @@ enum firewall_op
static HRESULT set_firewall( enum firewall_op op )
{
static const WCHAR testW[] = {'r','p','c','r','t','4','_','t','e','s','t',0};
HRESULT hr, init;
INetFwMgr *mgr = NULL;
INetFwPolicy *policy = NULL;
@@ -1147,32 +1206,32 @@ static HRESULT set_firewall( enum firewall_op op )
hr = CoCreateInstance( &CLSID_NetFwMgr, NULL, CLSCTX_INPROC_SERVER, &IID_INetFwMgr,
(void **)&mgr );
ok( hr == S_OK, "got %08x\n", hr );
ok( hr == S_OK, "got %08lx\n", hr );
if (hr != S_OK) goto done;
hr = INetFwMgr_get_LocalPolicy( mgr, &policy );
ok( hr == S_OK, "got %08x\n", hr );
ok( hr == S_OK, "got %08lx\n", hr );
if (hr != S_OK) goto done;
hr = INetFwPolicy_get_CurrentProfile( policy, &profile );
if (hr != S_OK) goto done;
hr = INetFwProfile_get_AuthorizedApplications( profile, &apps );
ok( hr == S_OK, "got %08x\n", hr );
ok( hr == S_OK, "got %08lx\n", hr );
if (hr != S_OK) goto done;
hr = CoCreateInstance( &CLSID_NetFwAuthorizedApplication, NULL, CLSCTX_INPROC_SERVER,
&IID_INetFwAuthorizedApplication, (void **)&app );
ok( hr == S_OK, "got %08x\n", hr );
ok( hr == S_OK, "got %08lx\n", hr );
if (hr != S_OK) goto done;
hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
if (hr != S_OK) goto done;
name = SysAllocString( testW );
name = SysAllocString( L"rpcrt4_test" );
hr = INetFwAuthorizedApplication_put_Name( app, name );
SysFreeString( name );
ok( hr == S_OK, "got %08x\n", hr );
ok( hr == S_OK, "got %08lx\n", hr );
if (hr != S_OK) goto done;
if (op == APP_ADD)
@@ -1200,24 +1259,28 @@ START_TEST( rpc )
static unsigned char np_address[] = ".";
BOOL firewall_enabled = is_firewall_enabled();
test_UuidEqual();
test_UuidFromString();
test_UuidCreate();
test_UuidCreateSequential();
test_DceErrorInqTextA();
test_I_RpcMapWin32Status();
test_RpcStringBindingParseA();
test_RpcExceptionFilter();
if (firewall_enabled && !is_process_elevated())
{
skip("no privileges, skipping tests to avoid firewall dialog\n");
return;
}
UuidConversionAndComparison();
TestDceErrorInqText();
test_towers();
test_I_RpcMapWin32Status();
test_RpcStringBindingParseA();
test_RpcExceptionFilter("I_RpcExceptionFilter");
test_RpcExceptionFilter("RpcExceptionFilter");
test_RpcStringBindingFromBinding();
test_UuidCreate();
test_UuidCreateSequential();
test_RpcBindingFree();
#ifdef __REACTOS__
test_RpcStringFree();
#endif
test_RpcIfInqId();
test_RpcServerInqDefaultPrincName();
test_RpcServerRegisterAuthInfo();
@@ -1226,7 +1289,7 @@ START_TEST( rpc )
HRESULT hr = set_firewall(APP_ADD);
if (hr != S_OK)
{
skip("can't authorize app in firewall %08x\n", hr);
skip("can't authorize app in firewall %08lx\n", hr);
return;
}
}
+10 -10
View File
@@ -34,27 +34,27 @@ static void test_RpcAsyncInitializeHandle(void)
void *unset_ptr;
status = RpcAsyncInitializeHandle((PRPC_ASYNC_STATE)buffer, sizeof(buffer));
ok(status == ERROR_INVALID_PARAMETER, "RpcAsyncInitializeHandle with large Size should have returned ERROR_INVALID_PARAMETER instead of %d\n", status);
ok(status == ERROR_INVALID_PARAMETER, "RpcAsyncInitializeHandle with large Size should have returned ERROR_INVALID_PARAMETER instead of %ld\n", status);
status = RpcAsyncInitializeHandle(&async, sizeof(async) - 1);
ok(status == ERROR_INVALID_PARAMETER, "RpcAsyncInitializeHandle with small Size should have returned ERROR_INVALID_PARAMETER instead of %d\n", status);
ok(status == ERROR_INVALID_PARAMETER, "RpcAsyncInitializeHandle with small Size should have returned ERROR_INVALID_PARAMETER instead of %ld\n", status);
memset(&async, 0xcc, sizeof(async));
memset(&unset_ptr, 0xcc, sizeof(unset_ptr));
status = RpcAsyncInitializeHandle(&async, sizeof(async));
ok(status == RPC_S_OK, "RpcAsyncInitializeHandle failed with error %d\n", status);
ok(status == RPC_S_OK, "RpcAsyncInitializeHandle failed with error %ld\n", status);
ok(async.Size == sizeof(async), "async.Size wrong: %d\n", async.Size);
ok(async.Signature == 0x43595341, "async.Signature should be 0x43595341, but is 0x%x instead\n", async.Signature);
ok(async.Lock == 0, "async.Lock should be 0, but is %d instead\n", async.Lock);
ok(async.Flags == 0, "async.Flags should be 0, but is %d instead\n", async.Flags);
ok(async.Signature == 0x43595341, "async.Signature should be 0x43595341, but is 0x%lx instead\n", async.Signature);
ok(async.Lock == 0, "async.Lock should be 0, but is %ld instead\n", async.Lock);
ok(async.Flags == 0, "async.Flags should be 0, but is %ld instead\n", async.Flags);
ok(async.StubInfo == NULL, "async.StubInfo should be NULL, not %p\n", async.StubInfo);
ok(async.UserInfo == unset_ptr, "async.UserInfo should be unset, not %p\n", async.UserInfo);
ok(async.RuntimeInfo == NULL, "async.RuntimeInfo should be NULL, not %p\n", async.RuntimeInfo);
ok(async.Event == 0xcccccccc, "async.Event should be unset, not %d\n", async.Event);
ok(async.NotificationType == 0xcccccccc, "async.NotificationType should be unset, not %d\n", async.NotificationType);
for (i = 0; i < 4; i++)
ok(async.Reserved[i] == 0x0, "async.Reserved[%d] should be 0x0, not 0x%lx\n", i, async.Reserved[i]);
ok(async.Reserved[i] == 0x0, "async.Reserved[%d] should be 0x0, not 0x%Ix\n", i, async.Reserved[i]);
}
static void test_RpcAsyncGetCallStatus(void)
@@ -63,16 +63,16 @@ static void test_RpcAsyncGetCallStatus(void)
RPC_STATUS status;
status = RpcAsyncInitializeHandle(&async, sizeof(async));
ok(status == RPC_S_OK, "RpcAsyncInitializeHandle failed with error %d\n", status);
ok(status == RPC_S_OK, "RpcAsyncInitializeHandle failed with error %ld\n", status);
status = RpcAsyncGetCallStatus(&async);
todo_wine
ok(status == RPC_S_INVALID_BINDING, "RpcAsyncGetCallStatus should have returned RPC_S_INVALID_BINDING instead of %d\n", status);
ok(status == RPC_S_INVALID_BINDING, "RpcAsyncGetCallStatus should have returned RPC_S_INVALID_BINDING instead of %ld\n", status);
memset(&async, 0, sizeof(async));
status = RpcAsyncGetCallStatus(&async);
todo_wine
ok(status == RPC_S_INVALID_BINDING, "RpcAsyncGetCallStatus should have returned RPC_S_INVALID_BINDING instead of %d\n", status);
ok(status == RPC_S_INVALID_BINDING, "RpcAsyncGetCallStatus should have returned RPC_S_INVALID_BINDING instead of %ld\n", status);
}
START_TEST( rpc_async )
File diff suppressed because it is too large Load Diff
@@ -95,6 +95,29 @@ cpp_quote("#ifndef SKIP_TYPE_DECLS")
int s;
} sun_t;
typedef struct
{
signed char a, b, c, d, e;
} chars_t;
typedef struct
{
int i;
hyper j;
} ints_t;
typedef struct
{
int i;
float f;
} flts_t;
typedef struct
{
int i;
double d;
} dbls_t;
cpp_quote("#endif")
int int_return(void);
@@ -107,6 +130,20 @@ cpp_quote("#endif")
hyper sum_hyper(hyper x, hyper y);
int sum_hyper_int(hyper x, hyper y);
int sum_char_hyper(signed char x, hyper y);
int sum_ints(int a, ints_t x, ints_t y);
int sum_chars(int a, chars_t x, chars_t y);
int sum_flts(int a, flts_t x, flts_t y);
int sum_dbls(int a, dbls_t x, dbls_t y);
int sum_iiff(int x0, int y0, float x1, float y1);
int sum_ifif(int x0, float y0, int x1, float y1);
int sum_iidd(int x0, int y0, double x1, double y1);
int sum_idid(int x0, double y0, int x1, double y1);
int sum_ififififififif(int x0, float y0, int x1, float y1, int x2, float y2, int x3, float y3, int x4, float y4, int x5, float y5, int x6, float y6);
int sum_ididididididid(int x0, double y0, int x1, double y1, int x2, double y2, int x3, double y3, int x4, double y4, int x5, double y5, int x6, double y6);
int sum_idfdifdfifdfidifdidf(int x0, double y0, float z0, double y1, int x1, float z1, double y2, float z2, int x2, float z3, double y3, float z4, int x3, double y4, int x4, float z5, double y5, int x5, double y6, float z6);
int sum_ididididididididididid(int x0, double y0, int x1, double y1, int x2, double y2, int x3, double y3, int x4, double y4, int x5, double y5, int x6, double y6, int x7, double y7, int x8, double y8);
int sum_iidiidiidiidiidiidiidiidiidiidiid(int x0, int x1, double y0, int x2, int x3, double y1, int x4, int x5, double y2, int x6, int x7, double y3, int x8, int x9, double y4, int x10, int x11, double y5, int x12, int x13, double y6, int x14, int x15, double y7, int x16, int x17, double y8);
int sum_iyiy(int x0, hyper y0, int x1, hyper y1);
void square_out(int x, [out] int *y);
void square_ref([in, out] int *x);
int str_length([string] const char *s);
@@ -169,6 +206,30 @@ cpp_quote("#ifndef SKIP_TYPE_DECLS")
[size_is(n)] int ca[];
} cs_t;
typedef struct
{
int n;
[size_is(n)] int *ca;
} cs_blob_t;
typedef struct
{
/* FIXME: widl generates incorrect correlation descriptor and the tests crash */
#if 0
int dummy[1]; /* to make offset to conformant array unique */
#endif
cs_blob_t blob;
} cs_data_t;
typedef struct
{
/* FIXME: widl generates incorrect correlation descriptor and the tests crash */
#if 0
int dummy[2]; /* to make offset to conformant array unique */
#endif
cs_data_t data;
} cs_container_t;
typedef struct
{
int *pn;
@@ -191,6 +252,9 @@ cpp_quote("#endif")
int sum_cpsc(cpsc_t *cpsc);
int get_cpsc(int n, [out] cpsc_t *cpsc );
int sum_complex_array(int n, [size_is(n)] refpint_t pi[]);
int sum_blob([in] cs_blob_t *blob);
int sum_data([in] cs_data_t *data);
int sum_container([in] cs_container_t *container);
cpp_quote("#ifndef SKIP_TYPE_DECLS")
typedef [wire_marshal(int)] void *puint_t;
@@ -458,4 +522,6 @@ cpp_quote("#endif")
ctx_handle_t get_handle();
void get_handle_by_ptr([out] ctx_handle_t *r);
void test_handle(ctx_handle_t ctx_handle);
void test_I_RpcBindingInqLocalClientPID([in] unsigned int protseq, [in] handle_t binding);
}
+28
View File
@@ -412,6 +412,29 @@ typedef enum _THREADINFOCLASS
ThreadActualBasePriority,
ThreadTebInformation,
ThreadCSwitchMon,
// Windows 7
ThreadCSwitchPmu, // 0x1C
ThreadWow64Context,
ThreadGroupInformation,
ThreadUmsInformation,
ThreadCounterProfiling,
ThreadIdealProcessorEx,
// Windows 8
ThreadCpuAccountingInformation, // 0x22
// Windows 8.1
ThreadSuspendCount, // 0x23
// Windows 10
ThreadHeterogeneousCpuPolic, // 0x24
ThreadContainerId,
ThreadNameInformation,
ThreadSelectedCpuSets,
ThreadSystemThreadInformation,
ThreadActualGroupAffinity,
MaxThreadInfoClass
} THREADINFOCLASS;
@@ -1047,6 +1070,11 @@ typedef struct _THREAD_BASIC_INFORMATION
KPRIORITY BasePriority;
} THREAD_BASIC_INFORMATION, *PTHREAD_BASIC_INFORMATION;
typedef struct _THREAD_NAME_INFORMATION
{
UNICODE_STRING ThreadName;
} THREAD_NAME_INFORMATION, *PTHREAD_NAME_INFORMATION;
#ifndef NTOS_MODE_USER
//
+14
View File
@@ -71,6 +71,20 @@ typedef struct _PROCESS_INFORMATION
typedef struct _PROC_THREAD_ATTRIBUTE_LIST *PPROC_THREAD_ATTRIBUTE_LIST, *LPPROC_THREAD_ATTRIBUTE_LIST;
WINBASEAPI
HRESULT
WINAPI
GetThreadDescription(
_In_ HANDLE hThread,
_Outptr_result_z_ PWSTR* ppszThreadDescription);
WINBASEAPI
HRESULT
WINAPI
SetThreadDescription(
_In_ HANDLE hThread,
_In_ PCWSTR lpThreadDescription);
WINBASEAPI
BOOL
WINAPI
+12
View File
@@ -23,6 +23,14 @@
#pragma warning(disable:4820)
#endif
#ifdef RPC_NO_WINDOWS_H
# include <windef.h>
#endif
#ifdef __RPC_WIN64__
# include <pshpack8.h>
#endif
typedef struct tagRPC_ERROR_ENUM_HANDLE
{
ULONG Signature;
@@ -158,6 +166,10 @@ typedef struct _RPC_ASYNC_STATE
#define RpcAsyncGetCallHandle(async) (((PRPC_ASYNC_STATE)async)->RuntimeInfo)
#ifdef __RPC_WIN64__
# include <poppack.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
+2
View File
@@ -324,6 +324,8 @@ RPC_STATUS RPC_ENTRY DceErrorInqTextW(RPC_STATUS e, RPC_WSTR buffer);
RPCRTAPI DECLSPEC_NORETURN void RPC_ENTRY
RpcRaiseException( RPC_STATUS exception );
RPCRTAPI int RPC_ENTRY RpcExceptionFilter(ULONG);
RPCRTAPI RPC_STATUS RPC_ENTRY
RpcBindingCopy( RPC_BINDING_HANDLE SourceBinding, RPC_BINDING_HANDLE* DestinationBinding );
+3
View File
@@ -220,6 +220,9 @@ RPCRTAPI UINT RPC_ENTRY
#endif
RPCRTAPI RPC_STATUS RPC_ENTRY
I_RpcBindingInqLocalClientPID (RPC_BINDING_HANDLE Binding, ULONG *Pid );
RPCRTAPI RPC_STATUS RPC_ENTRY
I_RpcBindingInqTransportType( RPC_BINDING_HANDLE Binding, unsigned int* Type );
+127 -87
View File
@@ -24,6 +24,7 @@
#define __WINE_RPCNDR_H
#include <basetsd.h>
#include <rpcsal.h>
#ifdef __cplusplus
extern "C" {
@@ -35,6 +36,7 @@ extern "C" {
#pragma warning(disable:4255)
#pragma warning(disable:4820)
#endif
#undef CONST_VTBL
#ifdef CONST_VTABLE
# define CONST_VTBL const
@@ -45,7 +47,6 @@ extern "C" {
#ifndef EXTERN_GUID
#ifdef __cplusplus
#define EXTERN_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
EXTERN_C const GUID DECLSPEC_SELECTANY name DECLSPEC_HIDDEN; \
EXTERN_C const GUID DECLSPEC_SELECTANY name = \
{ l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
#else
@@ -54,59 +55,18 @@ extern "C" {
#endif
#endif
/* stupid #if can't handle casts... this __stupidity
is just a workaround for that limitation */
#define __NDR_CHAR_REP_MASK 0x000f
#define __NDR_INT_REP_MASK 0x00f0
#define __NDR_FLOAT_REP_MASK 0xff00
#define __NDR_IEEE_FLOAT 0x0000
#define __NDR_VAX_FLOAT 0x0100
#define __NDR_IBM_FLOAT 0x0300
#define __NDR_ASCII_CHAR 0x0000
#define __NDR_EBCDIC_CHAR 0x0001
#define __NDR_LITTLE_ENDIAN 0x0010
#define __NDR_BIG_ENDIAN 0x0000
/* Mac's are special */
#if defined(__RPC_MAC__)
# define __NDR_LOCAL_DATA_REPRESENTATION \
(__NDR_IEEE_FLOAT | __NDR_ASCII_CHAR | __NDR_BIG_ENDIAN)
#else
# define __NDR_LOCAL_DATA_REPRESENTATION \
(__NDR_IEEE_FLOAT | __NDR_ASCII_CHAR | __NDR_LITTLE_ENDIAN)
#endif
#define __NDR_LOCAL_ENDIAN \
(__NDR_LOCAL_DATA_REPRESENTATION & __NDR_INT_REP_MASK)
/* for convenience, define NDR_LOCAL_IS_BIG_ENDIAN iff it is */
#if __NDR_LOCAL_ENDIAN == __NDR_BIG_ENDIAN
# define NDR_LOCAL_IS_BIG_ENDIAN
#elif __NDR_LOCAL_ENDIAN == __NDR_LITTLE_ENDIAN
# undef NDR_LOCAL_IS_BIG_ENDIAN
#else
# error alien NDR_LOCAL_ENDIAN - Greg botched the defines again, please report
#endif
/* finally, do the casts like Microsoft */
#define NDR_CHAR_REP_MASK ((ULONG) __NDR_CHAR_REP_MASK)
#define NDR_INT_REP_MASK ((ULONG) __NDR_INT_REP_MASK)
#define NDR_FLOAT_REP_MASK ((ULONG) __NDR_FLOAT_REP_MASK)
#define NDR_IEEE_FLOAT ((ULONG) __NDR_IEEE_FLOAT)
#define NDR_VAX_FLOAT ((ULONG) __NDR_VAX_FLOAT)
#define NDR_IBM_FLOAT ((ULONG) __NDR_IBM_FLOAT)
#define NDR_ASCII_CHAR ((ULONG) __NDR_ASCII_CHAR)
#define NDR_EBCDIC_CHAR ((ULONG) __NDR_EBCDIC_CHAR)
#define NDR_LITTLE_ENDIAN ((ULONG) __NDR_LITTLE_ENDIAN)
#define NDR_BIG_ENDIAN ((ULONG) __NDR_BIG_ENDIAN)
#define NDR_LOCAL_DATA_REPRESENTATION ((ULONG) __NDR_LOCAL_DATA_REPRESENTATION)
#define NDR_LOCAL_ENDIAN ((ULONG) __NDR_LOCAL_ENDIAN)
#define NDR_CHAR_REP_MASK ((ULONG)0x000f)
#define NDR_INT_REP_MASK ((ULONG)0x00f0)
#define NDR_FLOAT_REP_MASK ((ULONG)0xff00)
#define NDR_IEEE_FLOAT ((ULONG)0x0000)
#define NDR_VAX_FLOAT ((ULONG)0x0100)
#define NDR_IBM_FLOAT ((ULONG)0x0300)
#define NDR_ASCII_CHAR ((ULONG)0x0000)
#define NDR_EBCDIC_CHAR ((ULONG)0x0001)
#define NDR_LITTLE_ENDIAN ((ULONG)0x0010)
#define NDR_BIG_ENDIAN ((ULONG)0x0000)
#define NDR_LOCAL_DATA_REPRESENTATION NDR_LITTLE_ENDIAN
#define NDR_LOCAL_ENDIAN NDR_LITTLE_ENDIAN
#define TARGET_IS_NT50_OR_LATER 1
#define TARGET_IS_NT40_OR_LATER 1
@@ -118,8 +78,13 @@ typedef INT64 hyper;
typedef UINT64 MIDL_uhyper;
typedef unsigned char boolean;
#ifndef _ERROR_STATUS_T_DEFINED
typedef ULONG error_status_t;
#define _ERROR_STATUS_T_DEFINED
#endif
#define __RPC_CALLEE WINAPI
#define RPC_VAR_ENTRY __cdecl
#define RPC_VAR_ENTRY WINAPIV
#define NDR_SHAREABLE static
#define MIDL_ascii_strlen(s) strlen(s)
@@ -128,8 +93,8 @@ typedef unsigned char boolean;
#define midl_user_free MIDL_user_free
#define midl_user_allocate MIDL_user_allocate
void * __RPC_USER MIDL_user_allocate(SIZE_T);
void __RPC_USER MIDL_user_free(void *);
void * __RPC_USER MIDL_user_allocate(SIZE_T) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(MIDL_user_free) __WINE_MALLOC;
#define NdrFcShort(s) (unsigned char)(s & 0xff), (unsigned char)(s >> 8)
#define NdrFcLong(s) (unsigned char)(s & 0xff), (unsigned char)((s & 0x0000ff00) >> 8), \
@@ -154,15 +119,33 @@ typedef void (__RPC_USER *NDR_RUNDOWN)(void *context);
typedef void (__RPC_USER *NDR_NOTIFY_ROUTINE)(void);
typedef void (__RPC_USER *NDR_NOTIFY2_ROUTINE)(boolean flag);
#ifndef DECLSPEC_UUID
#if defined(_MSC_VER) && defined(__cplusplus)
#define DECLSPEC_UUID(x) __declspec(uuid(x))
#else
#define DECLSPEC_UUID(x)
#endif
#endif /* DECLSPEC_UUID */
#ifdef __REACTOS__
#ifndef __has_declspec_attribute
# if defined(_MSC_VER)
# define __has_declspec_attribute(x) 1
# else
# define __has_declspec_attribute(x) 0
# endif
#endif
#endif
#define MIDL_INTERFACE(x) struct
#ifndef DECLSPEC_NOVTABLE
# if __has_declspec_attribute(novtable) && defined(__cplusplus)
# define DECLSPEC_NOVTABLE __declspec(novtable)
# else
# define DECLSPEC_NOVTABLE
# endif
#endif
#ifndef DECLSPEC_UUID
# if __has_declspec_attribute(uuid) && defined (__cplusplus)
# define DECLSPEC_UUID(x) __declspec(uuid(x))
# else
# define DECLSPEC_UUID(x)
# endif
#endif
#define MIDL_INTERFACE(x) struct DECLSPEC_UUID(x) DECLSPEC_NOVTABLE
struct _MIDL_STUB_MESSAGE;
struct _MIDL_STUB_DESC;
@@ -233,7 +216,7 @@ typedef struct _MIDL_STUB_MESSAGE
ULONG PointerLength;
unsigned int fInDontFree:1;
unsigned int fDontCallFreeInst:1;
unsigned int fInOnlyParam:1;
unsigned int fUnused1 :1;
unsigned int fHasReturn:1;
unsigned int fHasExtensions:1;
unsigned int fHasNewCorrDesc:1;
@@ -244,8 +227,8 @@ typedef struct _MIDL_STUB_MESSAGE
unsigned int fHasMemoryValidateCallback:1;
unsigned int fInFree:1;
unsigned int fNeedMCCP:1;
int fUnused:3;
int fUnused2:16;
int fUnused2:3;
int fUnused3:16;
DWORD dwDestContext;
void *pvDestContext;
NDR_SCONTEXT *SavedContextHandles;
@@ -357,6 +340,39 @@ typedef struct _COMM_FAULT_OFFSETS
short FaultOffset;
} COMM_FAULT_OFFSETS;
typedef enum _IDL_CS_CONVERT
{
IDL_CS_NO_CONVERT,
IDL_CS_IN_PLACE_CONVERT,
IDL_CS_NEW_BUFFER_CONVERT
} IDL_CS_CONVERT;
typedef void (__RPC_USER * CS_TYPE_NET_SIZE_ROUTINE)(RPC_BINDING_HANDLE,ULONG,ULONG,IDL_CS_CONVERT*,ULONG*,error_status_t*);
typedef void (__RPC_USER * CS_TYPE_TO_NETCS_ROUTINE)(RPC_BINDING_HANDLE,ULONG,void*,ULONG,byte*,ULONG*,error_status_t*);
typedef void (__RPC_USER * CS_TYPE_LOCAL_SIZE_ROUTINE)(RPC_BINDING_HANDLE,ULONG,ULONG,IDL_CS_CONVERT*,ULONG*,error_status_t*);
typedef void (__RPC_USER * CS_TYPE_FROM_NETCS_ROUTINE)(RPC_BINDING_HANDLE,ULONG,byte*,ULONG,ULONG,void*,ULONG*,error_status_t*);
typedef void (__RPC_USER * CS_TAG_GETTING_ROUTINE)(RPC_BINDING_HANDLE,int,ULONG*,ULONG*,ULONG*,error_status_t*);
typedef struct _NDR_CS_SIZE_CONVERT_ROUTINES
{
CS_TYPE_NET_SIZE_ROUTINE pfnNetSize;
CS_TYPE_TO_NETCS_ROUTINE pfnToNetCs;
CS_TYPE_LOCAL_SIZE_ROUTINE pfnLocalSize;
CS_TYPE_FROM_NETCS_ROUTINE pfnFromNetCs;
} NDR_CS_SIZE_CONVERT_ROUTINES;
typedef struct _NDR_CS_ROUTINES
{
NDR_CS_SIZE_CONVERT_ROUTINES *pSizeConvertRoutines;
CS_TAG_GETTING_ROUTINE *pTagGettingRoutines;
} NDR_CS_ROUTINES;
typedef struct _NDR_EXPR_DESC
{
const unsigned short *pOffset;
PFORMAT_STRING pFormatExpr;
} NDR_EXPR_DESC;
typedef struct _MIDL_STUB_DESC
{
void *RpcInterfaceInformation;
@@ -380,22 +396,36 @@ typedef struct _MIDL_STUB_DESC
const USER_MARSHAL_ROUTINE_QUADRUPLE *aUserMarshalQuadruple;
const NDR_NOTIFY_ROUTINE *NotifyRoutineTable;
ULONG_PTR mFlags;
ULONG_PTR Reserved3;
ULONG_PTR Reserved4;
ULONG_PTR Reserved5;
const NDR_CS_ROUTINES *CsRoutineTables;
void *ProxyServerInfo;
const NDR_EXPR_DESC *pExprInfo;
} MIDL_STUB_DESC;
typedef const MIDL_STUB_DESC *PMIDL_STUB_DESC;
typedef struct _MIDL_FORMAT_STRING
{
short Pad;
#if defined(__GNUC__)
unsigned char Format[0];
#else
unsigned char Format[1];
#endif
unsigned char Format[];
} MIDL_FORMAT_STRING;
typedef struct _MIDL_METHOD_PROPERTY
{
ULONG Id;
ULONG_PTR Value;
} MIDL_METHOD_PROPERTY, *PMIDL_METHOD_PROPERTY;
typedef struct _MIDL_METHOD_PROPERTY_MAP
{
ULONG Count;
const MIDL_METHOD_PROPERTY *Properties;
} MIDL_METHOD_PROPERTY_MAP, *PMIDL_METHOD_PROPERTY_MAP;
typedef struct _MIDL_INTERFACE_METHOD_PROPERTIES
{
unsigned short MethodCount;
const MIDL_METHOD_PROPERTY_MAP * const *MethodProperties;
} MIDL_INTERFACE_METHOD_PROPERTIES;
typedef struct _MIDL_SYNTAX_INFO
{
RPC_SYNTAX_IDENTIFIER TransferSyntax;
@@ -404,13 +434,13 @@ typedef struct _MIDL_SYNTAX_INFO
const unsigned short* FmtStringOffset;
PFORMAT_STRING TypeString;
const void* aUserMarshalQuadruple;
ULONG_PTR pReserved1;
const MIDL_INTERFACE_METHOD_PROPERTIES *pMethodProperties;
ULONG_PTR pReserved2;
} MIDL_SYNTAX_INFO, *PMIDL_SYNTAX_INFO;
typedef void (__RPC_API *STUB_THUNK)( PMIDL_STUB_MESSAGE );
#ifdef WINE_STRICT_PROTOTYPES
#ifndef WINE_NO_STRICT_PROTOTYPES
typedef LONG (__RPC_API *SERVER_ROUTINE)(void);
#else
typedef LONG (__RPC_API *SERVER_ROUTINE)();
@@ -438,11 +468,17 @@ typedef struct _MIDL_STUBLESS_PROXY_INFO
PMIDL_SYNTAX_INFO pSyntaxInfo;
} MIDL_STUBLESS_PROXY_INFO, *PMIDL_STUBLESS_PROXY_INFO;
#if defined(__i386__) && !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__CYGWIN__)
/* Calling convention for returning structures/unions is different between Windows and gcc on i386 */
typedef LONG_PTR CLIENT_CALL_RETURN;
#else
typedef union _CLIENT_CALL_RETURN
{
void *Pointer;
LONG_PTR Simple;
} CLIENT_CALL_RETURN;
#endif
typedef enum {
STUB_UNMARSHAL,
@@ -491,7 +527,6 @@ typedef struct _FULL_PTR_XLAT_TABLES {
struct IRpcStubBuffer;
typedef ULONG error_status_t;
typedef void * NDR_CCONTEXT;
typedef struct _SCONTEXT_QUEUE {
@@ -669,12 +704,16 @@ RPCRTAPI void RPC_ENTRY
RPCRTAPI unsigned char* RPC_ENTRY
NdrUserMarshalSimpleTypeConvert( ULONG *pFlags, unsigned char *pBuffer, unsigned char FormatChar );
CLIENT_CALL_RETURN RPC_VAR_ENTRY
NdrClientCall2( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
CLIENT_CALL_RETURN RPC_VAR_ENTRY
NdrClientCall( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
CLIENT_CALL_RETURN RPC_VAR_ENTRY
NdrClientCall2( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
CLIENT_CALL_RETURN RPC_VAR_ENTRY
NdrClientCall3( MIDL_STUBLESS_PROXY_INFO *info, ULONG proc, void *retval, ... );
CLIENT_CALL_RETURN RPC_VAR_ENTRY
NdrAsyncClientCall( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
CLIENT_CALL_RETURN RPC_VAR_ENTRY
Ndr64AsyncClientCall( MIDL_STUBLESS_PROXY_INFO *info, ULONG proc, void *retval, ... );
CLIENT_CALL_RETURN RPC_VAR_ENTRY
NdrDcomAsyncClientCall( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
@@ -697,7 +736,7 @@ RPCRTAPI LONG RPC_ENTRY
NdrDcomAsyncStubCall( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, DWORD * pdwStubPhase );
RPCRTAPI void* RPC_ENTRY
NdrAllocate( PMIDL_STUB_MESSAGE pStubMsg, SIZE_T Len ) __WINE_ALLOC_SIZE(2);
NdrAllocate( PMIDL_STUB_MESSAGE pStubMsg, SIZE_T Len ) __WINE_ALLOC_SIZE(2) __WINE_MALLOC;
RPCRTAPI void RPC_ENTRY
NdrClearOutParameters( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, void *ArgAddr );
@@ -706,10 +745,10 @@ RPCRTAPI RPC_STATUS RPC_ENTRY
NdrMapCommAndFaultStatus( PMIDL_STUB_MESSAGE pStubMsg, ULONG *pCommStatus,
ULONG *pFaultStatus, RPC_STATUS Status_ );
RPCRTAPI void* RPC_ENTRY
NdrOleAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1);
RPCRTAPI void RPC_ENTRY
NdrOleFree( void* NodeToFree );
RPCRTAPI void* RPC_ENTRY
NdrOleAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(NdrOleFree) __WINE_MALLOC;
RPCRTAPI void RPC_ENTRY
NdrClientInitialize( PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE pStubMsg,
@@ -732,7 +771,8 @@ RPCRTAPI void RPC_ENTRY
PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDesc,
PFORMAT_STRING pFormat, void *pParamList );
RPCRTAPI unsigned char* RPC_ENTRY
NdrGetBuffer( PMIDL_STUB_MESSAGE stubmsg, ULONG buflen, RPC_BINDING_HANDLE handle );
NdrGetBuffer( PMIDL_STUB_MESSAGE stubmsg, ULONG buflen, RPC_BINDING_HANDLE handle )
__WINE_ALLOC_SIZE(2) __WINE_MALLOC;
RPCRTAPI void RPC_ENTRY
NdrFreeBuffer( PMIDL_STUB_MESSAGE pStubMsg );
RPCRTAPI unsigned char* RPC_ENTRY
@@ -767,14 +807,14 @@ RPCRTAPI void RPC_ENTRY
NdrRpcSsDisableAllocate( PMIDL_STUB_MESSAGE pMessage );
RPCRTAPI void RPC_ENTRY
NdrRpcSmSetClientToOsf( PMIDL_STUB_MESSAGE pMessage );
RPCRTAPI void * RPC_ENTRY
NdrRpcSmClientAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1);
RPCRTAPI void RPC_ENTRY
NdrRpcSmClientFree( void *NodeToFree );
RPCRTAPI void * RPC_ENTRY
NdrRpcSsDefaultAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1);
NdrRpcSmClientAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(NdrRpcSmClientFree) __WINE_MALLOC;
RPCRTAPI void RPC_ENTRY
NdrRpcSsDefaultFree( void *NodeToFree );
RPCRTAPI void * RPC_ENTRY
NdrRpcSsDefaultAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(NdrRpcSsDefaultFree) __WINE_MALLOC;
RPCRTAPI RPC_STATUS RPC_ENTRY
NdrGetUserMarshalInfo( ULONG *pFlags, ULONG InformationLevel, NDR_USER_MARSHAL_INFO *pMarshalInfo );
+41 -47
View File
@@ -17,8 +17,7 @@
*/
#ifndef __RPCPROXY_H_VERSION__
/* FIXME: Find an appropriate version number. I guess something is better than nothing */
#define __RPCPROXY_H_VERSION__ ( 399 )
#define __RPCPROXY_H_VERSION__ (477)
#endif
#ifndef __WINE_RPCPROXY_H
@@ -78,11 +77,7 @@ typedef struct tagCInterfaceProxyHeader
typedef struct tagCInterfaceProxyVtbl
{
CInterfaceProxyHeader header;
#if defined(__GNUC__)
void *Vtbl[0];
#else
void *Vtbl[1];
#endif
void *Vtbl[];
} CInterfaceProxyVtbl;
typedef void (__RPC_STUB *PRPC_STUB_FUNCTION)(
@@ -125,34 +120,22 @@ typedef struct tagCStdPSFactoryBuffer
#define STUB_FORWARDING_FUNCTION NdrStubForwardingFunction
ULONG STDMETHODCALLTYPE CStdStubBuffer2_Release(IRpcStubBuffer *This) DECLSPEC_HIDDEN;
ULONG STDMETHODCALLTYPE NdrCStdStubBuffer2_Release(IRpcStubBuffer *This, IPSFactoryBuffer *pPSF);
#define CStdStubBuffer_DELEGATING_METHODS 0, 0, CStdStubBuffer2_Release, 0, 0, 0, 0, 0, 0, 0
RPCRTAPI HRESULT WINAPI CStdStubBuffer_QueryInterface( IRpcStubBuffer *This, REFIID riid, void **ppvObject );
RPCRTAPI ULONG WINAPI CStdStubBuffer_AddRef( IRpcStubBuffer *This );
RPCRTAPI HRESULT WINAPI CStdStubBuffer_Connect( IRpcStubBuffer *This, IUnknown *pUnkServer );
RPCRTAPI void WINAPI CStdStubBuffer_Disconnect( IRpcStubBuffer *This );
RPCRTAPI HRESULT WINAPI CStdStubBuffer_Invoke( IRpcStubBuffer *This, RPCOLEMESSAGE *pRpcMsg, IRpcChannelBuffer *pRpcChannelBuffer );
RPCRTAPI IRpcStubBuffer * WINAPI CStdStubBuffer_IsIIDSupported( IRpcStubBuffer *This, REFIID riid );
RPCRTAPI ULONG WINAPI CStdStubBuffer_CountRefs( IRpcStubBuffer *This );
RPCRTAPI HRESULT WINAPI CStdStubBuffer_DebugServerQueryInterface( IRpcStubBuffer *This, void **ppv );
RPCRTAPI void WINAPI CStdStubBuffer_DebugServerRelease( IRpcStubBuffer *This, void *pv );
RPCRTAPI ULONG WINAPI NdrCStdStubBuffer_Release( IRpcStubBuffer *This, IPSFactoryBuffer *pPSF );
RPCRTAPI ULONG WINAPI NdrCStdStubBuffer2_Release(IRpcStubBuffer *This, IPSFactoryBuffer *pPSF);
HRESULT WINAPI
CStdStubBuffer_QueryInterface( IRpcStubBuffer *This, REFIID riid, void **ppvObject );
ULONG WINAPI
CStdStubBuffer_AddRef( IRpcStubBuffer *This );
ULONG WINAPI
CStdStubBuffer_Release( IRpcStubBuffer *This ) DECLSPEC_HIDDEN;
ULONG WINAPI
NdrCStdStubBuffer_Release( IRpcStubBuffer *This, IPSFactoryBuffer *pPSF );
HRESULT WINAPI
CStdStubBuffer_Connect( IRpcStubBuffer *This, IUnknown *pUnkServer );
void WINAPI
CStdStubBuffer_Disconnect( IRpcStubBuffer *This );
HRESULT WINAPI
CStdStubBuffer_Invoke( IRpcStubBuffer *This, RPCOLEMESSAGE *pRpcMsg, IRpcChannelBuffer *pRpcChannelBuffer );
IRpcStubBuffer * WINAPI
CStdStubBuffer_IsIIDSupported( IRpcStubBuffer *This, REFIID riid );
ULONG WINAPI
CStdStubBuffer_CountRefs( IRpcStubBuffer *This );
HRESULT WINAPI
CStdStubBuffer_DebugServerQueryInterface( IRpcStubBuffer *This, void **ppv );
void WINAPI
CStdStubBuffer_DebugServerRelease( IRpcStubBuffer *This, void *pv );
ULONG STDMETHODCALLTYPE CStdStubBuffer_Release( IRpcStubBuffer *This );
ULONG STDMETHODCALLTYPE CStdStubBuffer2_Release(IRpcStubBuffer *This);
#define CStdStubBuffer_METHODS \
CStdStubBuffer_QueryInterface, \
@@ -203,8 +186,15 @@ RPCRTAPI HRESULT RPC_ENTRY
RPCRTAPI HRESULT RPC_ENTRY
NdrDllUnregisterProxy( HMODULE hDll, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid );
HRESULT __wine_register_resources( HMODULE module ) DECLSPEC_HIDDEN;
HRESULT __wine_unregister_resources( HMODULE module ) DECLSPEC_HIDDEN;
#ifdef USE_NEW_WINE_REGISTER_RESOURCES // This needs a global fix. See wine git rev 1331a8e.
#define __wine_register_resources __wine_register_resources_new
#define __wine_unregister_resources __wine_unregister_resources_new
HRESULT __cdecl __wine_register_resources(void);
HRESULT __cdecl __wine_unregister_resources(void);
#else
HRESULT __cdecl __wine_register_resources( HMODULE module );
HRESULT __cdecl __wine_unregister_resources( HMODULE module );
#endif
#define CSTDSTUBBUFFERRELEASE(pFactory) \
ULONG WINAPI CStdStubBuffer_Release(IRpcStubBuffer *This) \
@@ -236,10 +226,10 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
/* macros used in dlldata.c files */
#define EXTERN_PROXY_FILE(proxy) \
EXTERN_C const ProxyFileInfo proxy##_ProxyFileInfo DECLSPEC_HIDDEN;
EXTERN_C const ProxyFileInfo proxy##_ProxyFileInfo;
#define PROXYFILE_LIST_START \
const ProxyFileInfo * aProxyFileList[] DECLSPEC_HIDDEN = \
const ProxyFileInfo * aProxyFileList[] = \
{
#define REFERENCE_PROXY_FILE(proxy) \
@@ -254,11 +244,10 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
/* define PROXY_CLSID_IS to specify the CLSID data of the PSFactoryBuffer */
/* define neither to use the GUID of the first interface */
#ifdef PROXY_CLSID
# define CLSID_PSFACTORYBUFFER extern CLSID PROXY_CLSID DECLSPEC_HIDDEN;
# define CLSID_PSFACTORYBUFFER extern CLSID PROXY_CLSID;
#else
# ifdef PROXY_CLSID_IS
# define CLSID_PSFACTORYBUFFER const CLSID CLSID_PSFactoryBuffer DECLSPEC_HIDDEN; \
const CLSID CLSID_PSFactoryBuffer = PROXY_CLSID_IS;
# define CLSID_PSFACTORYBUFFER const CLSID CLSID_PSFactoryBuffer = PROXY_CLSID_IS;
# define PROXY_CLSID CLSID_PSFactoryBuffer
# else
# define CLSID_PSFACTORYBUFFER
@@ -289,8 +278,13 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
#endif
#ifdef WINE_REGISTER_DLL
#ifdef USE_NEW_WINE_REGISTER_RESOURCES
# define WINE_DO_REGISTER_DLL(pfl, clsid) return __wine_register_resources()
# define WINE_DO_UNREGISTER_DLL(pfl, clsid) return __wine_unregister_resources()
#else
# define WINE_DO_REGISTER_DLL(pfl, clsid) return __wine_register_resources( hProxyDll )
# define WINE_DO_UNREGISTER_DLL(pfl, clsid) return __wine_unregister_resources( hProxyDll )
#endif
#else
# define WINE_DO_REGISTER_DLL(pfl, clsid) return NdrDllRegisterProxy( hProxyDll, (pfl), (clsid) )
# define WINE_DO_UNREGISTER_DLL(pfl, clsid) return NdrDllUnregisterProxy( hProxyDll, (pfl), (clsid) )
@@ -299,7 +293,7 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
#define DLLDATA_GETPROXYDLLINFO(pfl, rclsid) \
void RPC_ENTRY GetProxyDllInfo(const ProxyFileInfo ***ppProxyFileInfo, \
const CLSID **ppClsid) DECLSPEC_HIDDEN; \
const CLSID **ppClsid); \
void RPC_ENTRY GetProxyDllInfo(const ProxyFileInfo ***ppProxyFileInfo, \
const CLSID **ppClsid) \
{ \
@@ -308,7 +302,7 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
}
#define DLLGETCLASSOBJECTROUTINE(pfl, factory_clsid, factory) \
HRESULT WINAPI DLLGETCLASSOBJECT_ENTRY(REFCLSID rclsid, REFIID riid, void **ppv) DECLSPEC_HIDDEN; \
HRESULT WINAPI DLLGETCLASSOBJECT_ENTRY(REFCLSID rclsid, REFIID riid, void **ppv); \
HRESULT WINAPI DLLGETCLASSOBJECT_ENTRY(REFCLSID rclsid, REFIID riid, \
void **ppv) \
{ \
@@ -317,16 +311,16 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
}
#define DLLCANUNLOADNOW(factory) \
HRESULT WINAPI DLLCANUNLOADNOW_ENTRY(void) DECLSPEC_HIDDEN; \
HRESULT WINAPI DLLCANUNLOADNOW_ENTRY(void); \
HRESULT WINAPI DLLCANUNLOADNOW_ENTRY(void) \
{ \
return NdrDllCanUnloadNow((factory)); \
}
#define REGISTER_PROXY_DLL_ROUTINES(pfl, factory_clsid) \
HINSTANCE hProxyDll DECLSPEC_HIDDEN = NULL; \
HINSTANCE hProxyDll = NULL; \
\
BOOL WINAPI DLLMAIN_ENTRY(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) DECLSPEC_HIDDEN; \
BOOL WINAPI DLLMAIN_ENTRY(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); \
BOOL WINAPI DLLMAIN_ENTRY(HINSTANCE hinstDLL, DWORD fdwReason, \
LPVOID lpvReserved) \
{ \
@@ -338,13 +332,13 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
return TRUE; \
} \
\
HRESULT WINAPI DLLREGISTERSERVER_ENTRY(void) DECLSPEC_HIDDEN; \
HRESULT WINAPI DLLREGISTERSERVER_ENTRY(void); \
HRESULT WINAPI DLLREGISTERSERVER_ENTRY(void) \
{ \
WINE_DO_REGISTER_DLL( (pfl), (factory_clsid) ); \
} \
\
HRESULT WINAPI DLLUNREGISTERSERVER_ENTRY(void) DECLSPEC_HIDDEN; \
HRESULT WINAPI DLLUNREGISTERSERVER_ENTRY(void); \
HRESULT WINAPI DLLUNREGISTERSERVER_ENTRY(void) \
{ \
WINE_DO_UNREGISTER_DLL( (pfl), (factory_clsid) ); \
@@ -359,7 +353,7 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
#define DLLDATA_ROUTINES(pfl, factory_clsid) \
CLSID_PSFACTORYBUFFER \
CStdPSFactoryBuffer DECLSPEC_HIDDEN gPFactory = { NULL, 0, NULL, 0 }; \
CStdPSFactoryBuffer gPFactory = { NULL, 0, NULL, 0 }; \
DLLDATA_GETPROXYDLLINFO(pfl, factory_clsid) \
DLLGETCLASSOBJECTROUTINE(pfl, factory_clsid, &gPFactory) \
DLLCANUNLOADNOW(&gPFactory) \
+170
View File
@@ -0,0 +1,170 @@
/*
* Copyright (C) 2011 Francois Gouget
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __RPCSAL_H_VERSION__
# define __RPCSAL_H_VERSION__ 100
#endif
#define __RPC__deref_in
#define __RPC__deref_in_opt
#define __RPC__deref_in_string
#define __RPC__deref_in_opt_string
#define __RPC__deref_in_ecount(size)
#define __RPC__deref_in_ecount_opt(size)
#define __RPC__deref_in_ecount_opt_string(size)
#define __RPC__deref_in_ecount_full(size)
#define __RPC__deref_in_ecount_full_opt(size)
#define __RPC__deref_in_ecount_full_string(size)
#define __RPC__deref_in_ecount_full_opt_string(size)
#define __RPC__deref_in_ecount_part(size, length)
#define __RPC__deref_in_ecount_part_opt(size, length)
#define __RPC__deref_in_xcount(size)
#define __RPC__deref_in_xcount_opt(size)
#define __RPC__deref_in_xcount_opt_string(size)
#define __RPC__deref_in_xcount_full(size)
#define __RPC__deref_in_xcount_full_opt(size)
#define __RPC__deref_in_xcount_full_string(size)
#define __RPC__deref_in_xcount_full_opt_string(size)
#define __RPC__deref_in_xcount_part(size, length)
#define __RPC__deref_in_xcount_part_opt(size, length)
#define __RPC__deref_inout
#define __RPC__deref_inout_opt
#define __RPC__deref_inout_string
#define __RPC__deref_inout_opt_string
#define __RPC__deref_inout_ecount_opt(size)
#define __RPC__deref_inout_ecount_full(size)
#define __RPC__deref_inout_ecount_full_opt(size)
#define __RPC__deref_inout_ecount_full_string(size)
#define __RPC__deref_inout_ecount_full_opt_string(size)
#define __RPC__deref_inout_ecount_part_opt(size, length)
#define __RPC__deref_inout_xcount_opt(size)
#define __RPC__deref_inout_xcount_full(size)
#define __RPC__deref_inout_xcount_full_opt(size)
#define __RPC__deref_inout_xcount_full_string(size)
#define __RPC__deref_inout_xcount_full_opt_string(size)
#define __RPC__deref_inout_xcount_part_opt(size, length)
#define __RPC__deref_out
#define __RPC__deref_out_opt
#define __RPC__deref_out_string
#define __RPC__deref_out_opt_string
#define __RPC__deref_out_ecount(size)
#define __RPC__deref_out_ecount_opt(size)
#define __RPC__deref_out_ecount_full(size)
#define __RPC__deref_out_ecount_full_opt(size)
#define __RPC__deref_out_ecount_full_string(size)
#define __RPC__deref_out_ecount_full_opt_string(size)
#define __RPC__deref_out_ecount_part(size, length)
#define __RPC__deref_out_ecount_part_opt(size, length)
#define __RPC__deref_out_xcount(size)
#define __RPC__deref_out_xcount_opt(size)
#define __RPC__deref_out_xcount_full(size)
#define __RPC__deref_out_xcount_full_opt(size)
#define __RPC__deref_out_xcount_full_string(size)
#define __RPC__deref_out_xcount_full_opt_string(size)
#define __RPC__deref_out_xcount_part(size, length)
#define __RPC__deref_out_xcount_part_opt(size, length)
#define __RPC__deref_opt_in
#define __RPC__deref_opt_in_opt
#define __RPC__deref_opt_in_string
#define __RPC__deref_opt_in_opt_string
#define __RPC__deref_opt_inout
#define __RPC__deref_opt_inout_opt
#define __RPC__deref_opt_inout_string
#define __RPC__deref_opt_inout_opt_string
#define __RPC__deref_opt_inout_ecount(size)
#define __RPC__deref_opt_inout_ecount_opt(size)
#define __RPC__deref_opt_inout_ecount_full(size)
#define __RPC__deref_opt_inout_ecount_full_opt(size)
#define __RPC__deref_opt_inout_ecount_full_string(size)
#define __RPC__deref_opt_inout_ecount_full_opt_string(size)
#define __RPC__deref_opt_inout_ecount_part(size, length)
#define __RPC__deref_opt_inout_ecount_part_opt(size, length)
#define __RPC__deref_opt_inout_xcount(size)
#define __RPC__deref_opt_inout_xcount_opt(size)
#define __RPC__deref_opt_inout_xcount_full(size)
#define __RPC__deref_opt_inout_xcount_full_opt(size)
#define __RPC__deref_opt_inout_xcount_full_string(size)
#define __RPC__deref_opt_inout_xcount_full_opt_string(size)
#define __RPC__deref_opt_inout_xcount_part(size, length)
#define __RPC__deref_opt_inout_xcount_part_opt(size, length)
#define __RPC__in
#define __RPC__in_opt
#define __RPC__in_string
#define __RPC__in_opt_string
#define __RPC__in_ecount(size)
#define __RPC__in_ecount_opt(size)
#define __RPC__in_ecount_full(size)
#define __RPC__in_ecount_full_opt(size)
#define __RPC__in_ecount_full_string(size)
#define __RPC__in_ecount_full_opt_string(size)
#define __RPC__in_ecount_part(size, length)
#define __RPC__in_ecount_part_opt(size, length)
#define __RPC__in_xcount(size)
#define __RPC__in_xcount_opt(size)
#define __RPC__in_xcount_full(size)
#define __RPC__in_xcount_full_opt(size)
#define __RPC__in_xcount_full_string(size)
#define __RPC__in_xcount_full_opt_string(size)
#define __RPC__in_xcount_part(size, length)
#define __RPC__in_xcount_part_opt(size, length)
#define __RPC__inout
#define __RPC__inout_opt
#define __RPC__inout_string
#define __RPC__inout_opt_string
#define __RPC__opt_inout
#define __RPC__inout_ecount(size)
#define __RPC__inout_ecount_opt(size)
#define __RPC__inout_ecount_full(size)
#define __RPC__inout_ecount_full_opt(size)
#define __RPC__inout_ecount_full_string(size)
#define __RPC__inout_ecount_full_opt_string(size)
#define __RPC__inout_ecount_part(size, length)
#define __RPC__inout_ecount_part_opt(size, length)
#define __RPC__inout_xcount(size)
#define __RPC__inout_xcount_opt(size)
#define __RPC__inout_xcount_full(size)
#define __RPC__inout_xcount_full_opt(size)
#define __RPC__inout_xcount_full_string(size)
#define __RPC__inout_xcount_full_opt_string(size)
#define __RPC__inout_xcount_part(size, length)
#define __RPC__inout_xcount_part_opt(size, length)
#define __RPC__out
#define __RPC__out_ecount(size)
#define __RPC__out_ecount_full(size)
#define __RPC__out_ecount_full_string(size)
#define __RPC__out_ecount_part(size, length)
#define __RPC__out_xcount(size)
#define __RPC__out_xcount_full(size)
#define __RPC__out_xcount_full_string(size)
#define __RPC__out_xcount_part(size, length)
#define __RPC_full_pointer
#define __RPC_ref_pointer
#define __RPC_string
#define __RPC_unique_pointer
#define __RPC__range(min,max)
#define __RPC__in_range(min,max)
+7
View File
@@ -1973,6 +1973,13 @@ WINBASEAPI BOOL WINAPI NeedCurrentDirectoryForExePathA(LPCSTR ExeName);
WINBASEAPI BOOL WINAPI NeedCurrentDirectoryForExePathW(LPCWSTR ExeName);
#endif
WINBASEAPI
BOOL
WINAPI
GetNamedPipeClientProcessId(
_In_ HANDLE Pipe,
_Out_ PULONG ClientProcessId);
BOOL
WINAPI
GetNamedPipeHandleStateA(
+40
View File
@@ -30,9 +30,21 @@
#include "rpcproxy.h"
#include "atliface.h"
static inline void *image_base(void)
{
#if defined(__MINGW32__) || defined(_MSC_VER)
extern IMAGE_DOS_HEADER __ImageBase;
return (void *)&__ImageBase;
#else
extern IMAGE_NT_HEADERS __wine_spec_nt_header;
return (void *)((__wine_spec_nt_header.OptionalHeader.ImageBase + 0xffff) & ~0xffff);
#endif
}
static const WCHAR atl100W[] = {'a','t','l','1','0','0','.','d','l','l',0};
static const WCHAR regtypeW[] = {'W','I','N','E','_','R','E','G','I','S','T','R','Y',0};
static const WCHAR moduleW[] = {'M','O','D','U','L','E',0};
static const WCHAR systemrootW[] = {'S','y','s','t','e','m','R','o','o','t',0};
struct reg_info
{
@@ -63,6 +75,8 @@ static IRegistrar *create_registrar( HMODULE inst, struct reg_info *info )
GetModuleFileNameW( inst, str, MAX_PATH );
IRegistrar_AddReplacement( info->registrar, moduleW, str );
GetEnvironmentVariableW( systemrootW, str, MAX_PATH );
IRegistrar_AddReplacement( info->registrar, systemrootW, str );
}
return info->registrar;
}
@@ -118,3 +132,29 @@ HRESULT __wine_unregister_resources( HMODULE module )
if (info.registrar) IRegistrar_Release( info.registrar );
return info.result;
}
// FIXME: Workaround until all modules use the new prototype
// See rpcproxy.h
HRESULT __cdecl __wine_register_resources_new(void)
{
struct reg_info info;
info.registrar = NULL;
info.do_register = TRUE;
info.result = S_OK;
EnumResourceNamesW( image_base(), regtypeW, register_resource, (LONG_PTR)&info );
if (info.registrar) IRegistrar_Release( info.registrar );
return info.result;
}
HRESULT __cdecl __wine_unregister_resources_new(void)
{
struct reg_info info;
info.registrar = NULL;
info.do_register = FALSE;
info.result = S_OK;
EnumResourceNamesW( image_base(), regtypeW, register_resource, (LONG_PTR)&info );
if (info.registrar) IRegistrar_Release( info.registrar );
return info.result;
}
+2 -7
View File
@@ -34,11 +34,6 @@
#define ARRAY_SIZE(_x) (sizeof((_x))/sizeof((_x)[0]))
#endif
typedef struct _THREAD_NAME_INFORMATION
{
UNICODE_STRING ThreadName;
} THREAD_NAME_INFORMATION, *PTHREAD_NAME_INFORMATION;
typedef void (CALLBACK *PNTAPCFUNC)(ULONG_PTR,ULONG_PTR,ULONG_PTR);
typedef void (CALLBACK *PRTL_THREAD_START_ROUTINE)(LPVOID);
typedef DWORD (CALLBACK *PRTL_WORK_ITEM_ROUTINE)(LPVOID);
@@ -1883,7 +1878,7 @@ static NTSTATUS tp_threadpool_lock( struct threadpool **out, TP_CALLBACK_ENVIRON
if (environment)
{
#ifndef __REACTOS__ //Windows 7 stuff
#ifndef __REACTOS__ //Windows 7 stuff
/* Validate environment parameters. */
if (environment->Version == 3)
{
@@ -1920,7 +1915,7 @@ static NTSTATUS tp_threadpool_lock( struct threadpool **out, TP_CALLBACK_ENVIRON
pool = default_threadpool;
}
RtlEnterCriticalSection( &pool->cs );
/* Make sure that the threadpool has at least one thread. */
+8
View File
@@ -0,0 +1,8 @@
directories:
dlls/rpcrt4: dll/win32/rpcrt4
dlls/rpcrt4/tests: modules/rostests/winetests/rpcrt4
files:
include/rpcndr.h: sdk/include/psdk/rpcndr.h
include/rpcproxy.h: sdk/include/psdk/rpcproxy.h
tags:
wine: wine-10.0-rc2