Commit 9b239925 authored by Ove Kaaven's avatar Ove Kaaven Committed by Alexandre Julliard

Implemented RpcBindingInqObject, RpcBindingSetObject,

RpcBindingVectorFree, RpcBindingToStringBindingA/W, RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W, I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree, RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
parent 57951433
......@@ -10,6 +10,7 @@ LDDLLFLAGS = @LDDLLFLAGS@
SYMBOLFILE = $(MODULE).tmp.o
C_SRCS = \
rpc_binding.c \
rpcrt4_main.c
@MAKE_DLL_RULES@
......
/*
* RPC binding API
*
* Copyright 2001 Ove Kven, TransGaming Technologies
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WINE_RPC_BINDING_H
#define __WINE_RPC_BINDING_H
/* don't know what MS's structure looks like */
typedef struct _RpcBinding
{
DWORD refs;
struct _RpcBinding* Next; /* for rpc server */
BOOL server;
UUID ObjectUuid;
LPSTR Protseq;
LPSTR NetworkAddr;
LPSTR Endpoint;
RPC_BLOCKING_FN BlockingFn;
ULONG ServerTid;
HANDLE conn, thread;
OVERLAPPED ovl;
} RpcBinding;
LPSTR RPCRT4_strndupA(LPSTR src, INT len);
LPWSTR RPCRT4_strndupW(LPWSTR src, INT len);
LPSTR RPCRT4_strdupWtoA(LPWSTR src);
LPWSTR RPCRT4_strdupAtoW(LPSTR src);
void RPCRT4_strfree(LPSTR src);
#define RPCRT4_strdupA(x) RPCRT4_strndupA((x),-1)
#define RPCRT4_strdupW(x) RPCRT4_strndupW((x),-1)
RPC_STATUS RPCRT4_CreateBindingA(RpcBinding** Binding, BOOL server, LPSTR Protseq);
RPC_STATUS RPCRT4_CreateBindingW(RpcBinding** Binding, BOOL server, LPWSTR Protseq);
RPC_STATUS RPCRT4_CompleteBindingA(RpcBinding* Binding, LPSTR NetworkAddr, LPSTR Endpoint, LPSTR NetworkOptions);
RPC_STATUS RPCRT4_CompleteBindingW(RpcBinding* Binding, LPWSTR NetworkAddr, LPWSTR Endpoint, LPWSTR NetworkOptions);
RPC_STATUS RPCRT4_ResolveBinding(RpcBinding* Binding, LPSTR Endpoint);
RPC_STATUS RPCRT4_SetBindingObject(RpcBinding* Binding, UUID* ObjectUuid);
RPC_STATUS RPCRT4_SpawnBinding(RpcBinding** Binding, RpcBinding* OldBinding);
RPC_STATUS RPCRT4_ExportBinding(RpcBinding** Binding, RpcBinding* OldBinding);
RPC_STATUS RPCRT4_DestroyBinding(RpcBinding* Binding);
RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding);
RPC_STATUS RPCRT4_CloseBinding(RpcBinding* Binding);
#endif
......@@ -41,7 +41,7 @@ init RPCRT4_LibMain
@ stub RpcBindingInqAuthInfoW
@ stub RpcBindingInqAuthInfoExA
@ stub RpcBindingInqAuthInfoExW
@ stub RpcBindingInqObject
@ stdcall RpcBindingInqObject(ptr ptr) RpcBindingInqObject
@ stub RpcBindingInqOption
@ stub RpcBindingReset
@ stub RpcBindingServerFromClient
......@@ -49,11 +49,11 @@ init RPCRT4_LibMain
@ stub RpcBindingSetAuthInfoW
@ stub RpcBindingSetAuthInfoExA
@ stub RpcBindingSetAuthInfoExW
@ stub RpcBindingSetObject
@ stdcall RpcBindingSetObject(ptr ptr) RpcBindingSetObject
@ stub RpcBindingSetOption
@ stub RpcBindingToStringBindingA
@ stub RpcBindingToStringBindingW
@ stub RpcBindingVectorFree
@ stdcall RpcBindingToStringBindingA(ptr ptr) RpcBindingToStringBindingA
@ stdcall RpcBindingToStringBindingW(ptr ptr) RpcBindingToStringBindingW
@ stdcall RpcBindingVectorFree(ptr) RpcBindingVectorFree
@ stub RpcCancelAsyncCall
@ stub RpcCancelThread
@ stub RpcCancelThreadEx
......@@ -162,10 +162,10 @@ init RPCRT4_LibMain
@ stub RpcSsSwapClientAllocFree
@ stdcall RpcStringBindingComposeA(str str str str str ptr) RpcStringBindingComposeA
@ stdcall RpcStringBindingComposeW(wstr wstr wstr wstr wstr ptr) RpcStringBindingComposeW
@ stub RpcStringBindingParseA
@ stub RpcStringBindingParseW
@ stdcall RpcStringBindingParseA(str ptr ptr ptr ptr ptr) RpcStringBindingParseA
@ stdcall RpcStringBindingParseW(wstr ptr ptr ptr ptr ptr) RpcStringBindingParseW
@ stdcall RpcStringFreeA(ptr) RpcStringFreeA
@ stub RpcStringFreeW
@ stdcall RpcStringFreeW(ptr) RpcStringFreeW
@ stub RpcTestCancel
@ stub TowerConstruct
......@@ -181,7 +181,7 @@ init RPCRT4_LibMain
@ stdcall UuidHash(ptr ptr) UuidHash
@ stdcall UuidIsNil(ptr ptr) UuidIsNil
@ stdcall UuidToStringA(ptr ptr) UuidToStringA
@ stub UuidToStringW
@ stdcall UuidToStringW(ptr ptr) UuidToStringW
@ stub CStdStubBuffer_QueryInterface
@ stub CStdStubBuffer_AddRef
......@@ -427,7 +427,8 @@ init RPCRT4_LibMain
@ stub I_RpcBindingInqWireIdForSnego
@ stub I_RpcBindingIsClientLocal
@ stub I_RpcBindingToStaticStringBindingW
@ stub I_RpcBindingSetAsync # win9x
@ stdcall I_RpcBindingSetAsync(ptr ptr long) I_RpcBindingSetAsync # win9x
# NT version of I_RpcBindingSetAsync has 2 arguments, not 3
@ stub I_RpcClearMutex
@ stub I_RpcConnectionInqSockBuffSize
@ stub I_RpcConnectionInqSockBuffSize2
......
......@@ -32,7 +32,6 @@
#endif
#include "windef.h"
#include "wine/windef16.h"
#include "winerror.h"
#include "winbase.h"
#include "wine/unicode.h"
......@@ -61,6 +60,8 @@
# include <netinet/in.h>
#endif
#include "rpc_binding.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole);
......@@ -95,6 +96,38 @@ RPCRT4_LibMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
}
/*************************************************************************
* RpcStringFreeA [RPCRT4.@]
*
* Frees a character string allocated by the RPC run-time library.
*
* RETURNS
*
* S_OK if successful.
*/
RPC_STATUS WINAPI RpcStringFreeA(LPSTR* String)
{
HeapFree( GetProcessHeap(), 0, *String);
return RPC_S_OK;
}
/*************************************************************************
* RpcStringFreeW [RPCRT4.@]
*
* Frees a character string allocated by the RPC run-time library.
*
* RETURNS
*
* S_OK if successful.
*/
RPC_STATUS WINAPI RpcStringFreeW(LPWSTR* String)
{
HeapFree( GetProcessHeap(), 0, *String);
return RPC_S_OK;
}
/*************************************************************************
* UuidEqual [RPCRT4.@]
*
* PARAMS
......@@ -353,7 +386,6 @@ sizeof((i).ifr_name)+(i).ifr_addr.sa_len)
* Creates a 128bit UUID by calling UuidCreate.
* New API in Win 2000
*/
RPC_STATUS WINAPI UuidCreateSequential(UUID *Uuid)
{
return UuidCreate (Uuid);
......@@ -361,33 +393,34 @@ RPC_STATUS WINAPI UuidCreateSequential(UUID *Uuid)
/*************************************************************************
* RpcStringFreeA [RPCRT4.@]
* UuidHash [RPCRT4.@]
*
* Frees a character string allocated by the RPC run-time library.
* Generates a hash value for a given UUID
*
* RETURNS
* Code based on FreeDCE implementation
*
* S_OK if successful.
*/
RPC_STATUS WINAPI RpcStringFreeA(LPSTR* String)
unsigned short WINAPI UuidHash(UUID *uuid, RPC_STATUS *Status)
{
HeapFree( GetProcessHeap(), 0, *String);
BYTE *data = (BYTE*)uuid;
short c0 = 0, c1 = 0, x, y;
int i;
return RPC_S_OK;
}
TRACE("(%s)\n", debugstr_guid(uuid));
for (i=0; i<sizeof(UUID); i++) {
c0 += data[i];
c1 += c0;
}
x = -c1 % 255;
if (x < 0) x += 255;
y = (c1 - c0) % 255;
if (y < 0) y += 255;
/*************************************************************************
* UuidHash [RPCRT4.@]
*
* Generates a hash value for a given UUID
*
*/
unsigned short WINAPI UuidHash(UUID *uuid, RPC_STATUS *Status)
{
FIXME("stub:\n");
*Status = RPC_S_OK;
return 0xabcd;
return y*256 + x;
}
/*************************************************************************
......@@ -419,6 +452,31 @@ RPC_STATUS WINAPI UuidToStringA(UUID *Uuid, LPSTR* StringUuid)
return RPC_S_OK;
}
/*************************************************************************
* UuidToStringW [RPCRT4.@]
*
* Converts a UUID to a string.
*
* S_OK if successful.
* S_OUT_OF_MEMORY if unsucessful.
*/
RPC_STATUS WINAPI UuidToStringW(UUID *Uuid, LPWSTR* StringUuid)
{
char buf[37];
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] );
*StringUuid = RPCRT4_strdupAtoW(buf);
if(!(*StringUuid))
return RPC_S_OUT_OF_MEMORY;
return RPC_S_OK;
}
static const BYTE hex2bin[] =
{
......@@ -653,59 +711,6 @@ RPC_STATUS WINAPI RpcServerListen( UINT MinimumCallThreads, UINT MaxCalls, UINT
}
/***********************************************************************
* RpcStringBindingComposeA (RPCRT4.@)
*/
RPC_STATUS WINAPI RpcStringBindingComposeA( LPSTR ObjUuid, LPSTR Protseq, LPSTR NetworkAddr, LPSTR Endpoint,
LPSTR Options, LPSTR* StringBinding )
{
FIXME( "(%s,%s,%s,%s,%s,%p): stub\n", ObjUuid, Protseq, NetworkAddr, Endpoint, Options, StringBinding );
*StringBinding = NULL;
return RPC_S_INVALID_STRING_UUID; /* Failure */
}
/***********************************************************************
* RpcStringBindingComposeW (RPCRT4.@)
*/
RPC_STATUS WINAPI RpcStringBindingComposeW( LPWSTR ObjUuid, LPWSTR Protseq, LPWSTR NetworkAddr, LPWSTR Endpoint,
LPWSTR Options, LPWSTR* StringBinding )
{
FIXME( "(%s,%s,%s,%s,%s,%p): stub\n", debugstr_w( ObjUuid ), debugstr_w( Protseq ), debugstr_w( NetworkAddr ),
debugstr_w( Endpoint ), debugstr_w( Options ), StringBinding );
*StringBinding = NULL;
return RPC_S_INVALID_STRING_UUID; /* Failure */
}
/***********************************************************************
* RpcBindingFree (RPCRT4.@)
*/
RPC_STATUS WINAPI RpcBindingFree(RPC_BINDING_HANDLE* Binding)
{
FIXME("(%p): stub\n", Binding);
return RPC_S_OK;
}
/***********************************************************************
* RpcBindingFromStringBindingA (RPCRT4.@)
*/
RPC_STATUS WINAPI RpcBindingFromStringBindingA( LPSTR StringBinding, RPC_BINDING_HANDLE* Binding )
{
FIXME( "(%s,%p): stub\n", StringBinding, Binding );
return RPC_S_INVALID_STRING_BINDING; /* As good as any failure code */
}
/***********************************************************************
* RpcBindingFromStringBindingW (RPCRT4.@)
*/
RPC_STATUS WINAPI RpcBindingFromStringBindingW( LPWSTR StringBinding, RPC_BINDING_HANDLE* Binding )
{
FIXME( "(%s,%p): stub\n", debugstr_w( StringBinding ), Binding );
return RPC_S_INVALID_STRING_BINDING; /* As good as any failure code */
}
/***********************************************************************
* NdrDllCanUnloadNow (RPCRT4.@)
*/
HRESULT WINAPI NdrDllCanUnloadNow(CStdPSFactoryBuffer *pPSFactoryBuffer)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment