Hi, have fun! Different flavors of "Windows CE based" systems come with different sets of functions implemented in system provided default DLLs: http://en.wikipedia.org/wiki/Windows_ce
Hence, it often happens that a user added DLL / EXE will not run on the user's system, just because it requires a specific function to be imported from some specific system default DLL, which is not implemented on the user's system. In such case, one gets a mysterious message "File is not a valid Windows CE application", often bundled with a mysterious error message "GetLastError returns c1" (the "0xc1", decimal "193", error is called "ERROR_BAD_EXE_FORMAT", it is defined in the "winerror.h" file). How to find any missing "DLL imports"? You can find the ultimate answer below! 1. Get the free PC utility "Dependency Walker": http://dependencywalker.com/ Although it is a PC utility, it can also "scan" Windows CE libraries and executables. What one needs to do is to open the "Options -> Configure Module Search Order" window, remove all "standard PC Windows subdirectories" from there, and add one's own (which hold WinCE DLLs). Then, one can "Save..." these settings, in order to easily run the "Dependency Walker" later, giving it the "saved module search order" as a command line parameter. See the "Will Dependency Walker work with Windows CE modules?" in: http://dependencywalker.com/faq.html and read this: http://dependencywalker.com/help/html/hidd_search_order.htm and this: http://dependencywalker.com/help/html/hidr_command_line_help.htm Note that, in order to "resolve" all dependencies, you will need to have a copy the WinCE DLLs, provided by YOUR OWN WinCE system in the "\Windows" subdirectory, in the PC (as these libraries reside in ROM, they cannot be simply copied to the PC using the ActiveSync, you cannot even copy them entirely inside of the WinCE system). 2. Get the free "ROM Extractor" utility: http://forum.xda-developers.com/showthread.php?p=1571715 This utility can extract DLL / EXE / CPL / ... modules from ROM (files which have FILE_ATTRIBUTE_ROMMODULE, which cannot be copied by using a file manager nor by the ActiveSync). Copy these "extracted" modules (preserving their original names) into the PC (using the ActiveSync, or via the SD Card), put them into a separate subdirectory, and use the "Add Directory" button in the "Options -> Configure Module Search Order" window (of the "Dependency Walker"), in order to add this subdirectory to the "Current Search Order". There are two things, I need to mention here. Although my CPU is an "ARM", the "extracted modules" are marked as "Thumb". This fools the "Dependency Walker" a bit - it will mark all of them in red, to notify the user that the CPU types do not match. I do not know if this "Thumb" signature is really put in my ROM, or is it just the "ROM Extractor" which does it. The solution, however, is very simple. Just take any tool that can edit binary files (I use the free "GNU Midnight Commander") and change one byte, or two, in each DLL (which define the CPU). Very close to the beginning of the DLL file, you should find a sequence of bytes in form (usually inside of the first 256 Bytes): 0x50 0x45 0x00 0x00 0xC2 0x01 ("0x50 0x45" = "PE") The sequence "0xC2 0x01" means "Thumb" CPU, so we need to change it into "0xC0 0x01", which means "ARM" CPU (just one single Byte): 0x50 0x45 0x00 0x00 0xC0 0x01 The second thing to mention is related to the usage of the "ROM Extractor". On my WinCE system, it keeps closing the "Input Panel" (i.e. the "Keyboard"), so that I cannot enter the "Save to:" output file. The solution is to open the "Input Panel" manually, BEFORE starting the "ROM Extractor" executable (then the "Keyboard" remains available all the time). And voila, you can use the "Dependency Walker" to trace your problems! For the completeness of this description, let me add the following. 3. There exists a simple free, "command line" driven, WinCE utility called "Executability Check": http://www.geocities.co.jp/SiliconValley-Cupertino/2039/ which can be helpful (it checks which libraries are needed and it can "rewrite" both, the library name and it's version), but using it is a pain. Moreover, as this utility is NOT able to read system DLLs, it will not tell you which function is missing (if any), nor it will tell you which functions are provided by the system default DLLs. Note, this is really a "command line" driven utility. It NEEDS to get the name of the DLL / EXE file (to be "inspected") in the command line (as a parameter). It will not start without this parameter. 4. There exists a more advanced free WinCE tool called "PEInfo": http://s-k-tools.com/index.html?m_products.html It will provide you with many informations about your DLL /EXE, including the list of imported functions. However, as this utility is NOT able to read system DLLs, it will not tell you which function is missing - it does NOT even check whether the required function (to be imported) is actually exported by the system DLL - as soon as it finds the required DLL, it will simply happily assume that all required functions are provided. (I believe that the whole text given above should be put in some kind of a FAQ on the CeGCC web page.) (Note also that, the current CeGCC has problems with the "Dependency Walker", due to the missing ".dll" file name extensions, as reported by me earlier.) Hope it helps, Best regards, Jacek. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Cegcc-devel mailing list Cegcc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cegcc-devel