CeRapiInvoke调用总是返回"无效签名"

cbj6655 2010-01-16 12:55:42
调用CeRapiInvoke时总是返回"无效签名"
源代码都ms支持中心的例子,可是它上面没有写用什么环境编译的.
断点提示: hr 0x80090006 无效签名。 HRESULT

手机端dll代码:(vs2008 VC++ win32智能设备dll)
#include <windows.h>
#include <rapi.h>

extern "C"
{
__declspec(dllexport) int CallMyFunction(DWORD cbInput,
BYTE* pInput, DWORD* pcbOutput, BYTE** ppOutput,
IRAPIStream* pStream);
}

int CallMyFunction(DWORD cbInput, BYTE* pInput,
DWORD* pcbOutput, BYTE** ppOutput,
IRAPIStream* pStream)
{
MEMORYSTATUS structMemStatus;
DWORD dwMemAvailPhys;
char szFree[10];
//Initialize buffer to all NULLs
ZeroMemory(szFree, 10);
GlobalMemoryStatus(&structMemStatus);
dwMemAvailPhys = structMemStatus.dwAvailPhys;
sprintf(szFree, "%d", dwMemAvailPhys/1024);
//Provide extra char for NULL
*ppOutput = (BYTE*)LocalAlloc(LPTR, strlen(szFree)+1);
if(*ppOutput)
{
//Copy along with NULL
strncpy((char*)*ppOutput, szFree, strlen(szFree)+1);
*pcbOutput = strlen(szFree) + 1;
}
else
*pcbOutput = 0;
return 0;
}


调用代码:(vs2008 VC++ win32智能设备控制台)
DWORD	cbOut;
BYTE* pOut;
HRESULT hr;

//Initialize Windows CE RAPI
hr = CeRapiInit();
//Invoke CallMyFunction routine in MyRapi DLL in the \Windows directory.
hr = CeRapiInvoke(L"RapiServ", L"CallMyFunction",
0, NULL, &cbOut, &pOut, NULL, 0);
if(cbOut)
printf("Your device got %s KB of Physical Memory available", pOut);
else
printf("No memory available in the device");

//Uninitialize Windows CE RAPI
hr = CeRapiUninit();
//Free the DLL allocated memory.
if(pOut)
LocalFree(pOut);
...全文
214 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
guopeixin 2010-01-18
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 cbj6655 的回复:]
引用 4 楼 guopeixin 的回复:
哦,又查了一下,确实应该是mobile上的
================
1. On the Project menu, click Properties.
2. Click Authenticode Signing.
3. For the Authenticode Signature property, click Yes.
4. For the Certificate property, click the Ellipses (...) button.
In the Select Certificate dialog box, do one of the following:
>> If the certificate you want appears in the list, select it, and then click OK.
>> If the certificate you want does not appear in the list, click Manage Certificates to open the Manage Certificates dialog box. Use this dialog box to import one of the SDK certificates (or import the certificate an OEM or mobile operator gave you as part of its developer program).

Note: 
Be sure to use the *.pfx file, not the *.cer file. 

On the Authenticode Signing page, click OK.



你这个在哪里找到的?
[/Quote]
是在Mobile6帮助文档中
Windows Mobile Powered Device Security Model > Certificate Management in Windows Mobile Powered Devices > Certificate Management and Application Signing for Application Developers > To sign a C or C++ application这一章节中找到
cbj6655 2010-01-16
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 guopeixin 的回复:]
哦,又查了一下,确实应该是mobile上的
================
1. On the Project menu, click Properties.
2. Click Authenticode Signing.
3. For the Authenticode Signature property, click Yes.
4. For the Certificate property, click the Ellipses (...) button.
In the Select Certificate dialog box, do one of the following:
>> If the certificate you want appears in the list, select it, and then click OK.
>> If the certificate you want does not appear in the list, click Manage Certificates to open the Manage Certificates dialog box. Use this dialog box to import one of the SDK certificates (or import the certificate an OEM or mobile operator gave you as part of its developer program).

Note: 
Be sure to use the *.pfx file, not the *.cer file. 

On the Authenticode Signing page, click OK.

[/Quote]

你这个在哪里找到的?
guopeixin 2010-01-16
  • 打赏
  • 举报
回复
哦,又查了一下,确实应该是mobile上的
================
1. On the Project menu, click Properties.
2. Click Authenticode Signing.
3. For the Authenticode Signature property, click Yes.
4. For the Certificate property, click the Ellipses (...) button.
In the Select Certificate dialog box, do one of the following:
>> If the certificate you want appears in the list, select it, and then click OK.
>> If the certificate you want does not appear in the list, click Manage Certificates to open the Manage Certificates dialog box. Use this dialog box to import one of the SDK certificates (or import the certificate an OEM or mobile operator gave you as part of its developer program).

Note:
Be sure to use the *.pfx file, not the *.cer file.

On the Authenticode Signing page, click OK.
guopeixin 2010-01-16
  • 打赏
  • 举报
回复
这是mobile上的吧?
91program 2010-01-16
  • 打赏
  • 举报
回复
LZ不错啊,学习
宇帆 2010-01-16
  • 打赏
  • 举报
回复
学习
cbj6655 2010-01-16
  • 打赏
  • 举报
回复
自己搞定拉~~~
Go to the project properties under the "Authenticode Signing" and set:

Authenticode signature: Yes
Certificate: TEST USE ONLY - Sample Privileged... (you may have to import it from the SDK dir)
Provision device: Privileged certificate store

Also, please check if your device has RAPI policy enabled (Tools / Device security manager in VS 2008).
提供的源码资源涵盖了Java应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 适合毕业设计、课程设计作业。这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。 所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答!

19,502

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 嵌入开发(WinCE)
社区管理员
  • 嵌入开发(WinCE)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