Debugging CeRAPIInvoke Calls
RAPI (Remote API) dlls are loaded by rapiclnt.exe on the Windows Mobile device when CeRapiInvoke API is called by the desktop application. CeRapiInvoke is a general-purpose API to remotely execute a function on a Windows Mobile device that is connected to the desktop over ActiveSync.
To debug your RAPI dll, do the following.
1. Launch Visual Studio and Open the RAPI dll project (.sln, .vcproj) in debug mode.
2. Go to Debug Menu and click on Attach to process menu item.
3. On the transport screen (see below), change the transport selection to Smart Device.
rapiclnt.exe running on the device
4. On the above screen, select rapiclnt.exe and click on Attach button. This step makes rapiclnt.exe and all modules loaded by it debuggable as long as debugging information is available to the debugger.
5. Now locate the function that you want to debug in source files and insert the breakpoint (or use DebugBreak function) at an appropriate location. You will see the inactive breakpoint icon. It means this module is not currently loaded. Thats okay as we know we have not yet called the function from the desktop application. When the function is eventually called, it will result in loading of the RAPI dll by rapiclnt.exe.
6. Now start the desktop side application. As CeRapiInvoke API is called, breakpoints will become active and you will see the control breaking at the first breakpoint.
From here onwards you can just debug the dll as you would debug normal applications.
Note: If you want debug both desktop application and RAPI dll, you should open the two projects in separate instances of Visual Studio IDE.
How to disable RAPI Security on a Windows Mobile device?
Remote Manager has features to access the Windows Mobile device from the desktop. You can use Remote Manager to access window properties, reset device or capture device screenshots.
The above features cannot be accessed if RAPI (Remote API) security is enabled on the device. Attempting to perform any remote operation with RAPI disabled will bring up the following screen in SureLock Studio.

RAPI Security error
As stated in the message if the error is not due to problem in ActiveSync connection, then it's mostly due to RAPI security setup on the device. To use the Remote Manager features the RAPI security can be disabled on the device. This should be done only for development and testing purposes only.
Remote Manager provides an option to disable the RAPI security. On the Remote Manager screen, click on Device Config button. You should see the following message.

Device Config Message on desktop
As mentioned in the above message, look at the device screen. You should expect to see the following.

Device Configurator on device
On the device, Tap on Turn OFF button to disable RAPI Security. The status text on the device screen will change to Off. Go back to Remote Manager screen in the SureLock Studio on desktop and those features should work without any problems.
Once the SureLock has been tested you can Turn ON the RAPI security again.
