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);
...全文
222 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用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).

19,520

社区成员

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

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