diff --git a/dlls/rpcrt4/rpcrt4.spec b/dlls/rpcrt4/rpcrt4.spec index bb6fee274be4489704961a2032b331870acf1d9e..c82e32ba8e188af35fa3c3ee219cc581edff61b7 100644 --- a/dlls/rpcrt4/rpcrt4.spec +++ b/dlls/rpcrt4/rpcrt4.spec @@ -4,3 +4,5 @@ init RPCRT4_LibMain @ stdcall UuidCreate(ptr) UuidCreate +@ stdcall RpcStringFreeA(ptr) RpcStringFreeA +@ stdcall UuidToStringA(ptr ptr) UuidToStringA diff --git a/dlls/rpcrt4/rpcrt4_main.c b/dlls/rpcrt4/rpcrt4_main.c index e605d6b58308680ffd0b7632a912d1c3d6969c70..b4dfd8d54ca97a8b0e2ce992efd94ab781937775 100644 --- a/dlls/rpcrt4/rpcrt4_main.c +++ b/dlls/rpcrt4/rpcrt4_main.c @@ -5,17 +5,19 @@ #include "config.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include <sys/time.h> +#include <unistd.h> + #include "windef.h" #include "wine/windef16.h" #include "winerror.h" #include "winbase.h" #include "rpc.h" -#include <time.h> -#include <sys/time.h> -#include <unistd.h> -#include <stdlib.h> - #ifdef HAVE_SYS_FILE_H # include <sys/file.h> #endif @@ -265,3 +267,50 @@ sizeof((i).ifr_name)+(i).ifr_addr.sa_len) return S_OK; } + +/************************************************************************* + * RpcStringFreeA [RPCRT4.436] + * + * Frees a character string allocated by the RPC run-time library. + * + * RETURNS + * + * S_OK if successful. + */ +RPC_STATUS WINAPI RpcStringFreeA(unsigned char** String) +{ + HeapFree( GetProcessHeap(), 0, *String); + + return S_OK; +} + +/************************************************************************* + * UuidToStringA [RPCRT4.450] + * + * Converts a UUID to a string. + * + * UUID format is 8 hex digits, followed by a hyphen then three groups of + * 4 hex digits each followed by a hyphen and then 12 hex digits + * + * RETURNS + * + * S_OK if successful. + * S_OUT_OF_MEMORY if unsucessful. + */ +RPC_STATUS WINAPI UuidToStringA(UUID *Uuid, unsigned char** StringUuid) +{ + *StringUuid = HeapAlloc( GetProcessHeap(), 0, sizeof(char) * 37); + + + /* FIXME: this should be RPC_S_OUT_OF_MEMORY */ + if(!(*StringUuid)) + return ERROR_OUTOFMEMORY; + + sprintf(*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] ); + + return S_OK; /*FIXME: this should be RPC_S_OK */ +}