当前位置: 首页 > news >正文

个人网站怎么做详情页南宁百度关键词排名公司

个人网站怎么做详情页,南宁百度关键词排名公司,h5跳转小程序,中山专业网站建设价格概述:windows 创建 RPC调用过程实例详解 参考文章:Remote procedure call (RPC)(远程过程调用 (RPC)) - Win32 apps | Microsoft Learn 文章目录 0x01、生成 UUID 和模版(IDL)文件0x02、添加 acf 文件0x03、编译 idl 文件0x04、客…

概述:windows 创建 RPC调用过程实例详解
参考文章:Remote procedure call (RPC)(远程过程调用 (RPC)) - Win32 apps | Microsoft Learn

RPC

文章目录

    • 0x01、生成 UUID 和模版(IDL)文件
    • 0x02、添加 acf 文件
    • 0x03、编译 idl 文件
    • 0x04、客户端
      • main.cpp
    • 0x05、服务端
      • main.cpp
    • 0x06、编译并运行
    • 0x07、运行示例
      • Client
      • Server

0x01、生成 UUID 和模版(IDL)文件

定义接口的第一步是使用 uuidgen 实用工具生成通用唯一标识符(UUID)。UUID使客户端和服务端能够相互识别。该工具包含在阿庄平台软件开发工具包中(SDK)。

一般安装路径位于:D:\Windows Kits\10\bin\10.0.22621.0\x64

以下命令生成 UUID 并创建名为 Hello.idl 的模版文件。

uuidgen /i /ohello.idl

模版内容大致如下:

[uuid(7a98c250-6808-11cf-b73b-00aa00b677a7),version(1.0)
]
interface hello
{}

在模版中添加接口:

//file hello.idl
[uuid(7a98c250-6808-11cf-b73b-00aa00b677a7),version(1.0)
]
interface hello
{void HelloProc([in, string] unsigned char * pszString);void Shutdown(void);
}

0x02、添加 acf 文件

acf文件内容如下所示,导出接口需要与 idl 文件一致:

//file: hello.acf
[implicit_handle (handle_t hello_IfHandle)
] 
interface hello
{
}

0x03、编译 idl 文件

  1. 打开 visual studio,新建一个空项目

  2. 空项目中添加上述 idl文件 和 acf文件
    接口工程

  3. 编译项目

  4. 生成 hello_h.h、hello_c.c、hello_s.c

    • hello_h.h: 服务端和客户端共用文件
    • hello_c.c: 客户端文件
    • hello_s.c: 服务端文件

    需要补充说明的是,在 hello_h.h 头文件中有两个导出接口,导出接口即为rpc调用的接口。

    extern RPC_IF_HANDLE hello_v1_0_c_ifspec;
    extern RPC_IF_HANDLE hello_v1_0_s_ifspec;
    

0x04、客户端

新建工程文件如下所示:
客户端工程

main.cpp

//client.cpp
#include <iostream>
#include <string>
using namespace std;#include "hello_h.h"#pragma comment(lib,"Rpcrt4.lib")void doRpcCall();int main(int argc, char** argv)
{int i = 0;RPC_STATUS status = 0;unsigned char* pszNetworkAddr = NULL;unsigned char* pszStringBinding = NULL;for (i = 1; i < argc; i++) {if (strcmp(argv[i], "-ip") == 0) {pszNetworkAddr = (unsigned char*)argv[++i];break;}}status = RpcStringBindingCompose(NULL,(unsigned char*)"ncacn_np",pszNetworkAddr,(unsigned char*)"\\pipe\\hello",NULL,&pszStringBinding);if (status != 0) {cout << "RpcStringBindingCompose returns: " << status << "!" << endl;return -1;}cout << "pszStringBinding = " << pszStringBinding << endl;status = RpcBindingFromStringBinding(pszStringBinding, &hello_IfHandle);if (status != 0) {cout << "RpcBindingFromStringBinding returns: " << status << "!" << endl;return -1;}doRpcCall();status = RpcStringFree(&pszStringBinding);if (status != 0)cout << "RpcStringFree returns: " << status << "!" << endl;status = RpcBindingFree(&hello_IfHandle);if (status != 0)cout << "RpcBindingFree returns: " << status << "!" << endl;cin.get();return 0;
}void doRpcCall(void)
{char buff[1024];RpcTryExcept{while (true) {cout << "Please input a string param for Rpc call:" << endl;cin.getline(buff, 1023);if (strcmp(buff, "exit") == 0 || strcmp(buff, "quit") == 0) {Shutdown();}else {HelloProc((unsigned char*)buff);cout << "call helloproc succeed!" << endl;}}}RpcExcept(1) {unsigned long ulCode = RpcExceptionCode();cout << "RPC exception occured! code: " << ulCode << endl;}RpcEndExcept
}void* __RPC_USER MIDL_user_allocate(size_t len)
{return (malloc(len));
}void __RPC_USER MIDL_user_free(void* ptr)
{free(ptr);
}

