使用 RAPI 通过 PC 传输文件到 WinCE 7 的设备上,并运行都没有问题。
但在调用 CeRapiInvoke() 函数时失败,返回的错误代码是:E_ACCESSDENIED。
记得此工程以前在 WinCE 6 上是可以正常使用的,但是在 WinCE 7 上失败了。
MSDN 帮助文档:
Windows Embedded Compact 7 > Reference > Networking >
Calls to this function are blocked by the default security policy settings. To enable this function, you must change Remote API (RAPI)
security policy from Restricted to Allow. For more information see Remote API Reference.
To add this feature to your OS, see RAPI Catalog Items and Sysgen Variables
(ms-help://MS.VSCC.v90/MS.VSIPCC.v90/MS.WindowsCompact.v70.en/WECP_Ref_Network/html/9ec83ef4-dc54-44c3-baf3-ba06c5d94169.htm).
The configuration settings for RAPI security policy are set to restricted mode by default. You can configure RAPI security policy by
updating the following configuration settings.
ID: 4097
RAPI Policy: SECPOLICY_RAPI
This setting limits access from remote applications that use RAPI to implement ActiveSync operations on Windows Embedded Compact 7
devices. Default value is 2 for Compact 7. The following list shows the possible values: 0 Blocked. Indicates that the ActiveSync
service is shut down. RAPI calls are rejected. 1 Allow. Indicates full access to ActiveSync is provided. RAPI calls are allowed to
process without restrictions. 2 Restricted. Indicates that access to ActiveSync is limited. Calls to CeRapiInvoke (RAPI) are blocked,
the HKLMcommsecurity registry key and its subkeys are read only, and the file defined in the HKLMInitBootvars"Systemhive"
registry setting is read only.
The required role to modify this policy is SECROLE_MANAGER.
以上具体偶没有进行实验与测试,最后是通过 TCP 来完成通讯的,而不是初期设想的 RAPI。