+remove_definitions(-D_WIN32_WINNT=0x502)
+add_definitions(-D_WIN32_WINNT=0x600)
+
include_directories(BEFORE ${REACTOS_SOURCE_DIR}/include/reactos/wine)
spec2def(rpcrt4.dll rpcrt4.spec ADD_IMPORTLIB)
add_rpc_files(client epm.idl)
set_module_type(rpcrt4 win32dll)
target_link_libraries(rpcrt4 wine uuid ${PSEH_LIB})
add_delay_importlibs(rpcrt4 iphlpapi wininet secur32 user32)
-add_importlibs(rpcrt4 advapi32 ws2_32 shlwapi msvcrt kernel32 ntdll)
+add_importlibs(rpcrt4 advapi32 advapi32_vista ws2_32 msvcrt kernel32 ntdll)
add_pch(rpcrt4 precomp.h SOURCE)
add_cd_file(TARGET rpcrt4 DESTINATION reactos/system32 FOR all)
strcpyW( keyname, interfaceW );
format_clsid( keyname + strlenW(keyname), proxy->header.piid );
- SHDeleteKeyW(HKEY_CLASSES_ROOT, keyname);
+ RegDeleteTreeW(HKEY_CLASSES_ROOT, keyname);
}
pProxyFileList++;
}
/* unregister clsid */
strcpyW( keyname, clsidW );
strcatW( keyname, clsid );
- SHDeleteKeyW(HKEY_CLASSES_ROOT, keyname);
+ RegDeleteTreeW(HKEY_CLASSES_ROOT, keyname);
return S_OK;
}
static inline cstdstubbuffer_delegating_t *impl_from_delegating( IRpcStubBuffer *iface )
{
- return (cstdstubbuffer_delegating_t*)((char *)iface - FIELD_OFFSET(cstdstubbuffer_delegating_t, stub_buffer));
+ return CONTAINING_RECORD(iface, cstdstubbuffer_delegating_t, stub_buffer);
}
HRESULT CStdStubBuffer_Construct(REFIID riid,
pStubMsg->pPointerQueueState = NULL;
pStubMsg->IgnoreEmbeddedPointers = 0;
pStubMsg->PointerBufferMark = NULL;
+ pStubMsg->CorrDespIncrement = 0;
pStubMsg->uFlags = 0;
pStubMsg->UniquePtrCount = 0;
pStubMsg->pfnAllocate = pStubDesc->pfnAllocate;
if (!handle)
{
ERR("invalid handle %p\n", CContext);
- RpcRaiseException(ERROR_INVALID_HANDLE);
+ RpcRaiseException(RPC_X_SS_CONTEXT_MISMATCH);
}
return handle;
}
RpcRaiseException(status);
}
-static UINT ndr_update_context_handle(NDR_CCONTEXT *CContext,
+/***********************************************************************
+ * RpcSsDontSerializeContext [RPCRT4.@]
+ */
+ void WINAPI RpcSsDontSerializeContext(void)
+{
+ FIXME("stub\n");
+}
+
+static RPC_STATUS ndr_update_context_handle(NDR_CCONTEXT *CContext,
RPC_BINDING_HANDLE hBinding,
const ndr_context_handle *chi)
{
{
che = get_context_entry(*CContext);
if (!che)
- return ERROR_INVALID_HANDLE;
+ return RPC_X_SS_CONTEXT_MISMATCH;
list_remove(&che->entry);
RpcBindingFree(&che->handle);
HeapFree(GetProcessHeap(), 0, che);
{
che = HeapAlloc(GetProcessHeap(), 0, sizeof *che);
if (!che)
- return ERROR_NOT_ENOUGH_MEMORY;
+ return RPC_X_NO_MEMORY;
che->magic = NDR_CONTEXT_HANDLE_MAGIC;
RpcBindingCopy(hBinding, &che->handle);
list_add_tail(&context_handle_list, &che->entry);
*CContext = che;
- return ERROR_SUCCESS;
+ return RPC_S_OK;
}
/***********************************************************************
RPC_BINDING_HANDLE hBinding,
void *pBuff, ULONG DataRepresentation)
{
- UINT r;
+ RPC_STATUS status;
TRACE("*%p=(%p) %p %p %08x\n",
CContext, *CContext, hBinding, pBuff, DataRepresentation);
EnterCriticalSection(&ndr_context_cs);
- r = ndr_update_context_handle(CContext, hBinding, pBuff);
+ status = ndr_update_context_handle(CContext, hBinding, pBuff);
LeaveCriticalSection(&ndr_context_cs);
- if (r)
- RpcRaiseException(r);
+ if (status)
+ RpcRaiseException(status);
}
/***********************************************************************
hBinding, SContext, pBuff, userRunDownIn, CtxGuard, Flags);
if (!binding->server || !binding->Assoc)
- RpcRaiseException(ERROR_INVALID_HANDLE);
+ RpcRaiseException(RPC_S_INVALID_BINDING);
if (Flags & RPC_CONTEXT_HANDLE_FLAGS)
FIXME("unimplemented flags: 0x%x\n", Flags & RPC_CONTEXT_HANDLE_FLAGS);
else
{
if (!RpcContextHandle_IsGuardCorrect(SContext, CtxGuard))
- RpcRaiseException(ERROR_INVALID_HANDLE);
+ RpcRaiseException(RPC_X_SS_CONTEXT_MISMATCH);
memset(ndr, 0, sizeof(*ndr));
RPCRT4_RemoveThreadContextHandle(SContext);
hBinding, pBuff, DataRepresentation, CtxGuard, Flags);
if (!binding->server || !binding->Assoc)
- RpcRaiseException(ERROR_INVALID_HANDLE);
+ RpcRaiseException(RPC_S_INVALID_BINDING);
if (Flags & RPC_CONTEXT_HANDLE_FLAGS)
FIXME("unimplemented flags: 0x%x\n", Flags & RPC_CONTEXT_HANDLE_FLAGS);
if (context_ndr->attributes)
{
ERR("non-null attributes 0x%x\n", context_ndr->attributes);
- status = ERROR_INVALID_HANDLE;
+ status = RPC_X_SS_CONTEXT_MISMATCH;
}
else
status = RpcServerAssoc_FindContextHandle(binding->Assoc,
/* even if we are unmarshalling, as we don't want pointers to be pointed
* to buffer memory */
pEsMsg->StubMsg.IsClient = TRUE;
+ pEsMsg->MesVersion = 1;
}
/***********************************************************************
pEsMsg = HeapAlloc(GetProcessHeap(), 0, sizeof(*pEsMsg));
if (!pEsMsg)
- return ERROR_OUTOFMEMORY;
+ return RPC_S_OUT_OF_MEMORY;
init_MIDL_ES_MESSAGE(pEsMsg);
pEsMsg = HeapAlloc(GetProcessHeap(), 0, sizeof(*pEsMsg));
if (!pEsMsg)
- return ERROR_OUTOFMEMORY;
+ return RPC_S_OUT_OF_MEMORY;
init_MIDL_ES_MESSAGE(pEsMsg);
return RPC_S_OK;
}
+/***********************************************************************
+ * MesBufferHandleReset [RPCRT4.@]
+ */
+RPC_STATUS WINAPI MesBufferHandleReset(handle_t Handle, ULONG HandleStyle,
+ MIDL_ES_CODE Operation, char **Buffer, ULONG BufferSize, ULONG *EncodedSize)
+{
+ MIDL_ES_MESSAGE *pEsMsg = (MIDL_ES_MESSAGE *)Handle;
+
+ TRACE("(%p, %u, %d, %p, %u, %p)\n", Handle, HandleStyle, Operation, Buffer,
+ BufferSize, EncodedSize);
+
+ if (!Handle || !Buffer || !EncodedSize)
+ return RPC_S_INVALID_ARG;
+
+ if (Operation != MES_ENCODE && Operation != MES_DECODE && Operation != MES_ENCODE_NDR64)
+ return RPC_S_INVALID_ARG;
+
+ if (HandleStyle != MES_FIXED_BUFFER_HANDLE && HandleStyle != MES_DYNAMIC_BUFFER_HANDLE)
+ return RPC_S_INVALID_ARG;
+
+ init_MIDL_ES_MESSAGE(pEsMsg);
+
+ pEsMsg->Operation = Operation;
+ pEsMsg->HandleStyle = HandleStyle;
+ if (HandleStyle == MES_FIXED_BUFFER_HANDLE)
+ pEsMsg->Buffer = (unsigned char*)*Buffer;
+ else
+ pEsMsg->pDynBuffer = (unsigned char**)Buffer;
+ pEsMsg->BufferSize = BufferSize;
+ pEsMsg->pEncodedSize = EncodedSize;
+
+ return RPC_S_OK;
+}
+
/***********************************************************************
* MesHandleFree [RPCRT4.@]
*/
return RPC_S_OK;
}
+static RPC_STATUS validate_mes_buffer_pointer(const char *Buffer)
+{
+ if (!Buffer)
+ return RPC_S_INVALID_ARG;
+
+ if (((ULONG_PTR)Buffer & 7) != 0)
+ return RPC_X_INVALID_BUFFER;
+
+ return RPC_S_OK;
+}
+
/***********************************************************************
* MesEncodeFixedBufferHandleCreate [RPCRT4.@]
*/
char *Buffer, ULONG BufferSize, ULONG *pEncodedSize, handle_t *pHandle)
{
MIDL_ES_MESSAGE *pEsMsg;
+ RPC_STATUS status;
TRACE("(%p, %d, %p, %p)\n", Buffer, BufferSize, pEncodedSize, pHandle);
+ if ((status = validate_mes_buffer_pointer(Buffer)))
+ return status;
+
+ if (!pEncodedSize)
+ return RPC_S_INVALID_ARG;
+
+ /* FIXME: check BufferSize too */
+
pEsMsg = HeapAlloc(GetProcessHeap(), 0, sizeof(*pEsMsg));
if (!pEsMsg)
- return ERROR_OUTOFMEMORY;
+ return RPC_S_OUT_OF_MEMORY;
init_MIDL_ES_MESSAGE(pEsMsg);
/***********************************************************************
* MesEncodeDynBufferHandleCreate [RPCRT4.@]
*/
-RPC_STATUS RPC_ENTRY MesEncodeDynBufferHandleCreate(char **ppBuffer,
+RPC_STATUS RPC_ENTRY MesEncodeDynBufferHandleCreate(char **Buffer,
ULONG *pEncodedSize, handle_t *pHandle)
{
- FIXME("%p %p %p stub\n", ppBuffer, pEncodedSize, pHandle);
+ MIDL_ES_MESSAGE *pEsMsg;
+
+ TRACE("(%p, %p, %p)\n", Buffer, pEncodedSize, pHandle);
+
+ if (!pEncodedSize)
+ return RPC_S_INVALID_ARG;
+
+ pEsMsg = HeapAlloc(GetProcessHeap(), 0, sizeof(*pEsMsg));
+ if (!pEsMsg)
+ return RPC_S_OUT_OF_MEMORY;
+
+ init_MIDL_ES_MESSAGE(pEsMsg);
+
+ pEsMsg->Operation = MES_ENCODE;
+ pEsMsg->HandleStyle = MES_DYNAMIC_BUFFER_HANDLE;
+ pEsMsg->pDynBuffer = (unsigned char **)Buffer;
+ pEsMsg->pEncodedSize = pEncodedSize;
+
+ *pHandle = (handle_t)pEsMsg;
+
return RPC_S_OK;
}
char *Buffer, ULONG BufferSize, handle_t *pHandle)
{
MIDL_ES_MESSAGE *pEsMsg;
+ RPC_STATUS status;
TRACE("(%p, %d, %p)\n", Buffer, BufferSize, pHandle);
+ if ((status = validate_mes_buffer_pointer(Buffer)))
+ return status;
+
pEsMsg = HeapAlloc(GetProcessHeap(), 0, sizeof(*pEsMsg));
if (!pEsMsg)
- return ERROR_OUTOFMEMORY;
+ return RPC_S_OUT_OF_MEMORY;
init_MIDL_ES_MESSAGE(pEsMsg);
if (tmpsize < size)
{
ERR("not enough bytes allocated - requested %d, got %d\n", size, tmpsize);
- RpcRaiseException(ERROR_OUTOFMEMORY);
+ RpcRaiseException(RPC_S_OUT_OF_MEMORY);
}
}
else if (pEsMsg->HandleStyle == MES_FIXED_BUFFER_HANDLE)
if (tmpsize < size)
{
ERR("not enough bytes read - requested %d, got %d\n", size, tmpsize);
- RpcRaiseException(ERROR_OUTOFMEMORY);
+ RpcRaiseException(RPC_S_OUT_OF_MEMORY);
}
}
else
NdrUserMarshalMarshall,
0, 0,
/* 0xb7 */
- NdrRangeMarshall
+ NdrRangeMarshall,
+ NdrBaseTypeMarshall,
+ NdrBaseTypeMarshall
};
const NDR_UNMARSHALL NdrUnmarshaller[NDR_TABLE_SIZE] = {
0,
NdrUserMarshalUnmarshall,
0, 0,
/* 0xb7 */
- NdrRangeUnmarshall
+ NdrRangeUnmarshall,
+ NdrBaseTypeUnmarshall,
+ NdrBaseTypeUnmarshall
};
const NDR_BUFFERSIZE NdrBufferSizer[NDR_TABLE_SIZE] = {
0,
NdrUserMarshalBufferSize,
0, 0,
/* 0xb7 */
- NdrRangeBufferSize
+ NdrRangeBufferSize,
+ NdrBaseTypeBufferSize,
+ NdrBaseTypeBufferSize
};
const NDR_MEMORYSIZE NdrMemorySizer[NDR_TABLE_SIZE] = {
0,
NdrUserMarshalMemorySize,
0, 0,
/* 0xb7 */
- NdrRangeMemorySize
+ NdrRangeMemorySize,
+ NdrBaseTypeMemorySize,
+ NdrBaseTypeMemorySize
};
const NDR_FREE NdrFreer[NDR_TABLE_SIZE] = {
0,
NdrUserMarshalFree,
0, 0,
/* 0xb7 */
- NdrRangeFree
+ NdrRangeFree,
+ NdrBaseTypeFree,
+ NdrBaseTypeFree
};
typedef struct _NDR_MEMORY_LIST
*
* NOTES
* The memory block is always 8-byte aligned.
- * If the function is unable to allocate memory an ERROR_OUTOFMEMORY
+ * If the function is unable to allocate memory an RPC_X_NO_MEMORY
* exception is raised.
*/
void * WINAPI NdrAllocate(MIDL_STUB_MESSAGE *pStubMsg, SIZE_T len)
}
p = pStubMsg->pfnAllocate(adjusted_len);
- if (!p) RpcRaiseException(ERROR_OUTOFMEMORY);
+ if (!p) RpcRaiseException(RPC_X_NO_MEMORY);
mem_list = (NDR_MEMORY_LIST *)((char *)p + aligned_len);
mem_list->magic = MEML_MAGIC;
return (*(const ULONG *)pFormat != -1);
}
+static inline PFORMAT_STRING SkipConformance(const PMIDL_STUB_MESSAGE pStubMsg, const PFORMAT_STRING pFormat)
+{
+ return pFormat + 4 + pStubMsg->CorrDespIncrement;
+}
+
static PFORMAT_STRING ReadConformance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
{
align_pointer(&pStubMsg->Buffer, 4);
pStubMsg->MaxCount = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
pStubMsg->Buffer += 4;
TRACE("unmarshalled conformance is %ld\n", pStubMsg->MaxCount);
- if (pStubMsg->fHasNewCorrDesc)
- return pFormat+6;
- else
- return pFormat+4;
+ return SkipConformance(pStubMsg, pFormat);
}
static inline PFORMAT_STRING ReadVariance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat, ULONG MaxValue)
}
done:
- if (pStubMsg->fHasNewCorrDesc)
- return pFormat+6;
- else
- return pFormat+4;
+ return SkipConformance(pStubMsg, pFormat);
}
/* writes the conformance value to the buffer */
finish_conf:
TRACE("resulting conformance is %ld\n", *pCount);
- if (pStubMsg->fHasNewCorrDesc)
- return pFormat+6;
- else
- return pFormat+4;
-}
-static inline PFORMAT_STRING SkipConformance(PMIDL_STUB_MESSAGE pStubMsg,
- PFORMAT_STRING pFormat)
-{
- if (pStubMsg->fHasNewCorrDesc)
- pFormat += 6;
- else
- pFormat += 4;
- return pFormat;
+ return SkipConformance(pStubMsg, pFormat);
}
static inline PFORMAT_STRING SkipVariance(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
}
case RPC_FC_NON_ENCAPSULATED_UNION:
pFormat += 2;
- if (pStubMsg->fHasNewCorrDesc)
- pFormat += 6;
- else
- pFormat += 4;
-
+ pFormat = SkipConformance(pStubMsg, pFormat);
pFormat += *(const SHORT*)pFormat;
return *(const SHORT*)pFormat;
case RPC_FC_IP:
if (umcb->pStubMsg->Buffer < buffer_start ||
umcb->pStubMsg->Buffer > buffer_end)
- return ERROR_INVALID_USER_BUFFER;
+ return RPC_X_INVALID_BUFFER;
umi->u1.Level1.Buffer = umcb->pStubMsg->Buffer;
umi->u1.Level1.BufferSize = buffer_end - umcb->pStubMsg->Buffer;
}
(*ppFormat)++;
- if (pStubMsg->fHasNewCorrDesc)
- *ppFormat += 6;
- else
- *ppFormat += 4;
+ *ppFormat = SkipConformance(pStubMsg, *ppFormat);
return discriminant;
}
*/
void WINAPI NdrCorrelationInitialize(PMIDL_STUB_MESSAGE pStubMsg, void *pMemory, ULONG CacheSize, ULONG Flags)
{
- FIXME("(%p, %p, %d, 0x%x): stub\n", pStubMsg, pMemory, CacheSize, Flags);
+ FIXME("(%p, %p, %d, 0x%x): semi-stub\n", pStubMsg, pMemory, CacheSize, Flags);
+
+ if (pStubMsg->CorrDespIncrement == 0)
+ pStubMsg->CorrDespIncrement = 2; /* size of the normal (non-range) /robust payload */
+
pStubMsg->fHasNewCorrDesc = TRUE;
}
REFIID riid,
LPVOID *obj)
{
- RpcStreamImpl *This = impl_from_IStream(iface);
if (IsEqualGUID(&IID_IUnknown, riid) ||
IsEqualGUID(&IID_ISequentialStream, riid) ||
IsEqualGUID(&IID_IStream, riid)) {
- *obj = This;
- InterlockedIncrement( &This->RefCount );
+ *obj = iface;
+ IStream_AddRef(iface);
return S_OK;
}
+
+ *obj = NULL;
return E_NOINTERFACE;
}
TRACE("size=%d\n", *This->size);
This->pMsg->Buffer = This->data + *This->size;
HeapFree(GetProcessHeap(),0,This);
- return 0;
}
return ref;
}
return S_OK;
}
+static HRESULT WINAPI RpcStream_CopyTo(IStream *iface, IStream *dest,
+ ULARGE_INTEGER len, ULARGE_INTEGER *read, ULARGE_INTEGER *written)
+{
+ RpcStreamImpl *This = impl_from_IStream(iface);
+ FIXME("(%p): stub\n", This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI RpcStream_Commit(IStream *iface, DWORD flags)
+{
+ RpcStreamImpl *This = impl_from_IStream(iface);
+ FIXME("(%p)->(0x%08x): stub\n", This, flags);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI RpcStream_Revert(IStream *iface)
+{
+ RpcStreamImpl *This = impl_from_IStream(iface);
+ FIXME("(%p): stub\n", This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI RpcStream_LockRegion(IStream *iface,
+ ULARGE_INTEGER offset, ULARGE_INTEGER len, DWORD locktype)
+{
+ RpcStreamImpl *This = impl_from_IStream(iface);
+ FIXME("(%p): stub\n", This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI RpcStream_UnlockRegion(IStream *iface,
+ ULARGE_INTEGER offset, ULARGE_INTEGER len, DWORD locktype)
+{
+ RpcStreamImpl *This = impl_from_IStream(iface);
+ FIXME("(%p): stub\n", This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI RpcStream_Stat(IStream *iface, STATSTG *stat, DWORD flag)
+{
+ RpcStreamImpl *This = impl_from_IStream(iface);
+ FIXME("(%p): stub\n", This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI RpcStream_Clone(IStream *iface, IStream **cloned)
+{
+ RpcStreamImpl *This = impl_from_IStream(iface);
+ FIXME("(%p): stub\n", This);
+ return E_NOTIMPL;
+}
+
static const IStreamVtbl RpcStream_Vtbl =
{
RpcStream_QueryInterface,
RpcStream_Write,
RpcStream_Seek,
RpcStream_SetSize,
- NULL, /* CopyTo */
- NULL, /* Commit */
- NULL, /* Revert */
- NULL, /* LockRegion */
- NULL, /* UnlockRegion */
- NULL, /* Stat */
- NULL /* Clone */
+ RpcStream_CopyTo,
+ RpcStream_Commit,
+ RpcStream_Revert,
+ RpcStream_LockRegion,
+ RpcStream_UnlockRegion,
+ RpcStream_Stat,
+ RpcStream_Clone
};
-static LPSTREAM RpcStream_Create(PMIDL_STUB_MESSAGE pStubMsg, BOOL init)
+static HRESULT RpcStream_Create(PMIDL_STUB_MESSAGE pStubMsg, BOOL init, ULONG *size, IStream **stream)
{
RpcStreamImpl *This;
- This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(RpcStreamImpl));
- if (!This) return NULL;
+
+ *stream = NULL;
+ This = HeapAlloc(GetProcessHeap(), 0, sizeof(RpcStreamImpl));
+ if (!This) return E_OUTOFMEMORY;
This->IStream_iface.lpVtbl = &RpcStream_Vtbl;
This->RefCount = 1;
This->pMsg = pStubMsg;
This->size = (LPDWORD)pStubMsg->Buffer;
- This->data = (unsigned char*)(This->size + 1);
+ This->data = pStubMsg->Buffer + sizeof(DWORD);
This->pos = 0;
if (init) *This->size = 0;
TRACE("init size=%d\n", *This->size);
- return (LPSTREAM)This;
+
+ if (size) *size = *This->size;
+ *stream = &This->IStream_iface;
+ return S_OK;
}
static const IID* get_ip_iid(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
pStubMsg->MaxCount = 0;
if (!LoadCOM()) return NULL;
if (pStubMsg->Buffer + sizeof(DWORD) <= (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) {
- stream = RpcStream_Create(pStubMsg, TRUE);
- if (stream) {
+ 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);
- else
- hr = S_OK;
-
IStream_Release(stream);
- if (FAILED(hr))
- RpcRaiseException(hr);
}
+
+ if (FAILED(hr))
+ RpcRaiseException(hr);
}
return NULL;
}
if (!LoadCOM()) return NULL;
*(LPVOID*)ppMemory = NULL;
if (pStubMsg->Buffer + sizeof(DWORD) < (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) {
- stream = RpcStream_Create(pStubMsg, FALSE);
- if (!stream) RpcRaiseException(E_OUTOFMEMORY);
- if (*((RpcStreamImpl *)stream)->size != 0)
- hr = COM_UnmarshalInterface(stream, &IID_NULL, (LPVOID*)ppMemory);
- else
- hr = S_OK;
- IStream_Release(stream);
+ ULONG size;
+
+ hr = RpcStream_Create(pStubMsg, FALSE, &size, &stream);
+ if (hr == S_OK) {
+ if (size != 0)
+ hr = COM_UnmarshalInterface(stream, &IID_NULL, (LPVOID*)ppMemory);
+
+ IStream_Release(stream);
+ }
+
if (FAILED(hr))
RpcRaiseException(hr);
}
#define NDR_TABLE_MASK 127
+static inline BOOL is_oicf_stubdesc(const PMIDL_STUB_DESC pStubDesc)
+{
+ return pStubDesc->Version >= 0x20000;
+}
+
static inline void call_buffer_sizer(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory,
const NDR_PARAM_OIF *param)
{
*phBinding = *pStubMsg->StubDesc->IMPLICIT_HANDLE_INFO.pPrimitiveHandle;
break;
case RPC_FC_CALLBACK_HANDLE: /* implicit callback */
- FIXME("RPC_FC_CALLBACK_HANDLE\n");
+ TRACE("RPC_FC_CALLBACK_HANDLE\n");
+ /* server calls callback procedures only in response to remote call, and most recent
+ binding handle is used. Calling back to a client can potentially result in another
+ callback with different current handle. */
+ *phBinding = I_RpcGetCurrentCallHandle();
break;
case RPC_FC_AUTO_HANDLE: /* implicit auto handle */
/* strictly speaking, it isn't necessary to set hBinding here
if (!pFormat) goto done;
}
- if (pStubDesc->Version >= 0x20000) /* -Oicf format */
+ if (is_oicf_stubdesc(pStubDesc)) /* -Oicf format */
{
const NDR_PROC_PARTIAL_OIF_HEADER *pOIFHeader =
(const NDR_PROC_PARTIAL_OIF_HEADER *)pFormat;
{
/* initialize extra correlation package */
NdrCorrelationInitialize(&stubMsg, NdrCorrCache, sizeof(NdrCorrCache), 0);
+ if (ext_flags.Unused & 0x2) /* has range on conformance */
+ stubMsg.CorrDespIncrement = 12;
}
/* order of phases:
"movq 8(%rsp),%rdx\n\t"
"movq 16(%rsp),%r8\n\t"
"movq 24(%rsp),%r9\n\t"
- "movq %rcx,%xmm0\n\t"
- "movq %rdx,%xmm1\n\t"
- "movq %r8,%xmm2\n\t"
- "movq %r9,%xmm3\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_adjust_cfa_offset -8\n\t")
__ASM_CFI(".cfi_same_value %rbp\n\t")
"ret")
-#elif defined(__arm__)
-LONG_PTR __cdecl call_server_func(SERVER_ROUTINE func, unsigned char * args, unsigned short stack_size)
-{
- FIXME("Not implemented for ARM\n");
- assert(FALSE);
- return 0;
-}
+#elif defined __arm__
+LONG_PTR __cdecl call_server_func(SERVER_ROUTINE func, unsigned char *args, unsigned int stack_size);
+__ASM_GLOBAL_FUNC( call_server_func,
+ ".arm\n\t"
+ "push {r4, r5, LR}\n\t"
+ "mov r4, r0\n\t"
+ "mov r5, SP\n\t"
+ "lsr r3, r2, #2\n\t"
+ "cmp r3, #0\n\t"
+ "beq 5f\n\t"
+ "sub SP, SP, r2\n\t"
+ "tst r3, #1\n\t"
+ "subeq SP, SP, #4\n\t"
+ "1:\tsub r2, r2, #4\n\t"
+ "ldr r0, [r1, r2]\n\t"
+ "str r0, [SP, r2]\n\t"
+ "cmp r2, #0\n\t"
+ "bgt 1b\n\t"
+ "cmp r3, #1\n\t"
+ "bgt 2f\n\t"
+ "pop {r0}\n\t"
+ "b 5f\n\t"
+ "2:\tcmp r3, #2\n\t"
+ "bgt 3f\n\t"
+ "pop {r0-r1}\n\t"
+ "b 5f\n\t"
+ "3:\tcmp r3, #3\n\t"
+ "bgt 4f\n\t"
+ "pop {r0-r2}\n\t"
+ "b 5f\n\t"
+ "4:\tpop {r0-r3}\n\t"
+ "5:\tblx r4\n\t"
+ "mov SP, r5\n\t"
+ "pop {r4, r5, PC}" )
#else
#warning call_server_func not implemented for your architecture
LONG_PTR __cdecl call_server_func(SERVER_ROUTINE func, unsigned char * args, unsigned short stack_size)
unsigned int i;
LONG_PTR *retval_ptr = NULL;
- if (phase == STUBLESS_FREE)
- {
- /* Process the params allocated by the application first */
- for (i = 0; i < number_of_params; i++)
- {
- unsigned char *pArg = pStubMsg->StackTop + params[i].stack_offset;
- if (params[i].attr.MustFree)
- {
- call_freer(pStubMsg, pArg, ¶ms[i]);
- }
- }
- }
-
for (i = 0; i < number_of_params; i++)
{
unsigned char *pArg = pStubMsg->StackTop + params[i].stack_offset;
if (params[i].attr.IsOut || params[i].attr.IsReturn)
call_marshaller(pStubMsg, pArg, ¶ms[i]);
break;
- case STUBLESS_FREE:
+ case STUBLESS_MUSTFREE:
if (params[i].attr.MustFree)
- break;
- else if (params[i].attr.ServerAllocSize)
+ {
+ call_freer(pStubMsg, pArg, ¶ms[i]);
+ }
+ break;
+ case STUBLESS_FREE:
+ if (params[i].attr.ServerAllocSize)
{
HeapFree(GetProcessHeap(), 0, *(void **)pArg);
}
if (pThis)
*(void **)args = ((CStdStubBuffer *)pThis)->pvServerObject;
- if (pStubDesc->Version >= 0x20000) /* -Oicf format */
+ if (is_oicf_stubdesc(pStubDesc))
{
const NDR_PROC_PARTIAL_OIF_HEADER *pOIFHeader = (const NDR_PROC_PARTIAL_OIF_HEADER *)pFormat;
if (ext_flags.HasNewCorrDesc)
{
/* initialize extra correlation package */
- FIXME("new correlation description not implemented\n");
- stubMsg.fHasNewCorrDesc = TRUE;
+ NdrCorrelationInitialize(&stubMsg, NdrCorrCache, sizeof(NdrCorrCache), 0);
+ if (ext_flags.Unused & 0x2) /* has range on conformance */
+ stubMsg.CorrDespIncrement = 12;
}
}
else
pRpcMsg->BufferLength = stubMsg.BufferLength;
/* allocate buffer for [out] and [ret] params */
- Status = I_RpcGetBuffer(pRpcMsg);
+ Status = I_RpcGetBuffer(pRpcMsg);
if (Status)
RpcRaiseException(Status);
stubMsg.Buffer = pRpcMsg->Buffer;
case STUBLESS_INITOUT:
case STUBLESS_CALCSIZE:
case STUBLESS_MARSHAL:
+ case STUBLESS_MUSTFREE:
case STUBLESS_FREE:
retval_ptr = stub_do_args(&stubMsg, pFormat, phase, number_of_params);
break;
if (ext_flags.HasNewCorrDesc)
{
/* free extra correlation package */
- /* NdrCorrelationFree(&stubMsg); */
+ NdrCorrelationFree(&stubMsg);
}
if (Oif_flags.HasPipes)
INTERPRETER_OPT_FLAGS2 ext_flags = { 0 };
/* header for procedure string */
const NDR_PROC_HEADER * pProcHeader = (const NDR_PROC_HEADER *)&pFormat[0];
- /* -Oif or -Oicf generated format */
- BOOL bV2Format = FALSE;
RPC_STATUS status;
TRACE("pStubDesc %p, pFormat %p, ...\n", pStubDesc, pFormat);
}
async_call_data = I_RpcAllocate(sizeof(*async_call_data) + sizeof(MIDL_STUB_MESSAGE) + sizeof(RPC_MESSAGE));
- if (!async_call_data) RpcRaiseException(ERROR_OUTOFMEMORY);
+ if (!async_call_data) RpcRaiseException(RPC_X_NO_MEMORY);
async_call_data->pProcHeader = pProcHeader;
async_call_data->pStubMsg = pStubMsg = (PMIDL_STUB_MESSAGE)(async_call_data + 1);
pFormat = client_get_handle(pStubMsg, pProcHeader, async_call_data->pHandleFormat, &async_call_data->hBinding);
if (!pFormat) goto done;
- bV2Format = (pStubDesc->Version >= 0x20000);
-
- if (bV2Format)
+ if (is_oicf_stubdesc(pStubDesc))
{
const NDR_PROC_PARTIAL_OIF_HEADER *pOIFHeader =
(const NDR_PROC_PARTIAL_OIF_HEADER *)pFormat;
{
/* initialize extra correlation package */
NdrCorrelationInitialize(pStubMsg, async_call_data->NdrCorrCache, sizeof(async_call_data->NdrCorrCache), 0);
+ if (ext_flags.Unused & 0x2) /* has range on conformance */
+ pStubMsg->CorrDespIncrement = 12;
}
/* order of phases:
* RPC_FC_BIND_PRIMITIVE = 32 - Implicit handle using handle_t created by
* calling application
* RPC_FC_AUTO_HANDLE = 33 - Automatic handle
- * RPC_FC_CALLBACK_HANDLE = 34 - undocumented
+ * RPC_FC_CALLBACK_HANDLE = 34 - Implicit handle used for a callback: current handle
+ * from last remote call
*/
unsigned char handle_type;
STUBLESS_CALCSIZE,
STUBLESS_GETBUFFER,
STUBLESS_MARSHAL,
+ STUBLESS_MUSTFREE,
STUBLESS_FREE
};
assoc->Endpoint = RPCRT4_strdupA(Endpoint);
assoc->NetworkOptions = NetworkOptions ? RPCRT4_strdupW(NetworkOptions) : NULL;
assoc->assoc_group_id = 0;
+ UuidCreate(&assoc->http_uuid);
list_init(&assoc->entry);
*assoc_out = assoc;
return RPC_S_OK;
break;
case REJECT_INVALID_CHECKSUM:
ERR("invalid checksum\n");
- status = ERROR_ACCESS_DENIED;
+ status = RPC_S_ACCESS_DENIED;
break;
default:
ERR("rejected bind for reason %d\n", response_hdr->bind_nack.reject_reason);
context_handle = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*context_handle));
if (!context_handle)
- return ERROR_OUTOFMEMORY;
+ return RPC_S_OUT_OF_MEMORY;
context_handle->ctx_guard = CtxGuard;
RtlInitializeResource(&context_handle->rw_lock);
{
RpcAuthInfo *AuthInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(*AuthInfo));
if (!AuthInfo)
- return ERROR_OUTOFMEMORY;
+ return RPC_S_OUT_OF_MEMORY;
AuthInfo->refs = 1;
AuthInfo->AuthnLevel = AuthnLevel;
if (!AuthInfo->nt_identity)
{
HeapFree(GetProcessHeap(), 0, AuthInfo);
- return ERROR_OUTOFMEMORY;
+ return RPC_S_OUT_OF_MEMORY;
}
AuthInfo->nt_identity->Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Password);
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity);
HeapFree(GetProcessHeap(), 0, AuthInfo);
- return ERROR_OUTOFMEMORY;
+ return RPC_S_OUT_OF_MEMORY;
}
}
else
{
*ServerPrincName = (RPC_CSTR)RPCRT4_strdupWtoA(principal);
RpcStringFreeW(&principal);
- if (!*ServerPrincName) return ERROR_OUTOFMEMORY;
+ if (!*ServerPrincName) return RPC_S_OUT_OF_MEMORY;
}
return status;
if (bind->AuthInfo->server_principal_name)
{
*ServerPrincName = RPCRT4_strdupW(bind->AuthInfo->server_principal_name);
- if (!*ServerPrincName) return ERROR_OUTOFMEMORY;
+ if (!*ServerPrincName) return RPC_S_OUT_OF_MEMORY;
}
else *ServerPrincName = NULL;
}
if (status == RPC_S_OK && ServerPrincName)
{
*ServerPrincName = (RPC_CSTR)RPCRT4_strdupWtoA(principal);
- if (!*ServerPrincName && principal) status = ERROR_OUTOFMEMORY;
+ if (!*ServerPrincName && principal) status = RPC_S_OUT_OF_MEMORY;
RpcStringFreeW(&principal);
}
else
{
RpcAuthInfo_Release(new_auth_info);
- r = ERROR_OUTOFMEMORY;
+ r = RPC_S_OUT_OF_MEMORY;
}
}
else
else
{
RpcAuthInfo_Release(new_auth_info);
- r = ERROR_OUTOFMEMORY;
+ r = RPC_S_OUT_OF_MEMORY;
}
}
else
int len = MultiByteToWideChar(CP_ACP, 0, cookie->Buffer, cookie->BufferSize, NULL, 0);
WCHAR *str;
- if (!(str = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)))) return ERROR_OUTOFMEMORY;
+ if (!(str = HeapAlloc(GetProcessHeap(), 0, (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);
}
return RPC_S_OK;
}
+
+/***********************************************************************
+ * I_RpcBindingInqLocalClientPID (RPCRT4.@)
+ */
+
+RPC_STATUS WINAPI I_RpcBindingInqLocalClientPID(RPC_BINDING_HANDLE ClientBinding, ULONG *ClientPID)
+{
+ FIXME("%p %p: stub\n", ClientBinding, ClientPID);
+ return RPC_S_INVALID_BINDING;
+}
int (*write)(RpcConnection *conn, const void *buffer, unsigned int len);
int (*close)(RpcConnection *conn);
void (*cancel_call)(RpcConnection *conn);
+ RPC_STATUS (*is_server_listening)(const char *endpoint);
int (*wait_for_incoming_data)(RpcConnection *conn);
size_t (*get_top_of_tower)(unsigned char *tower_data, const char *networkaddr, const char *endpoint);
RPC_STATUS (*parse_top_of_tower)(const unsigned char *tower_data, size_t tower_size, char **networkaddr, char **endpoint);
RPC_STATUS 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;
RPC_STATUS RPCRT4_ResolveBinding(RpcBinding* Binding, LPCSTR Endpoint) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_SetBindingObject(RpcBinding* Binding, const UUID* ObjectUuid) DECLSPEC_HIDDEN;
lstrcatW( cmd, rpcss );
Wow64DisableWow64FsRedirection( &redir );
- rslt = CreateProcessW( cmd, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi );
+ rslt = CreateProcessW( cmd, cmd, NULL, NULL, FALSE, DETACHED_PROCESS, NULL, NULL, &si, &pi );
Wow64RevertWow64FsRedirection( redir );
if (rslt)
return status;
}
-static void RPCRT4_stop_listen(BOOL auto_listen)
+static RPC_STATUS RPCRT4_stop_listen(BOOL auto_listen)
{
+ RPC_STATUS status = RPC_S_OK;
+
EnterCriticalSection(&listen_cs);
+
+ if (!std_listen)
+ {
+ status = RPC_S_NOT_LISTENING;
+ goto done;
+ }
+
if (auto_listen || (--manual_listen_count == 0))
{
if (listen_count != 0 && --listen_count == 0) {
EnterCriticalSection(&listen_cs);
if (listen_done_event) SetEvent( listen_done_event );
listen_done_event = 0;
- LeaveCriticalSection(&listen_cs);
- return;
+ goto done;
}
assert(listen_count >= 0);
}
+
+done:
LeaveCriticalSection(&listen_cs);
+ return status;
}
static BOOL RPCRT4_protseq_is_endpoint_registered(RpcServerProtseq *protseq, const char *endpoint)
EnterCriticalSection(&server_cs);
LIST_FOR_EACH_ENTRY_SAFE(cps, cursor2, &protseqs, RpcServerProtseq, entry)
{
-#ifndef __REACTOS__
if (listen_count != 0)
RPCRT4_sync_with_server_thread(cps);
-#endif
destroy_serverprotoseq(cps);
}
LeaveCriticalSection(&server_cs);
return RPC_S_WRONG_KIND_OF_BINDING;
}
- RPCRT4_stop_listen(FALSE);
-
- return RPC_S_OK;
+ return RPCRT4_stop_listen(FALSE);
}
/***********************************************************************
TRACE("(%p)\n", Binding);
- EnterCriticalSection(&listen_cs);
- if (manual_listen_count > 0) status = RPC_S_OK;
- LeaveCriticalSection(&listen_cs);
+ if (Binding) {
+ RpcBinding *rpc_binding = (RpcBinding*)Binding;
+ status = RPCRT4_IsServerListening(rpc_binding->Protseq, rpc_binding->Endpoint);
+ }else {
+ EnterCriticalSection(&listen_cs);
+ if (manual_listen_count > 0) status = RPC_S_OK;
+ LeaveCriticalSection(&listen_cs);
+ }
+
return status;
}
return RPC_S_OK;
}
+static char *ncalrpc_pipe_name(const char *endpoint)
+{
+ static const char prefix[] = "\\\\.\\pipe\\lrpc\\";
+ char *pipe_name;
+
+ /* protseq=ncalrpc: supposed to use NT LPC ports,
+ * but we'll implement it with named pipes for now */
+ pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(endpoint));
+ strcat(strcpy(pipe_name, prefix), endpoint);
+ return pipe_name;
+}
+
static RPC_STATUS rpcrt4_ncalrpc_open(RpcConnection* Connection)
{
RpcConnection_np *npc = (RpcConnection_np *) Connection;
return r;
}
+static char *ncacn_pipe_name(const char *endpoint)
+{
+ static const char prefix[] = "\\\\.";
+ char *pipe_name;
+
+ /* protseq=ncacn_np: named pipes */
+ pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(endpoint));
+ strcat(strcpy(pipe_name, prefix), endpoint);
+ return pipe_name;
+}
+
static RPC_STATUS rpcrt4_ncacn_np_open(RpcConnection* Connection)
{
RpcConnection_np *npc = (RpcConnection_np *) Connection;
}
static void rpcrt4_conn_np_handoff(RpcConnection_np *old_npc, RpcConnection_np *new_npc)
-{
+{
/* because of the way named pipes work, we'll transfer the connected pipe
* to the child, then reopen the server binding to continue listening */
return status;
}
+static RPC_STATUS is_pipe_listening(const char *pipe_name)
+{
+ return WaitNamedPipeA(pipe_name, 1) ? RPC_S_OK : RPC_S_NOT_LISTENING;
+}
+
+static RPC_STATUS rpcrt4_ncacn_np_is_server_listening(const char *endpoint)
+{
+ char *pipe_name;
+ RPC_STATUS status;
+
+ pipe_name = ncacn_pipe_name(endpoint);
+ status = is_pipe_listening(pipe_name);
+ I_RpcFree(pipe_name);
+ return status;
+}
+
+static RPC_STATUS rpcrt4_ncalrpc_np_is_server_listening(const char *endpoint)
+{
+ char *pipe_name;
+ RPC_STATUS status;
+
+ pipe_name = ncalrpc_pipe_name(endpoint);
+ status = is_pipe_listening(pipe_name);
+ I_RpcFree(pipe_name);
+ return status;
+}
+
static RPC_STATUS rpcrt4_ncalrpc_handoff(RpcConnection *old_conn, RpcConnection *new_conn)
{
RPC_STATUS status;
strcat(strcpy(pname, prefix), old_conn->Endpoint);
status = rpcrt4_conn_create_pipe(old_conn, pname);
I_RpcFree(pname);
-
+
return status;
}
HANDLE *objs = prev_array;
RpcConnection_np *conn;
RpcServerProtseq_np *npps = CONTAINING_RECORD(protseq, RpcServerProtseq_np, common);
-
+
EnterCriticalSection(&protseq->cs);
-
+
/* open and count connections */
*count = 1;
conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
(*count)++;
conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common);
}
-
+
/* make array of connections */
if (objs)
objs = HeapReAlloc(GetProcessHeap(), 0, objs, *count*sizeof(HANDLE));
LeaveCriticalSection(&protseq->cs);
return NULL;
}
-
+
objs[0] = npps->mgr_event;
*count = 1;
conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
DWORD res;
RpcConnection *cconn;
RpcConnection_np *conn;
-
+
if (!objs)
return -1;
else
{
ERR("unexpected protocol family %d\n", ai->ai_family);
+ freeaddrinfo(ai);
return 0;
}
conn->Next = protseq->conn;
protseq->conn = first_connection;
LeaveCriticalSection(&protseq->cs);
-
+
TRACE("listening on %s\n", endpoint);
return RPC_S_OK;
}
return -1;
else if (r > 0)
bytes_read += r;
+ else if (errno == EINTR)
+ continue;
else if (errno != EAGAIN)
{
WARN("recv() failed: %s\n", strerror(errno));
int r = send(tcpc->sock, (const char *)buffer + bytes_written, count - bytes_written, 0);
if (r >= 0)
bytes_written += r;
+ else if (errno == EINTR)
+ continue;
else if (errno != EAGAIN)
return -1;
else
rpcrt4_sock_wait_cancel(tcpc);
}
+static RPC_STATUS rpcrt4_conn_tcp_is_server_listening(const char *endpoint)
+{
+ FIXME("\n");
+ return RPC_S_ACCESS_DENIED;
+}
+
static int rpcrt4_conn_tcp_wait_for_incoming_data(RpcConnection *Connection)
{
RpcConnection_tcp *tcpc = (RpcConnection_tcp *) Connection;
RpcServerProtseq_sock *sockps = CONTAINING_RECORD(protseq, RpcServerProtseq_sock, common);
EnterCriticalSection(&protseq->cs);
-
+
/* open and count connections */
*count = 1;
conn = (RpcConnection_tcp *)protseq->conn;
(*count)++;
conn = (RpcConnection_tcp *)conn->common.Next;
}
-
+
/* make array of connections */
if (poll_info)
poll_info = HeapReAlloc(GetProcessHeap(), 0, poll_info, *count*sizeof(*poll_info));
unsigned int i;
RpcConnection *cconn;
RpcConnection_tcp *conn;
-
+
if (!poll_info)
return -1;
-
+
ret = poll(poll_info, count, -1);
if (ret < 0)
{
LONG refs;
HANDLE completion_event;
WORD async_result;
- INTERNET_BUFFERSA inet_buffers;
+ INTERNET_BUFFERSW inet_buffers;
CRITICAL_SECTION cs;
} RpcHttpAsyncData;
TRACE("async data = %p\n", httpc->async_data);
httpc->cancel_event = CreateEventW(NULL, FALSE, FALSE, NULL);
httpc->async_data->refs = 1;
- httpc->async_data->inet_buffers.dwStructSize = sizeof(INTERNET_BUFFERSA);
+ httpc->async_data->inet_buffers.dwStructSize = sizeof(INTERNET_BUFFERSW);
httpc->async_data->inet_buffers.lpvBuffer = NULL;
InitializeCriticalSection(&httpc->async_data->cs);
httpc->async_data->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": RpcHttpAsyncData.cs");
return RPC_S_OK;
}
+static int rpcrt4_http_async_read(HINTERNET req, RpcHttpAsyncData *async_data, HANDLE cancel_event,
+ void *buffer, unsigned int count)
+{
+ char *buf = buffer;
+ BOOL ret;
+ unsigned int bytes_left = count;
+ RPC_STATUS status = RPC_S_OK;
+
+ async_data->inet_buffers.lpvBuffer = HeapAlloc(GetProcessHeap(), 0, count);
+
+ while (bytes_left)
+ {
+ async_data->inet_buffers.dwBufferLength = bytes_left;
+ prepare_async_request(async_data);
+ ret = InternetReadFileExW(req, &async_data->inet_buffers, IRF_ASYNC, 0);
+ status = wait_async_request(async_data, ret, cancel_event);
+ if (status != RPC_S_OK)
+ {
+ if (status == RPC_S_CALL_CANCELLED)
+ TRACE("call cancelled\n");
+ break;
+ }
+
+ if (!async_data->inet_buffers.dwBufferLength)
+ break;
+ memcpy(buf, async_data->inet_buffers.lpvBuffer,
+ async_data->inet_buffers.dwBufferLength);
+
+ bytes_left -= async_data->inet_buffers.dwBufferLength;
+ buf += async_data->inet_buffers.dwBufferLength;
+ }
+
+ HeapFree(GetProcessHeap(), 0, async_data->inet_buffers.lpvBuffer);
+ async_data->inet_buffers.lpvBuffer = NULL;
+
+ TRACE("%p %p %u -> %u\n", req, buffer, count, status);
+ return status == RPC_S_OK ? count : -1;
+}
+
static RPC_STATUS send_echo_request(HINTERNET req, RpcHttpAsyncData *async_data, HANDLE cancel_event)
{
- DWORD bytes_read;
BYTE buf[20];
BOOL ret;
RPC_STATUS status;
status = rpcrt4_http_check_response(req);
if (status != RPC_S_OK) return status;
- InternetReadFile(req, buf, sizeof(buf), &bytes_read);
+ rpcrt4_http_async_read(req, async_data, cancel_event, buf, sizeof(buf));
/* FIXME: do something with retrieved data */
return RPC_S_OK;
}
+static RPC_STATUS insert_content_length_header(HINTERNET request, DWORD len)
+{
+ static const WCHAR fmtW[] =
+ {'C','o','n','t','e','n','t','-','L','e','n','g','t','h',':',' ','%','u','\r','\n',0};
+ WCHAR header[sizeof(fmtW) / sizeof(fmtW[0]) + 10];
+
+ sprintfW(header, fmtW, len);
+ if ((HttpAddRequestHeadersW(request, header, -1, HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD))) return RPC_S_OK;
+ return RPC_S_SERVER_UNAVAILABLE;
+}
+
/* prepare the in pipe for use by RPC packets */
static RPC_STATUS rpcrt4_http_prepare_in_pipe(HINTERNET in_request, RpcHttpAsyncData *async_data, HANDLE cancel_event,
const UUID *connection_uuid, const UUID *in_pipe_uuid,
buffers_in.dwStructSize = sizeof(buffers_in);
/* FIXME: get this from the registry */
buffers_in.dwBufferTotal = 1024 * 1024 * 1024; /* 1Gb */
+ status = insert_content_length_header(in_request, buffers_in.dwBufferTotal);
+ if (status != RPC_S_OK) return status;
+
prepare_async_request(async_data);
ret = HttpSendRequestExW(in_request, &buffers_in, NULL, 0, 0);
status = wait_async_request(async_data, ret, cancel_event);
return RPC_S_OK;
}
-static RPC_STATUS rpcrt4_http_read_http_packet(HINTERNET request, RpcPktHdr *hdr, BYTE **data)
+static RPC_STATUS rpcrt4_http_read_http_packet(HINTERNET request, RpcHttpAsyncData *async_data,
+ HANDLE cancel_event, RpcPktHdr *hdr, BYTE **data)
{
- BOOL ret;
- DWORD bytes_read;
unsigned short data_len;
+ unsigned int size;
- ret = InternetReadFile(request, hdr, sizeof(hdr->common), &bytes_read);
- if (!ret)
+ if (rpcrt4_http_async_read(request, async_data, cancel_event, hdr, sizeof(hdr->common)) < 0)
return RPC_S_SERVER_UNAVAILABLE;
if (hdr->common.ptype != PKT_HTTP || hdr->common.frag_len < sizeof(hdr->http))
{
return RPC_S_PROTOCOL_ERROR;
}
- ret = InternetReadFile(request, &hdr->common + 1, sizeof(hdr->http) - sizeof(hdr->common), &bytes_read);
- if (!ret)
+ size = sizeof(hdr->http) - sizeof(hdr->common);
+ if (rpcrt4_http_async_read(request, async_data, cancel_event, &hdr->common + 1, size) < 0)
return RPC_S_SERVER_UNAVAILABLE;
data_len = hdr->common.frag_len - sizeof(hdr->http);
*data = HeapAlloc(GetProcessHeap(), 0, data_len);
if (!*data)
return RPC_S_OUT_OF_RESOURCES;
- ret = InternetReadFile(request, *data, data_len, &bytes_read);
- if (!ret)
+ if (rpcrt4_http_async_read(request, async_data, cancel_event, *data, data_len) < 0)
{
HeapFree(GetProcessHeap(), 0, *data);
return RPC_S_SERVER_UNAVAILABLE;
if (!RPCRT4_IsValidHttpPacket(hdr, *data, data_len))
{
ERR("invalid http packet\n");
+ HeapFree(GetProcessHeap(), 0, *data);
return RPC_S_PROTOCOL_ERROR;
}
BYTE *data_from_server;
RpcPktHdr pkt_from_server;
ULONG field1, field3;
- DWORD bytes_read;
BYTE buf[20];
if (!authorized)
if (status != RPC_S_OK) return status;
}
else
- InternetReadFile(out_request, buf, sizeof(buf), &bytes_read);
+ rpcrt4_http_async_read(out_request, async_data, cancel_event, buf, sizeof(buf));
hdr = RPCRT4_BuildHttpConnectHeader(TRUE, connection_uuid, out_pipe_uuid, NULL);
if (!hdr) return RPC_S_OUT_OF_RESOURCES;
+ status = insert_content_length_header(out_request, hdr->common.frag_len);
+ if (status != RPC_S_OK)
+ {
+ RPCRT4_FreeHeader(hdr);
+ return status;
+ }
+
TRACE("sending HTTP connect header to server\n");
prepare_async_request(async_data);
ret = HttpSendRequestW(out_request, NULL, 0, hdr, hdr->common.frag_len);
status = rpcrt4_http_check_response(out_request);
if (status != RPC_S_OK) return status;
- status = rpcrt4_http_read_http_packet(out_request, &pkt_from_server,
- &data_from_server);
+ status = rpcrt4_http_read_http_packet(out_request, async_data, cancel_event,
+ &pkt_from_server, &data_from_server);
if (status != RPC_S_OK) return status;
status = RPCRT4_ParseHttpPrepareHeader1(&pkt_from_server, data_from_server,
&field1);
for (;;)
{
- status = rpcrt4_http_read_http_packet(out_request, &pkt_from_server,
- &data_from_server);
+ status = rpcrt4_http_read_http_packet(out_request, async_data, cancel_event,
+ &pkt_from_server, &data_from_server);
if (status != RPC_S_OK) return status;
if (pkt_from_server.http.flags != 0x0001) break;
return status;
}
-static void drain_content(HINTERNET request)
+static void drain_content(HINTERNET request, RpcHttpAsyncData *async_data, HANDLE cancel_event)
{
DWORD count, len = 0, size = sizeof(len);
char buf[2048];
for (;;)
{
count = min(sizeof(buf), len);
- if (!InternetReadFile(request, buf, count, &count) || !count) return;
+ if (rpcrt4_http_async_read(request, async_data, cancel_event, buf, count) <= 0) return;
len -= count;
}
}
status = rpcrt4_http_check_response(request);
if (status != RPC_S_OK && status != ERROR_ACCESS_DENIED) break;
- drain_content(request);
+ drain_content(request, httpc->async_data, httpc->cancel_event);
}
if (info->scheme != RPC_C_HTTP_AUTHN_SCHEME_BASIC)
- HttpAddRequestHeadersW(request, authW, -1, HTTP_ADDREQ_FLAG_REPLACE);
+ HttpAddRequestHeadersW(request, authW, -1, HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD);
destroy_authinfo(info);
return status;
}
-static RPC_STATUS insert_cookie_header(HINTERNET request, const WCHAR *value)
-{
- static const WCHAR cookieW[] = {'C','o','o','k','i','e',':',' '};
- WCHAR *header, *ptr;
- int len;
- RPC_STATUS status = RPC_S_SERVER_UNAVAILABLE;
-
- if (!value) return RPC_S_OK;
-
- len = strlenW(value);
- if ((header = HeapAlloc(GetProcessHeap(), 0, sizeof(cookieW) + (len + 3) * sizeof(WCHAR))))
- {
- memcpy(header, cookieW, sizeof(cookieW));
- ptr = header + sizeof(cookieW) / sizeof(cookieW[0]);
- memcpy(ptr, value, len * sizeof(WCHAR));
- ptr[len++] = '\r';
- ptr[len++] = '\n';
- ptr[len] = 0;
- if ((HttpAddRequestHeadersW(request, header, -1, HTTP_ADDREQ_FLAG_ADD_IF_NEW))) status = RPC_S_OK;
- HeapFree(GetProcessHeap(), 0, header);
- }
- return status;
-}
-
static BOOL has_credentials(RpcConnection_http *httpc)
{
RPC_HTTP_TRANSPORT_CREDENTIALS_W *creds;
(httpc->common.QOS->qos->u.HttpCredentials->Flags & RPC_C_HTTP_FLAG_USE_SSL);
}
+static RPC_STATUS set_auth_cookie(RpcConnection_http *httpc, const WCHAR *value)
+{
+ static WCHAR httpW[] = {'h','t','t','p',0};
+ static WCHAR httpsW[] = {'h','t','t','p','s',0};
+ URL_COMPONENTSW uc;
+ DWORD len;
+ WCHAR *url;
+ BOOL ret;
+
+ if (!value) return RPC_S_OK;
+
+ uc.dwStructSize = sizeof(uc);
+ uc.lpszScheme = is_secure(httpc) ? httpsW : httpW;
+ uc.dwSchemeLength = 0;
+ uc.lpszHostName = httpc->servername;
+ uc.dwHostNameLength = 0;
+ uc.nPort = 0;
+ uc.lpszUserName = NULL;
+ uc.dwUserNameLength = 0;
+ uc.lpszPassword = NULL;
+ uc.dwPasswordLength = 0;
+ uc.lpszUrlPath = NULL;
+ uc.dwUrlPathLength = 0;
+ uc.lpszExtraInfo = NULL;
+ uc.dwExtraInfoLength = 0;
+
+ if (!InternetCreateUrlW(&uc, 0, NULL, &len) && (GetLastError() != ERROR_INSUFFICIENT_BUFFER))
+ return RPC_S_SERVER_UNAVAILABLE;
+
+ if (!(url = HeapAlloc(GetProcessHeap(), 0, len))) return RPC_S_OUT_OF_MEMORY;
+
+ len = len / sizeof(WCHAR) - 1;
+ if (!InternetCreateUrlW(&uc, 0, url, &len))
+ {
+ HeapFree(GetProcessHeap(), 0, url);
+ return RPC_S_SERVER_UNAVAILABLE;
+ }
+
+ ret = InternetSetCookieW(url, NULL, value);
+ HeapFree(GetProcessHeap(), 0, url);
+ if (!ret) return RPC_S_SERVER_UNAVAILABLE;
+
+ return RPC_S_OK;
+}
+
static RPC_STATUS rpcrt4_ncacn_http_open(RpcConnection* Connection)
{
RpcConnection_http *httpc = (RpcConnection_http *)Connection;
httpc->async_data->completion_event = CreateEventW(NULL, FALSE, FALSE, NULL);
- status = UuidCreate(&httpc->connection_uuid);
- status = UuidCreate(&httpc->in_pipe_uuid);
- status = UuidCreate(&httpc->out_pipe_uuid);
+ UuidCreate(&httpc->connection_uuid);
+ UuidCreate(&httpc->in_pipe_uuid);
+ UuidCreate(&httpc->out_pipe_uuid);
status = rpcrt4_http_internet_connect(httpc);
if (status != RPC_S_OK)
if (secure) flags |= INTERNET_FLAG_SECURE;
if (credentials) flags |= INTERNET_FLAG_NO_AUTH;
+ status = set_auth_cookie(httpc, Connection->CookieAuth);
+ if (status != RPC_S_OK)
+ {
+ HeapFree(GetProcessHeap(), 0, url);
+ return status;
+ }
httpc->in_request = HttpOpenRequestW(httpc->session, wszVerbIn, url, NULL, NULL, wszAcceptTypes,
flags, (DWORD_PTR)httpc->async_data);
if (!httpc->in_request)
HeapFree(GetProcessHeap(), 0, url);
return RPC_S_SERVER_UNAVAILABLE;
}
- status = insert_cookie_header(httpc->in_request, Connection->CookieAuth);
- if (status != RPC_S_OK)
- {
- HeapFree(GetProcessHeap(), 0, url);
- return status;
- }
+
if (credentials)
{
status = authorize_request(httpc, httpc->in_request);
HeapFree(GetProcessHeap(), 0, url);
return status;
}
- drain_content(httpc->in_request);
+ drain_content(httpc->in_request, httpc->async_data, httpc->cancel_event);
}
httpc->out_request = HttpOpenRequestW(httpc->session, wszVerbOut, url, NULL, NULL, wszAcceptTypes,
ERR("HttpOpenRequestW failed with error %d\n", GetLastError());
return RPC_S_SERVER_UNAVAILABLE;
}
- status = insert_cookie_header(httpc->out_request, Connection->CookieAuth);
- if (status != RPC_S_OK)
- return status;
if (credentials)
{
void *buffer, unsigned int count)
{
RpcConnection_http *httpc = (RpcConnection_http *) Connection;
- char *buf = buffer;
- BOOL ret;
- unsigned int bytes_left = count;
- RPC_STATUS status = RPC_S_OK;
-
- httpc->async_data->inet_buffers.lpvBuffer = HeapAlloc(GetProcessHeap(), 0, count);
-
- while (bytes_left)
- {
- httpc->async_data->inet_buffers.dwBufferLength = bytes_left;
- prepare_async_request(httpc->async_data);
- ret = InternetReadFileExA(httpc->out_request, &httpc->async_data->inet_buffers, IRF_ASYNC, 0);
- status = wait_async_request(httpc->async_data, ret, httpc->cancel_event);
- if(status != RPC_S_OK) {
- if(status == RPC_S_CALL_CANCELLED)
- TRACE("call cancelled\n");
- break;
- }
-
- if(!httpc->async_data->inet_buffers.dwBufferLength)
- break;
- memcpy(buf, httpc->async_data->inet_buffers.lpvBuffer,
- httpc->async_data->inet_buffers.dwBufferLength);
-
- bytes_left -= httpc->async_data->inet_buffers.dwBufferLength;
- buf += httpc->async_data->inet_buffers.dwBufferLength;
- }
-
- HeapFree(GetProcessHeap(), 0, httpc->async_data->inet_buffers.lpvBuffer);
- httpc->async_data->inet_buffers.lpvBuffer = NULL;
-
- TRACE("%p %p %u -> %u\n", httpc->out_request, buffer, count, status);
- return status == RPC_S_OK ? count : -1;
+ return rpcrt4_http_async_read(httpc->out_request, httpc->async_data, httpc->cancel_event, buffer, count);
}
static RPC_STATUS rpcrt4_ncacn_http_receive_fragment(RpcConnection *Connection, RpcPktHdr **Header, void **Payload)
SetEvent(httpc->cancel_event);
}
+static RPC_STATUS rpcrt4_ncacn_http_is_server_listening(const char *endpoint)
+{
+ FIXME("\n");
+ return RPC_S_ACCESS_DENIED;
+}
+
static int rpcrt4_ncacn_http_wait_for_incoming_data(RpcConnection *Connection)
{
RpcConnection_http *httpc = (RpcConnection_http *) Connection;
rpcrt4_conn_np_write,
rpcrt4_conn_np_close,
rpcrt4_conn_np_cancel_call,
+ rpcrt4_ncacn_np_is_server_listening,
rpcrt4_conn_np_wait_for_incoming_data,
rpcrt4_ncacn_np_get_top_of_tower,
rpcrt4_ncacn_np_parse_top_of_tower,
rpcrt4_conn_np_write,
rpcrt4_conn_np_close,
rpcrt4_conn_np_cancel_call,
+ rpcrt4_ncalrpc_np_is_server_listening,
rpcrt4_conn_np_wait_for_incoming_data,
rpcrt4_ncalrpc_get_top_of_tower,
rpcrt4_ncalrpc_parse_top_of_tower,
rpcrt4_conn_tcp_write,
rpcrt4_conn_tcp_close,
rpcrt4_conn_tcp_cancel_call,
+ rpcrt4_conn_tcp_is_server_listening,
rpcrt4_conn_tcp_wait_for_incoming_data,
rpcrt4_ncacn_ip_tcp_get_top_of_tower,
rpcrt4_ncacn_ip_tcp_parse_top_of_tower,
rpcrt4_ncacn_http_write,
rpcrt4_ncacn_http_close,
rpcrt4_ncacn_http_cancel_call,
+ rpcrt4_ncacn_http_is_server_listening,
rpcrt4_ncacn_http_wait_for_incoming_data,
rpcrt4_ncacn_http_get_top_of_tower,
rpcrt4_ncacn_http_parse_top_of_tower,
return RPC_S_OK;
}
+RPC_STATUS RPCRT4_IsServerListening(const char *protseq, const char *endpoint)
+{
+ const struct connection_ops *ops;
+
+ ops = rpcrt4_get_conn_protseq_ops(protseq);
+ if (!ops)
+ {
+ FIXME("not supported for protseq %s\n", protseq);
+ return RPC_S_INVALID_BINDING;
+ }
+
+ return ops->is_server_listening(endpoint);
+}
+
RPC_STATUS RpcTransport_GetTopOfTower(unsigned char *tower_data,
size_t *tower_size,
const char *protseq,
32 stub I_RpcBindingInqDynamicEndPoint
33 stub I_RpcBindingInqDynamicEndPointA
34 stub I_RpcBindingInqDynamicEndPointW
-35 stub I_RpcBindingInqLocalClientPID
+35 stdcall I_RpcBindingInqLocalClientPID(ptr ptr)
# I_RpcBindingInqMarshalledTargetInfo
37 stub I_RpcBindingInqSecurityContext
38 stdcall I_RpcBindingInqTransportType(ptr ptr)
100 stub I_RpcTransIoCancelled
101 stub I_RpcTransServerNewConnection
102 stub I_RpcTurnOnEEInfoPropagation
-103 stub I_UuidCreate
+103 stdcall I_UuidCreate(ptr)
104 stub MIDL_wchar_strcpy
105 stub MIDL_wchar_strlen
-106 stub MesBufferHandleReset
+106 stdcall MesBufferHandleReset(ptr long long ptr long ptr)
107 stdcall MesDecodeBufferHandleCreate(ptr long ptr)
108 stdcall MesDecodeIncrementalHandleCreate(ptr ptr ptr)
109 stdcall MesEncodeDynBufferHandleCreate(ptr ptr ptr)
465 stub RpcSsContextLockShared
466 stdcall RpcSsDestroyClientContext(ptr)
467 stub RpcSsDisableAllocate
-468 stub RpcSsDontSerializeContext
+468 stdcall RpcSsDontSerializeContext()
469 stub RpcSsEnableAllocate
470 stub RpcSsFree
471 stub RpcSsGetContextBinding
return status;
}
+/*************************************************************************
+ * I_UuidCreate [RPCRT4.@]
+ *
+ * See UuidCreateSequential()
+ */
+RPC_STATUS WINAPI I_UuidCreate(UUID *Uuid)
+{
+ return UuidCreateSequential(Uuid);
+}
/*************************************************************************
* UuidHash [RPCRT4.@]
-diff -prudN .\wine\dlls\rpcrt4/rpc_epmap.c .\reactos\dll\win32\rpcrt4/rpc_epmap.c
---- .\wine\dlls\rpcrt4/rpc_epmap.c 2014-05-09 03:43:55.965035900 +0200
-+++ .\reactos\dll\win32\rpcrt4/rpc_epmap.c 2013-12-27 18:11:56.421567500 +0100
-@@ -92,7 +80,7 @@ static BOOL start_rpcss(void)
- lstrcatW( cmd, rpcss );
-
- Wow64DisableWow64FsRedirection( &redir );
-- rslt = CreateProcessW( cmd, cmd, NULL, NULL, FALSE, DETACHED_PROCESS, NULL, NULL, &si, &pi );
-+ rslt = CreateProcessW( cmd, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi );
- Wow64RevertWow64FsRedirection( redir );
-
- if (rslt)
+diff -pudN --strip-trailing-cr e:\wine\dlls\rpcrt4/cproxy.c e:\reactos\dll\win32\rpcrt4/cproxy.c
+--- e:\wine\dlls\rpcrt4/cproxy.c 2015-02-21 17:13:10 +0100
++++ e:\reactos\dll\win32\rpcrt4/cproxy.c 2015-08-27 22:03:34 +0100
+@@ -167,6 +150,30 @@ static inline void init_thunk( struct th
+ thunk->call_stubless = call_stubless_func;
+ }
+
++#elif defined(__arm__)
++
++extern void call_stubless_func(void);
++__ASM_GLOBAL_FUNC(call_stubless_func,
++ "DCD 0xDEFC\n\t" // _assertfail
++ "" );
++
++#include "pshpack1.h"
++struct thunk
++{
++ DWORD assertfail;
++};
++#include "poppack.h"
++
++static const struct thunk thunk_template =
++{
++ { 0xDEFC } /* _assertfail */
++};
++
++static inline void init_thunk( struct thunk *thunk, unsigned int index )
++{
++ *thunk = thunk_template;
++}
++
+ #else /* __i386__ */
+
+ #warning You must implement stubless proxies for your CPU
+diff -pudN --strip-trailing-cr e:\wine\dlls\rpcrt4/cstub.c e:\reactos\dll\win32\rpcrt4/cstub.c
+--- e:\wine\dlls\rpcrt4/cstub.c 2015-10-30 18:41:53 +0100
++++ e:\reactos\dll\win32\rpcrt4/cstub.c 2015-11-16 22:55:49 +0100
+@@ -174,6 +156,13 @@ typedef struct
+
+ static const BYTE opcodes[16] = { 0x48, 0x8b, 0x49, 0x20, 0x48, 0x8b, 0x01,
+ 0xff, 0xa0, 0, 0, 0, 0, 0x48, 0x8d, 0x36 };
++#elif defined(__arm__)
++typedef struct
++{
++ DWORD offset;
++} vtbl_method_t;
++static const BYTE opcodes[1];
++
+ #else
+
+ #warning You must implement delegated proxies/stubs for your CPU
+diff -pudN --strip-trailing-cr e:\wine\dlls\rpcrt4/rpc_epmap.c e:\reactos\dll\win32\rpcrt4/rpc_epmap.c
+--- e:\wine\dlls\rpcrt4/rpc_epmap.c 2015-02-21 17:13:10 +0100
++++ e:\reactos\dll\win32\rpcrt4/rpc_epmap.c 2015-11-16 22:55:50 +0100
@@ -162,7 +150,7 @@ static RPC_STATUS get_epm_handle_server(
static LONG WINAPI rpc_filter(EXCEPTION_POINTERS *__eptr)
{
case EXCEPTION_ACCESS_VIOLATION:
case EXCEPTION_ILLEGAL_INSTRUCTION:
-diff -prudN .\wine\dlls\rpcrt4/rpc_server.c .\reactos\dll\win32\rpcrt4/rpc_server.c
---- .\wine\dlls\rpcrt4/rpc_server.c 2014-05-09 03:43:55.973036400 +0200
-+++ .\reactos\dll\win32\rpcrt4/rpc_server.c 2013-12-27 18:11:56.780368100 +0100
-@@ -1075,8 +1053,10 @@ void RPCRT4_destroy_all_protseqs(void)
- EnterCriticalSection(&server_cs);
- LIST_FOR_EACH_ENTRY_SAFE(cps, cursor2, &protseqs, RpcServerProtseq, entry)
- {
-+#ifndef __REACTOS__
- if (listen_count != 0)
- RPCRT4_sync_with_server_thread(cps);
-+#endif
- destroy_serverprotoseq(cps);
- }
- LeaveCriticalSection(&server_cs);
-diff -prudN .\wine\dlls\rpcrt4/rpc_transport.c .\reactos\dll\win32\rpcrt4/rpc_transport.c
---- .\wine\dlls\rpcrt4/rpc_transport.c 2014-05-09 03:43:55.977036600 +0200
-+++ .\reactos\dll\win32\rpcrt4/rpc_transport.c 2014-05-09 03:10:59.250551600 +0200
-@@ -113,31 +91,41 @@ typedef struct _RpcConnection_np
+diff -pudN --strip-trailing-cr e:\wine\dlls\rpcrt4/rpc_transport.c e:\reactos\dll\win32\rpcrt4/rpc_transport.c
+--- e:\wine\dlls\rpcrt4/rpc_transport.c 2015-11-01 09:49:28 +0100
++++ e:\reactos\dll\win32\rpcrt4/rpc_transport.c 2015-11-16 22:55:50 +0100
+@@ -102,6 +79,7 @@
+
+ #define DEFAULT_NCACN_HTTP_TIMEOUT (60 * 1000)
+
++#undef ARRAYSIZE
+ #define ARRAYSIZE(a) (sizeof((a)) / sizeof((a)[0]))
+
+ WINE_DEFAULT_DEBUG_CHANNEL(rpc);
+@@ -114,31 +92,41 @@ typedef struct _RpcConnection_np
{
RpcConnection common;
HANDLE pipe;
case ERROR_NO_DATA_DETECTED:
/* client has disconnected, retry */
DisconnectNamedPipe( npc->pipe );
-@@ -150,6 +138,7 @@ static DWORD CALLBACK listen_thread(void
+@@ -151,6 +139,7 @@ static DWORD CALLBACK listen_thread(void
}
}
static RPC_STATUS rpcrt4_conn_listen_pipe(RpcConnection_np *npc)
{
if (npc->listening)
-@@ -165,13 +154,14 @@ static RPC_STATUS rpcrt4_conn_listen_pip
+@@ -166,13 +155,14 @@ static RPC_STATUS rpcrt4_conn_listen_pip
}
return RPC_S_OK;
}
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE,
PIPE_UNLIMITED_INSTANCES,
RPC_MAX_PACKET_SIZE, RPC_MAX_PACKET_SIZE, 5000, NULL);
-@@ -183,6 +173,9 @@ static RPC_STATUS rpcrt4_conn_create_pip
+@@ -184,6 +174,9 @@ static RPC_STATUS rpcrt4_conn_create_pip
return RPC_S_CANT_CREATE_ENDPOINT;
}
/* Note: we don't call ConnectNamedPipe here because it must be done in the
* server thread as the thread must be alertable */
return RPC_S_OK;
-@@ -229,6 +222,9 @@ static RPC_STATUS rpcrt4_conn_open_pipe(
+@@ -230,6 +223,9 @@ static RPC_STATUS rpcrt4_conn_open_pipe(
if (err == ERROR_PIPE_BUSY) {
TRACE("connection failed, error=%x\n", err);
return RPC_S_SERVER_TOO_BUSY;
}
if (!wait || !WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) {
err = GetLastError();
-@@ -238,9 +234,11 @@ static RPC_STATUS rpcrt4_conn_open_pipe(
+@@ -239,9 +235,11 @@ static RPC_STATUS rpcrt4_conn_open_pipe(
}
/* success */
npc->pipe = pipe;
return RPC_S_OK;
-@@ -308,18 +306,64 @@ static RPC_STATUS rpcrt4_protseq_ncalrpc
+@@ -262,6 +260,7 @@ static char *ncalrpc_pipe_name(const cha
+ static RPC_STATUS rpcrt4_ncalrpc_open(RpcConnection* Connection)
+ {
+ RpcConnection_np *npc = (RpcConnection_np *) Connection;
++ static const char prefix[] = "\\\\.\\pipe\\lrpc\\";
+ RPC_STATUS r;
+ LPSTR pname;
+
+@@ -269,7 +268,10 @@ static RPC_STATUS rpcrt4_ncalrpc_open(Rp
+ if (npc->pipe)
+ return RPC_S_OK;
+
+- pname = ncalrpc_pipe_name(Connection->Endpoint);
++ /* protseq=ncalrpc: supposed to use NT LPC ports,
++ * but we'll implement it with named pipes for now */
++ pname = I_RpcAllocate(strlen(prefix) + strlen(Connection->Endpoint) + 1);
++ strcat(strcpy(pname, prefix), Connection->Endpoint);
+ r = rpcrt4_conn_open_pipe(Connection, pname, TRUE);
+ I_RpcFree(pname);
+
+@@ -278,6 +280,7 @@ static RPC_STATUS rpcrt4_ncalrpc_open(Rp
+
+ static RPC_STATUS rpcrt4_protseq_ncalrpc_open_endpoint(RpcServerProtseq* protseq, const char *endpoint)
+ {
++ static const char prefix[] = "\\\\.\\pipe\\lrpc\\";
+ RPC_STATUS r;
+ LPSTR pname;
+ RpcConnection *Connection;
+@@ -298,7 +301,10 @@ static RPC_STATUS rpcrt4_protseq_ncalrpc
+ if (r != RPC_S_OK)
+ return r;
+
+- pname = ncalrpc_pipe_name(Connection->Endpoint);
++ /* protseq=ncalrpc: supposed to use NT LPC ports,
++ * but we'll implement it with named pipes for now */
++ pname = I_RpcAllocate(strlen(prefix) + strlen(Connection->Endpoint) + 1);
++ strcat(strcpy(pname, prefix), Connection->Endpoint);
+ r = rpcrt4_conn_create_pipe(Connection, pname);
+ I_RpcFree(pname);
+
+@@ -324,15 +330,64 @@ static char *ncacn_pipe_name(const char
static RPC_STATUS rpcrt4_ncacn_np_open(RpcConnection* Connection)
{
RpcConnection_np *npc = (RpcConnection_np *) Connection;
-- static const char prefix[] = "\\\\.";
+ static const char prefix[] = "\\\\";
+ static const char local[] = ".";
+ BOOL bUseLocalName = TRUE;
if (npc->pipe)
return RPC_S_OK;
- /* protseq=ncacn_np: named pipes */
-- pname = I_RpcAllocate(strlen(prefix) + strlen(Connection->Endpoint) + 1);
-- strcat(strcpy(pname, prefix), Connection->Endpoint);
+- pname = ncacn_pipe_name(Connection->Endpoint);
- r = rpcrt4_conn_open_pipe(Connection, pname, FALSE);
++ /* protseq=ncacn_np: named pipes */
+ size = strlen(prefix);
+
+ if (Connection->NetworkAddr == NULL || strlen(Connection->NetworkAddr) == 0)
I_RpcFree(pname);
return r;
-@@ -368,9 +412,9 @@ static void rpcrt4_conn_np_handoff(RpcCo
+@@ -340,6 +395,7 @@ static RPC_STATUS rpcrt4_ncacn_np_open(R
+
+ static RPC_STATUS rpcrt4_protseq_ncacn_np_open_endpoint(RpcServerProtseq *protseq, const char *endpoint)
+ {
++ static const char prefix[] = "\\\\.";
+ RPC_STATUS r;
+ LPSTR pname;
+ RpcConnection *Connection;
+@@ -360,7 +416,9 @@ static RPC_STATUS rpcrt4_protseq_ncacn_n
+ if (r != RPC_S_OK)
+ return r;
+
+- pname = ncacn_pipe_name(Connection->Endpoint);
++ /* protseq=ncacn_np: named pipes */
++ pname = I_RpcAllocate(strlen(prefix) + strlen(Connection->Endpoint) + 1);
++ strcat(strcpy(pname, prefix), Connection->Endpoint);
+ r = rpcrt4_conn_create_pipe(Connection, pname);
+ I_RpcFree(pname);
+
+@@ -378,9 +436,9 @@ static void rpcrt4_conn_np_handoff(RpcCo
* to the child, then reopen the server binding to continue listening */
new_npc->pipe = old_npc->pipe;
old_npc->listening = FALSE;
}
-@@ -415,11 +459,17 @@ static int rpcrt4_conn_np_read(RpcConnec
+@@ -388,10 +446,12 @@ static RPC_STATUS rpcrt4_ncacn_np_handof
+ {
+ RPC_STATUS status;
+ LPSTR pname;
++ static const char prefix[] = "\\\\.";
+
+ rpcrt4_conn_np_handoff((RpcConnection_np *)old_conn, (RpcConnection_np *)new_conn);
+
+- pname = ncacn_pipe_name(old_conn->Endpoint);
++ pname = I_RpcAllocate(strlen(prefix) + strlen(old_conn->Endpoint) + 1);
++ strcat(strcpy(pname, prefix), old_conn->Endpoint);
+ status = rpcrt4_conn_create_pipe(old_conn, pname);
+ I_RpcFree(pname);
+
+@@ -429,12 +489,14 @@ static RPC_STATUS rpcrt4_ncalrpc_handoff
+ {
+ RPC_STATUS status;
+ LPSTR pname;
++ static const char prefix[] = "\\\\.\\pipe\\lrpc\\";
+
+ TRACE("%s\n", old_conn->Endpoint);
+
+ rpcrt4_conn_np_handoff((RpcConnection_np *)old_conn, (RpcConnection_np *)new_conn);
+
+- pname = ncalrpc_pipe_name(old_conn->Endpoint);
++ pname = I_RpcAllocate(strlen(prefix) + strlen(old_conn->Endpoint) + 1);
++ strcat(strcpy(pname, prefix), old_conn->Endpoint);
+ status = rpcrt4_conn_create_pipe(old_conn, pname);
+ I_RpcFree(pname);
+
+@@ -448,12 +510,17 @@ static int rpcrt4_conn_np_read(RpcConnec
char *buf = buffer;
BOOL ret = TRUE;
unsigned int bytes_left = count;
+- DWORD err = GetLastError();
+ OVERLAPPED ovl;
+
+ ZeroMemory(&ovl, sizeof(ovl));
if (!ret && GetLastError() == ERROR_MORE_DATA)
ret = TRUE;
if (!ret || !bytes_read)
-@@ -427,6 +472,7 @@ static int rpcrt4_conn_np_read(RpcConnec
+@@ -461,7 +528,7 @@ static int rpcrt4_conn_np_read(RpcConnec
bytes_left -= bytes_read;
buf += bytes_read;
}
+- if (ret) SetLastError(err);
+ CloseHandle(ovl.hEvent);
return ret ? count : -1;
}
-@@ -437,16 +488,23 @@ static int rpcrt4_conn_np_write(RpcConne
+@@ -472,16 +539,23 @@ static int rpcrt4_conn_np_write(RpcConne
const char *buf = buffer;
BOOL ret = TRUE;
unsigned int bytes_left = count;
return ret ? count : -1;
}
-@@ -458,9 +516,9 @@ static int rpcrt4_conn_np_close(RpcConne
+@@ -493,9 +567,9 @@ static int rpcrt4_conn_np_close(RpcConne
CloseHandle(npc->pipe);
npc->pipe = 0;
}
}
return 0;
}
-@@ -664,7 +722,7 @@ static void *rpcrt4_protseq_np_get_wait_
+@@ -699,7 +773,7 @@ static void *rpcrt4_protseq_np_get_wait_
conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
while (conn) {
rpcrt4_conn_listen_pipe(conn);
(*count)++;
conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common);
}
-@@ -685,7 +743,7 @@ static void *rpcrt4_protseq_np_get_wait_
+@@ -720,7 +794,7 @@ static void *rpcrt4_protseq_np_get_wait_
*count = 1;
conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
while (conn) {
(*count)++;
conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common);
}
-@@ -732,18 +790,12 @@ static int rpcrt4_protseq_np_wait_for_ne
+@@ -767,18 +841,12 @@ static int rpcrt4_protseq_np_wait_for_ne
EnterCriticalSection(&protseq->cs);
conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
while (conn) {
else
ERR("failed to locate connection for handle %p\n", b_handle);
LeaveCriticalSection(&protseq->cs);
-diff -prudN .\wine\dlls\rpcrt4/rpcrt4.spec .\reactos\dll\win32\rpcrt4/rpcrt4.spec
---- .\wine\dlls\rpcrt4/rpcrt4.spec 2014-05-09 03:43:55.911032800 +0200
-+++ .\reactos\dll\win32\rpcrt4/rpcrt4.spec 2013-12-07 15:35:15.331527800 +0100
-@@ -266,7 +266,7 @@
- @ stdcall NdrRangeUnmarshall(ptr ptr ptr long)
- @ stub NdrRpcSmClientAllocate
- @ stub NdrRpcSmClientFree
--@ stub NdrRpcSmSetClientToOsf
-+@ stdcall NdrRpcSmSetClientToOsf(ptr)
- @ stub NdrRpcSsDefaultAllocate
- @ stub NdrRpcSsDefaultFree
- @ stub NdrRpcSsDisableAllocate
reactos/dll/win32/resutils # Synced to WineStaging-1.7.47
reactos/dll/win32/riched20 # Synced to WineStaging-1.7.47
reactos/dll/win32/riched32 # Synced to WineStaging-1.7.47
-reactos/dll/win32/rpcrt4 # Synced to Wine-1.7.17
+reactos/dll/win32/rpcrt4 # Synced to WineStaging-1.7.55
reactos/dll/win32/rsabase # Synced to WineStaging-1.7.47
reactos/dll/win32/rsaenh # Synced to WineStaging-1.7.47
reactos/dll/win32/sccbase # Synced to WineStaging-1.7.47