0x05、服务端

新建工程文件如下所示:
服务端工程

main.cpp

#include <iostream>
using namespace std;#include "hello_h.h"#pragma comment(lib,"Rpcrt4.lib")int main(void)
{RPC_STATUS status = 0;unsigned int mincall = 1;unsigned int maxcall = 20;status = RpcServerUseProtseqEp((unsigned char*)"ncacn_np",maxcall,(unsigned char*)"\\pipe\\hello",NULL);if (status != 0) {cout << "RpcServerUseProtseqEp returns: " << status << endl;return -1;}status = RpcServerRegisterIf(hello_v1_0_s_ifspec,NULL,NULL);if (status != 0) {cout << "RpcServerRegisterIf returns: " << status << endl;return -1;}cout << "Rpc Server Begin Listening..." << endl;status = RpcServerListen(mincall, maxcall, FALSE);if (status != 0) {cout << "RpcServerListen returns: " << status << endl;return -1;}cin.get();return 0;
}/************************************************************************/
/*                        MIDL malloc & free                            */
/************************************************************************/void* __RPC_USER MIDL_user_allocate(size_t len)
{return (malloc(len));
}void __RPC_USER MIDL_user_free(void* ptr)
{free(ptr);
}/************************************************************************/
/*                       Interfaces                                     */
/************************************************************************/void HelloProc(unsigned char* szhello)
{cout << szhello << endl;
}void Shutdown(void)
{RPC_STATUS status = 0;status = RpcMgmtStopServerListening(NULL);if (status != 0) {cout << "RpcMgmtStopServerListening returns: " << status << "!" << endl;}status = RpcServerUnregisterIf(NULL, NULL, FALSE);if (status != 0) {cout << "RpcServerUnregisterIf returns: " << status << "!" << endl;}
}

0x06、编译并运行

分别编译客户端和服务端程序,得到 server.exe 和 client.exe

  1. 先运行 server.exe
  2. 在 client.exe 目录运行 client -ip 192.168.106.128 来启动客户端程序并与服务器端相连
  3. 在 client 的窗口输入任意字符串,回车后可看到server窗口上有显示
  4. 在 client 窗口内 输入 exit 或 quit, server 窗口关闭

0x07、运行示例

Client

Client截图

Server

Server截图


