David, in case you don't follow the svn commits I thought I'd give you a heads up on this.
I recently committed a new api to librapi2 based on David Eriksson's suggestion of using the MS rapi2 api. It's definitely not finished, but it does work. In particular most of the utility functions don't work, reference counting is dodgy, and the error codes need some work, but all of the previously implemented session functions should be fine. If you want to give it a go you'll need the svn of libsynce as well. The attached program should give you the idea. Let me know what you think. Mark
#include <stdlib.h> #include <rapi2.h> #include <synce_log.h> int main() { synce_log_set_level(SYNCE_LOG_LEVEL_HIGHEST); HRESULT hr; IRAPIDesktop *desktop; hr = IRAPIDesktop_Get(&desktop); if (FAILED(hr)) { synce_error("failed to get IRAPIDesktop: %d: %s", hr, synce_strerror(hr)); return 1; } IRAPIEnumDevices *enumdev = NULL; hr = IRAPIDesktop_EnumDevices(desktop, &enumdev); if (FAILED(hr)) { synce_error("failed to EnumDevices: %d: %s", hr, synce_strerror(hr)); return 1; } ULONG count = 0; hr = IRAPIEnumDevices_GetCount(enumdev, &count); if (FAILED(hr)) { synce_error("failed to get device: %d: %s", hr, synce_strerror(hr)); return 1; } synce_debug("enum count = %d", count); IRAPIDevice *device = NULL; hr = IRAPIEnumDevices_Next(enumdev, &device); if (FAILED(hr)) { synce_error("failed to get device: %d: %s", hr, synce_strerror(hr)); return 1; } IRAPISession *session = NULL; hr = IRAPIDevice_CreateSession(device, &session); if (FAILED(hr)) { synce_error("failed to get session: %d: %s", hr, synce_strerror(hr)); return 1; } hr = IRAPISession_CeRapiInit(session); if (FAILED(hr)) { hr = IRAPISession_CeRapiGetError(session); synce_error("failed to init session: %d: %s", hr, synce_strerror(hr)); return 1; } LPWSTR wstr = malloc(sizeof(WCHAR) * MAX_PATH); BOOL bRet = IRAPISession_CeGetSpecialFolderPath(session, CSIDL_PERSONAL, MAX_PATH, wstr); if (!bRet) { hr = IRAPISession_CeRapiGetError(session); if(FAILED(hr)) { synce_error("failed to call function: %d: %s", hr, synce_strerror(hr)); return 1; } DWORD dwErr = IRAPISession_CeGetLastError(session); synce_error("function failed: %d: %s", dwErr, synce_strerror(dwErr)); } else { synce_debug("success!!"); char *str = wstr_to_utf8(wstr); synce_debug("CSIDL_PERSONAL = %s", str); free(str); } IRAPISession_CeRapiUninit(session); IRAPISession_Release(session); IRAPIDevice_Release(device); IRAPIEnumDevices_Release(enumdev); IRAPIDesktop_Release(desktop); return 0; }
signature.asc
Description: This is a digitally signed message part
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________ SynCE-Devel mailing list SynCE-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/synce-devel