Shiny New E-Book Gizmo: The Amazon Kindle


View Full Version : Logging ebookUsb.dll calls


geekraver
10-21-2006, 02:22 AM
If anyone is interested, I have made a replacement ebookUsb.dll that can be dropped in to the reader software directory. It logs all the calls into the DLL to a file c:\reader.log (and then calls into the real DLL; i.e. its just a thin wrapper).

Note that you *will* need to modify your existing ebookUsb.dll, changing the name to ibookUsb.dll, and changing the first letter of each entry point to be an I (so the Usb* functions become Isb* and the CheckBlock function becomes IheckBlock). Obviously you should keep a backup first. I'm not including a patched version of the original DLL due to copyright and other restrictions.

VS.Net project is available here (http://www.geekraver.com/ebookUsb.zip) . You can also use this to set breakpoints in calls in the VS debugger, etc. I did this mostly to figure out why my prsutils prog isn't copying files, but it could be useful to others who want to take things much further than I'm interested in going.

gseryakov
10-21-2006, 07:54 AM
Note that you *will* need to modify your existing ebookUsb.dll, changing the name to ibookUsb.dll, and changing the first letter of each entry point to be an I (so the Usb* functions become Isb* and the CheckBlock function becomes IheckBlock).

You can avoid the binary editing: use run-time dynamic linking (LoadLibrary/GetProcAddress). Another possibility could be (I am not 100% sure about it) to create a custom export lib with exports renaming like

; ibookUsb.def
LIBRARY "ibookUsb"
EXPORTS
...
IheckBlock = CheckBlock
...

dstewart
12-29-2006, 07:25 PM
I modded the file to use LoadLibrary/GetProcAddress instead, which means you don't need to modify the original ebookUsb.dll in any way except temporarilty renaming it to ebookUsb.org.dll. However, I hesitate to release it as it crashes after a while :rolleyes5 ... I'll track that down -- but in the meantime, geekraver, as you seeing the same with your code? (seems to run fine for a while but then crashes after a call to UsbBeginEnd?)

kovidgoyal
12-29-2006, 07:35 PM
You can also log the actual USB packets for more information using one of the many freely available USB packet sniffers.

geekraver
12-30-2006, 12:06 AM
I modded the file to use LoadLibrary/GetProcAddress instead, which means you don't need to modify the original ebookUsb.dll in any way except temporarilty renaming it to ebookUsb.org.dll. However, I hesitate to release it as it crashes after a while :rolleyes5 ... I'll track that down -- but in the meantime, geekraver, as you seeing the same with your code? (seems to run fine for a while but then crashes after a call to UsbBeginEnd?)

Haven't used this in a long time so I'm not sure, but I don't recall seeing crashes.

Guess you finally got yourself a reader for Xmas, eh Dave?