From 1fc70a94c58f347baa2c365d3d7868a72bf9a733 Mon Sep 17 00:00:00 2001 From: Chris Morgan <cmorgan@codeweavers.com> Date: Tue, 24 Oct 2000 01:37:22 +0000 Subject: [PATCH] Implemented RpcStringFreeA and UuidToStringA. --- dlls/rpcrt4/rpcrt4.spec | 2 ++ dlls/rpcrt4/rpcrt4_main.c | 59 +++++++++++++++++++++++++++++++++++---- 2 files changed, 56 insertions(+), 5 deletions(-) diff --git a/dlls/rpcrt4/rpcrt4.spec b/dlls/rpcrt4/rpcrt4.spec index bb6fee274be..c82e32ba8e1 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 e605d6b5830..b4dfd8d54ca 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 */ +} -- GitLab