It actually all depends on the project requirements, but I suppose its better to create projects with UNICODE defined and keep your textual data in unicode format. Prefered in my opinion should be UTF-8 which uses less space. If you are loading a text file you should somehow know its encoding type. If you are using Notepad to save text in Unicode format then file contains some extra information bytes about actual encoding type - it is easy to see them in binary file view. Some info on actual notepad format encoding can be found here: http://blogs.msdn.com/michkap/archive/2007/04/22/2239345.aspx[^] There are some other errors in your code that might be the cause of the errory you describe. For example ftell() return length of the file in bytes..., here is a code I got working quite well: wchar_t *gg; FILE *wfile; wfile = _wfopen(L"c:\\ReadMe.txt",L"r"); fseek(wfile,0,SEEK_END); int num = ftell(wfile); fseek(wfile,2,SEEK_SET); int buffSize = sizeof(wchar_t)*(num/2+1); gg = (wchar_t*)malloc(buffSize); memset(gg, 0, buffSize); fread(gg,sizeof(wchar_t),(num-1)/2,wfile); fclose(wfile);
marcinj
Posts
-
UNICODE problem -
UNICODE problemhi, You might want to try: gg = (wchar_t*)malloc(sizeof(wchar_t)*(num+1)); instead of gg = (wchar_t*)malloc(sizeof(wchar_t)*num+1); also, are you sure your file is in UNICODE format where each character is 16 bit wide?
-
Injecting DLL: Windows CEI have not tried using registry for injecting DLL. I tested today the CeAPISpy application (from mentioned web page) and it worked on WM6 (HTCP6500) (hooked were CreateFile, CreateEvent, OpenEvent). I was not able to create any new process while the application was running though. The source code is more up to date than the article, it provides some work around for lack of proper PerformCallBack4 functionality on Smartphones 2005. You might want to check it out.
-
Injecting DLL: Windows CEHooking is doable, look at this article "Spy: A Windows CE API Interceptor": http://www.ddj.com/architect/184405459;jsessionid=XV1DHDS5U3T42QSNDLRSKH0CJUNN2JVN?_requestid=197369 sources can be found here: http://www.forwardlab.com/freestuff.htm they also contain code for injecting DLL to all other processes. They hook: CreateFile, CreateProcess and LoadLibrary I was able to make it work (as I remember also on WM5) also for CreateEvent, EventModify. Here are some API functions lists I found also of use: http://www.xs4all.nl/~itsme/projects/xda/wince-systemcalls.html http://www.xs4all.nl/~itsme/projects/xda/wince-handles.txt