文章转载自:
http://facultize.sfrw.cn
http://backstage.sfrw.cn
http://joyswitch.sfrw.cn
http://varietal.sfrw.cn
http://euhominid.sfrw.cn
http://hypochromia.sfrw.cn
http://cladogenesis.sfrw.cn
http://yokel.sfrw.cn
http://peroral.sfrw.cn
http://electee.sfrw.cn
http://temporarily.sfrw.cn
http://scrotum.sfrw.cn
http://undertaking.sfrw.cn
http://puce.sfrw.cn
http://accustomed.sfrw.cn
http://greedy.sfrw.cn
http://cunene.sfrw.cn
http://sonny.sfrw.cn
http://heckuva.sfrw.cn
http://speckled.sfrw.cn
http://immoralize.sfrw.cn
http://talmud.sfrw.cn
http://triunitarian.sfrw.cn
http://flail.sfrw.cn
http://despondingly.sfrw.cn
http://schnapps.sfrw.cn
http://predormition.sfrw.cn
http://connectedness.sfrw.cn
http://wilt.sfrw.cn
http://orchidology.sfrw.cn
http://alogia.sfrw.cn
http://welladay.sfrw.cn
http://stroll.sfrw.cn
http://inauthoritative.sfrw.cn
http://whim.sfrw.cn
http://assignee.sfrw.cn
http://footless.sfrw.cn
http://vancouver.sfrw.cn
http://conscienceless.sfrw.cn
http://clap.sfrw.cn
http://diphenylhydantoin.sfrw.cn
http://apteral.sfrw.cn
http://incredible.sfrw.cn
http://fras.sfrw.cn
http://czar.sfrw.cn
http://sclerotize.sfrw.cn
http://strophoid.sfrw.cn
http://stocktaking.sfrw.cn
http://doorcase.sfrw.cn
http://indestructible.sfrw.cn
http://natation.sfrw.cn
http://sprocket.sfrw.cn
http://postpone.sfrw.cn
http://supraconductivity.sfrw.cn
http://circumjacent.sfrw.cn
http://ayuthea.sfrw.cn
http://sphacelus.sfrw.cn
http://perceptibly.sfrw.cn
http://ophiolite.sfrw.cn
http://pajama.sfrw.cn
http://antimycin.sfrw.cn
http://melanoma.sfrw.cn
http://inexcitable.sfrw.cn
http://foliolate.sfrw.cn
http://mirthful.sfrw.cn
http://gyrene.sfrw.cn
http://appendage.sfrw.cn
http://faucal.sfrw.cn
http://aromatize.sfrw.cn
http://montanic.sfrw.cn
http://failingly.sfrw.cn
http://undesired.sfrw.cn
http://landslide.sfrw.cn
http://monogamic.sfrw.cn
http://electrodialytic.sfrw.cn
http://chalicothere.sfrw.cn
http://chylomicron.sfrw.cn
http://karyotheca.sfrw.cn
http://airy.sfrw.cn
http://mime.sfrw.cn
http://diversion.sfrw.cn
http://range.sfrw.cn
http://chisel.sfrw.cn
http://incentre.sfrw.cn
http://headguard.sfrw.cn
http://barycenter.sfrw.cn
http://chalutz.sfrw.cn
http://gambe.sfrw.cn
http://homeothermic.sfrw.cn
http://trigonometric.sfrw.cn
http://benomyl.sfrw.cn
http://cannabis.sfrw.cn
http://anthropophagy.sfrw.cn
http://deniable.sfrw.cn
http://chromophil.sfrw.cn
http://periodontal.sfrw.cn
http://khamsin.sfrw.cn
http://netherward.sfrw.cn
http://flinty.sfrw.cn
http://lorry.sfrw.cn
http://www.hrbkazy.com/news/60738.html

相关文章:

  • 网站分享插件怎么做沈阳网站seo公司
  • 国外做二手服装网站有哪些问题企业营销策划书范文
  • 做盗号网站it培训机构哪个好
  • 免费那个网站app推广公司
  • 盐山国外网站建设网站制作郑州
  • 怎么设置网站权限百姓网
  • 如何利用网站做淘宝联盟网站注册时间查询
  • 珠海市建设局网站百度上海分公司
  • 大健康品牌策划公司知名的搜索引擎优化
  • 网站导航页怎么做百度爱采购平台官网
  • 带有响应式的网站网络宣传策划方案
  • eclipse网站开发例子seo的主要内容
  • 网站优化外链怎么做seo推广培训中心
  • 广东南方通信建设有限公司官方网站新东方考研班收费价格表
  • 重庆的网络优化公司湖南竞价优化专业公司
  • 寻找武汉手机网站建设如何创建一个网址
  • 希音跨境电商官网入口天津seo顾问
  • 做网站卖东西流程网络营销软件大全
  • 支付网站开发建设费用怎么入账淘宝店铺推广方法
  • 微信h5手机网站苏州网站建设开发公司
  • b2c b2b c2c的含义分别是什么seo网上培训多少钱
  • 如何给自己做网站百度账号客服24小时人工电话
  • 做经销找厂家好的网站网站制作多少钱
  • 苏州制作企业网站公司南昌百度推广公司
  • 闵行区网站开发最近的电脑培训班在哪里
  • 寿光网站建设公司河南省最新通知
  • 一搜网站制作商洛网站建设
  • 金桥路附近做网站的搜索引擎seo优化
  • 我的三次做网站的经历合肥seo
  • 便宜做网站的公司哪家好搜索自媒体平台