本文整理汇总了C++中RpcStringFree函数的典型用法代码示例。如果您正苦于以下问题:C++ RpcStringFree函数的具体用法?C++ RpcStringFree怎么用?C++ RpcStringFree使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RpcStringFree函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_RpcStringBindingFromBinding
static void test_RpcStringBindingFromBinding(void)
{
static unsigned char ncacn_np[] = "ncacn_np";
static unsigned char address[] = ".";
static unsigned char endpoint[] = "\\pipe\\wine_rpc_test";
RPC_STATUS status;
handle_t handle;
RPC_CSTR binding;
status = RpcStringBindingCompose(NULL, ncacn_np, address,
endpoint, NULL, &binding);
ok(status == RPC_S_OK, "RpcStringBindingCompose failed (%u)\n", status);
status = RpcBindingFromStringBinding(binding, &handle);
ok(status == RPC_S_OK, "RpcBindingFromStringBinding failed (%u)\n", status);
RpcStringFree(&binding);
status = RpcBindingToStringBinding(handle, &binding);
ok(status == RPC_S_OK, "RpcStringBindingFromBinding failed with error %u\n", status);
ok(!strcmp((const char *)binding, "ncacn_np:.[\\\\pipe\\\\wine_rpc_test]"),
"binding string didn't match what was expected: \"%s\"\n", binding);
RpcStringFree(&binding);
status = RpcBindingFree(&handle);
ok(status == RPC_S_OK, "RpcBindingFree failed with error %u\n", status);
}
示例2: UuidCreate
std::wstring Directory::CreateDirectoryWithUniqueName (const std::wstring & strFolderPathRoot)
{
UUID uuid;
RPC_WSTR str_uuid;
UuidCreate (&uuid);
UuidToString (&uuid, &str_uuid);
std::wstring pcTemplate = strFolderPathRoot + FILE_SEPARATOR_STR;
pcTemplate += (TCHAR *) str_uuid;
RpcStringFree (&str_uuid);
int attemps = 10;
while (!CreateDirectory(pcTemplate))
{
UuidCreate (&uuid);
UuidToString (&uuid, &str_uuid);
pcTemplate = strFolderPathRoot + FILE_SEPARATOR_STR;
pcTemplate += (TCHAR *) str_uuid;
RpcStringFree (&str_uuid);
attemps--;
if (0 == attemps)
{
pcTemplate = _T("");
}
}
return pcTemplate;
}
示例3: e
COMError::COMError(HRESULT hr)
{
_com_error e(hr);
IErrorInfo *pIErrorInfo = NULL;
GetErrorInfo(0, &pIErrorInfo);
if (pIErrorInfo == NULL)
{
e = _com_error(hr);
message = e.ErrorMessage();
}
else
{
e = _com_error(hr, pIErrorInfo);
message = e.ErrorMessage();
IErrorInfo *ptrIErrorInfo = e.ErrorInfo();
if (ptrIErrorInfo != NULL)
{
// IErrorInfo Interface located
description = (WCHAR *)e.Description();
source = (WCHAR *)e.Source();
GUID tmpGuid = e.GUID();
RPC_WSTR guidStr = NULL;
// must link in Rpcrt4.lib for UuidToString
UuidToString(&tmpGuid, &guidStr);
uuid = (WCHAR*)guidStr;
RpcStringFree(&guidStr);
ptrIErrorInfo->Release();
}
}
}
示例4: InstallGUIDKey
BOOL InstallGUIDKey(GUID& guidKey, HKEY hkey, LPCTSTR strSubKey)
{
HKEY hkeyNew, hKeySub;
DWORD dwDisposition;
LONG nReturn;
BOOL b = FALSE;
nReturn = RegCreateKeyEx(hkey,strSubKey,0,0,REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,0,&hKeySub,&dwDisposition);
if (ERROR_SUCCESS == nReturn)
{
UCHAR* wcs;
char buf[1024];
UuidToString(&guidKey,&wcs);
sprintf(buf,"{%s}",wcs);
strupr(buf);
RpcStringFree(&wcs);
nReturn = RegCreateKeyEx(hKeySub,buf,0,0,REG_OPTION_NON_VOLATILE,
KEY_READ,0,&hkeyNew,&dwDisposition);
if (ERROR_SUCCESS == nReturn)
{
RegCloseKey(hkeyNew);
b = TRUE;
}
RegCloseKey(hKeySub);
}
return b;
}
示例5: GuidToString
RPC_STATUS
GuidToString(
UUID *Uuid,
LPTSTR StringGuid
)
{
RPC_STATUS Status;
LPTSTR pTempStringGuid;
Status = UuidToString(Uuid, &pTempStringGuid);
if (Status == RPC_S_OK) {
//
// the form we want is all uppercase and with curly brackets around,
// like what OLE does
//
lstrcpy(StringGuid, TEXT("{"));
lstrcat(StringGuid, pTempStringGuid);
lstrcat(StringGuid, TEXT("}"));
CharUpper(StringGuid);
RpcStringFree(&pTempStringGuid);
}
return Status;
} // GuidToString
示例6: RpcStringFree
// dtor
Uuid::~Uuid()
{
// this string must be allocated by RPC!
// (otherwise you get a debug breakpoint deep inside RPC DLL)
if ( m_pszUuid )
#ifdef _UNICODE
RpcStringFree((unsigned short **)&m_pszUuid);
#else
RpcStringFree(&m_pszUuid);
#endif
// perhaps we should just use a static buffer and not bother
// with new and delete?
if ( m_pszCForm )
delete [] m_pszCForm;
}
示例7: FilterOnInfoTip
LRESULT
FilterOnInfoTip(
IN HWND hWnd,
IN HWND hWndTree,
IN LPNMTVGETINFOTIP lp
)
{
HTREEITEM Parent;
PBTR_FILTER Filter;
PFILTER_NODE Node;
RPC_WSTR Uuid = NULL;
Parent = TreeView_GetParent(hWndTree, lp->hItem);
if (!Parent) {
Node = (PFILTER_NODE)lp->lParam;
Filter = Node->Filter;
UuidToString(&Filter->FilterGuid, &Uuid);
StringCchPrintf(lp->pszText, lp->cchTextMax, FILTER_INFOTIP_FORMAT,
Filter->FilterName, Filter->Description, Uuid,
Filter->MajorVersion, Filter->MinorVersion,
Filter->Author );
RpcStringFree(&Uuid);
}
return 0;
}
示例8: PrintInterfaces
static int
PrintInterfaces(struct rx_connection *aconn)
{
Capabilities caps;
struct interfaceAddr addr;
#ifdef AFS_NT40_ENV
char * p;
#else
char uuidstr[128];
#endif
int i, code;
char hoststr[16];
caps.Capabilities_val = NULL;
caps.Capabilities_len = 0;
code = RXAFSCB_TellMeAboutYourself(aconn, &addr, &caps);
if (code == RXGEN_OPCODE)
code = RXAFSCB_WhoAreYou(aconn, &addr);
if (code) {
printf("cmdebug: error checking interfaces: %s\n",
afs_error_message(code));
return 0;
}
#ifdef AFS_NT40_ENV
UuidToString((UUID *)&addr.uuid, &p);
printf("UUID: %s\n",p);
RpcStringFree(&p);
#else
afsUUID_to_string(&addr.uuid, uuidstr, sizeof(uuidstr));
printf("UUID: %s\n",uuidstr);
#endif
printf("Host interfaces:\n");
for (i = 0; i < addr.numberOfInterfaces; i++) {
printf("%s", afs_inet_ntoa_r(htonl(addr.addr_in[i]), hoststr));
if (addr.subnetmask[i])
printf(", netmask %s", afs_inet_ntoa_r(htonl(addr.subnetmask[i]), hoststr));
if (addr.mtu[i])
printf(", MTU %d", addr.mtu[i]);
printf("\n");
}
if (caps.Capabilities_val) {
printf("Capabilities:\n");
if (caps.Capabilities_val[0] & CAPABILITY_ERRORTRANS) {
printf("Error Translation\n");
}
printf("\n");
}
if (caps.Capabilities_val)
free(caps.Capabilities_val);
caps.Capabilities_val = NULL;
caps.Capabilities_len = 0;
return 0;
}
示例9: pn_i_genuuid
char* pn_i_genuuid(void) {
unsigned char *generated;
UUID uuid;
UuidCreate(&uuid);
UuidToString(&uuid, &generated);
char* r = pn_strdup((const char*)generated);
RpcStringFree(&generated);
return r;
}
示例10: uuid_to_string
static void uuid_to_string(uuid_t *uuid, char *uuid_str) {
#ifdef __MINGW32__
RPC_CSTR tmp;
UuidToString(uuid, &tmp);
strcpy(uuid_str, tmp);
RpcStringFree(&tmp);
#elif __linux__
uuid_unparse_lower(*uuid, uuid_str);
#endif
}
示例11: gen_uuid_inplace
void gen_uuid_inplace (char *buf)
{
unsigned char *str = NULL;
UUID uuid;
UuidCreate(&uuid);
UuidToString(&uuid, &str);
memcpy(buf, str, 37);
RpcStringFree(&str);
}
示例12: SWITCH_DECLARE
SWITCH_DECLARE(void) switch_uuid_format(char *buffer, const switch_uuid_t *uuid)
{
#ifndef WIN32
apr_uuid_format(buffer, (const apr_uuid_t *) uuid);
#else
RPC_CSTR buf;
UuidToString((const UUID *) uuid, &buf);
strcpy(buffer, (const char *) buf);
RpcStringFree(&buf);
#endif
}
示例13: uuid_unparse
void uuid_unparse (const uuid_t uu, char *out) {
unsigned char *formatted;
if (UuidToString((UUID*)uu, &formatted) == RPC_S_OK) {
#ifdef _MSC_VER
strncpy_s (out, 36+1, (char*)formatted, _TRUNCATE);
#else
strncpy (out, (char*)formatted, 36+1);
#endif
RpcStringFree(&formatted);
}
}
示例14: main
int main(int argc, char* argv[])
{
RPC_STATUS status;
unsigned char * pszNetworkAddress = NULL;
unsigned char * pszStringBinding = NULL;
int i;
for ( i = 1; i < argc; ++i )
{
if ( strcmp(argv[i], "-ip") == 0 )
{
pszNetworkAddress = (unsigned char *)argv[++i];
}
}
status = RpcStringBindingCompose(
NULL,
(unsigned char *)"ncacn_np",
pszNetworkAddress,
(unsigned char *)"\\pipe\\{a5194558-21a6-4978-9610-2072fcf1dc6e}",
NULL,
&pszStringBinding );
if ( status != 0 )
{
printf("RpcStringBindingCompose return %d !\n", status);
return 1;
}
printf("pszStringBinding = %s\n", pszStringBinding);
status = RpcBindingFromStringBinding(
pszStringBinding,
&hello_Binding );
if ( status != 0 )
{
printf("RpcBindingFromStringBinding return %d !\n", status);
return 1;
}
doRpcCall();
status = RpcStringFree( &pszStringBinding );
if ( status != 0 )
printf("RpcStringFree return %d !\n", status);
status = RpcBindingFree( &hello_Binding );
if ( status != 0 )
printf("RpcBindingFree return %d !\n", status);
getchar();
return 0;
}
示例15: gen_uuid
char* gen_uuid ()
{
char *uuid_str = g_malloc (37);
unsigned char *str = NULL;
UUID uuid;
UuidCreate(&uuid);
UuidToString(&uuid, &str);
memcpy(uuid_str, str, 37);
RpcStringFree(&str);
return uuid_str;
}