Code-ing

Getting BadImageFormatException in 64-bit Windows?
17 January 2008 in .NET in general & Code-ing | Comments (1)

Have you been running/developing .NET programs in 64-bit Windows and met the BadImageFormatException? Well, Microsoft might say: “The exception that is thrown when the file image of a DLL or an executable program is invalid.” Which says absolutely nothing… :)

However, if it happens when using Platform Invove (P/Invoke or DllImport) or a third .NET party library (DLL) then you might have to set the project’s properties (or compilation flags) from “any” platform target to “x86″. Also, remember to set change to x86 in both the debug and release build configurations while you are at it, otherwise it might seem to only work when you are debugging and not in release compilation.

(This happened to me when I used a .NET code library for a LabJack device in a program and ran the program under 64-bit Vista. Couldn’t find what the nature of the problem “really” was… )

AnySee Tuners Works in Mysterious Ways
9 August 2007 in Code-ing | Comments (0)

If the source I read is correct, then it seems like the AnySee tuners really work in mysterious ways.

Regular DVB tuners have a Common Interface (CI) that is in some cases used together with an additional encryption card (Conax, Viaccess) and a subscriber card can decode a digital TV signal on-the-fly. The result (except an empty wallet) is an almost transparent decoding process for the digital TV software like MediaPortal or ProgDVB.

AnySee is sold in Finland as an integrated digital TV tuner with combined Conax card decoder all-in-one, but it doesn’t work in the above scenario. The same AnySee USB digital TV tuner can be used with virtually any encryption technology (in theory) that uses a smart card for pay-TV subscribers. The only thing you will need to change is the AnySee software when you change encryption technology. So, to make it short, the AnySee plus models are infact digital TV tuners with integrated smart card reader.

According to the source, AnySee has licensed the technology for Conax encryption (amongst others) and uses a software-based Conax card access module (or SoftCAM) to decode the encrypted TV channels in the AnySee TV software. This is also a reason for why AnySee will (or cannot) give out a SDK for the AnySee tuners. This in turn means that MediaPortal and ProgDVB plus the Linux DVB driver community cannot use the AnySees to the fullest potential. Granted, from what I’ve seen in the MediaPortal forums, it seems like the lead developer will sooner or later have to re-include the SoftCAM feature soon, if they are going to support AnySee and Hauppauge’s external USB CI reader.

Anyways, it is probably quite easy for anyone with the law on their side to reverse engineer the USB protocol the AnySees use to read the smartcards. The problem might be getting it working automagically with MediaPortal and on other platforms. Fortunately, this is not my problem… I’ll just stick to the slow, buggy, AnySee TV tuner program… :)

 

Source [Min Hem Bio forums]

Windows Calendar and Google Calendar Are Working Fine With iCalendar(s)
23 January 2007 in Code-ing & Root | Comments (0)

With Windows Vista, you will now get a — quite nice — calendar program called Windows Calendar. It looks a lot like Apples iCal.app and probably has gotten a nice amount of inspiration from Apple once again, but that is beside the point. I tested my iCalendar and vCalendar generator that I use in Dingo, and found a bug in Windows Calendar. It seems that Windows Calendar doesn’t parse the characters correctly, and in the attached screenshot you can see that there are boxy looking characters where the character “ä” should be.

Windows Calendar

Not only that, Windows Calendar only supports iCalendar, no vCalendar. I suppose that it is a good thing going from vCalendar version 1.0 to 2.0 (aka. iCalendar).

Windows Calendar vCalendar error

I also tried out Google Calendar’s iCalendar support and it seems like they’ve finally fixed a bug in their iCalendar parser. I could upload a single iCalendar file with all my course “appointments” to Google Calendar and it inserted every single one, no buts about it. The Google Calendar team are worthy of an applaude for fixing it in a year (which is the time since I last tried it). :D

Google Calendar just works... finally

Making a Better File Manager
24 February 2006 in Code-ing | Comments (0)

The Windows Explorer (aka. File Explorer) is completely useless at times. Especially when opening a folder with special characters (but not forbidden such) my Windows Explorer has been crashing and DEP:ing around way, way too much. So much, I had to open the command prompt to edit all the files name to something short that shouldn’t crash the Exploder. ;)

Now I’ve been designing the GUI for my own file manager, which is still without a name. It will be a better, maybe faster file manager than Explorer currently is and support some features that I’ve been missing for years. As a hint, I can say that the GUI will be nothing like File Commander, nor Windows Explorer like. I won’t call it revolutionalizing, since it will be using the best features from other programs and operating system. I won’t even set a date to when it will be released, since I don’t have time to meet deadlines. But, I’m looking at making it operating system independent using C# (of course).

Time will tell how things will look for this app… ;)

Cool App: C# Programmable Calculator
20 February 2006 in .NET in general & C# & Code-ing | Comments (0)

Say bye, bye to Windows’s standard calculator and say hello to the C# Programmable Calculator. C# Programmable Calculator is a reverse Polish notation calculator where you can customize (most) button functions by just reprogramming them in the C# programming language. And that is quite some fun! :cool:

C# Programmable Calculator

The whole source code is available on the website as well as the finished compiled product. It requires .NET framework 2.0, and Visual Studio 2005 to edit the source (or, SharpDevelop might suffice).

New Year, New Vulnerabilities
2 January 2006 in Code-ing & Security | Comments (0)

This new year started off in great fashion, with a new vulnerability discovered in Microsoft Windows that affects every computer out there and is ridiculously simple to use. The bug in WMF-files is that the file format itself allows code to be executed on all computers running Microsoft Windows. The best part of the bug is that it is a feature from way back in Windows 3.0 (1990)! 8O

According to F-Secure’s weblog:

The feature now in the limelight is known as the Escape() function and especially the SetAbortProc subfunction. This function was designed to be called by Windows if a print job needed to be canceled during spooling.

This really means two things:
1) There are probably other vulnerable functions in WMF files in addition to SetAbortProc
2) This bug seems to affect all versions of Windows, starting from Windows 3.0 - shipped in 1990!

The (Unofficial) Fix

The fix to this security hole is already available, but not from Microsoft but from the author of IDA, Ilfak Guilfanov. Here is a link to an installer of the unofficial patch:
http://www.hexblog.com/security/files/wmffix_hexblog13.exe

I have downloaded and installed the patches, just to be safe when I’ve gotten Google Desktop running. FYI: Google Desktop will be indexing and thus run any malicious code in WMF-files that you view in a browser or get via email, so you better disable indexing (in GD preferences), uninstall Google Desktop (recommended by F-Secure) or install the patch ASAP.

Hallelujah! The Pocket PC Emulator Is Alive Again!
26 April 2005 in Code-ing & Pocket PC | Comments (1)

I’ve been having hard times getting the Windows Mobile 2003 Second Edition Pocket PC emulators (and all other versions) working in Visual Studio .NET 2003. I tried my usual remedy of uninstalling “Smart devices support” from both VB.net and C# and restarting, then reinstalling the support — but this time that didn’t solve my problem:

One or more files from the Emulator for Windows CE installation is missing. Please reinstall Emulator for Windows CE and try again.

So, I did a Goo… uhum, I mean a search for the error message and found this:

Workaround: Go to “Device Manager” (Right-click on “My Computer”, select Properties->Hardware and press the “Device Manager” button) and check whether “Virtual PC Application Services” is installed under the System Devices group. If the driver is not installed, install it by running “\CompactFrameworkSDK\ConnectionManager\Bin\DriverInstall\Smart Devices Emulator.msi”.

I tried it, and lo-and-behold it works instantly! A big thanks goes out to the Open NETCF Wiki where I found the solution! :D

Monoppix - Combining Knoppix With Mono And MySQL
8 March 2005 in Code-ing | Comments (0)

Monoppix is a live Linux distribution that you can run on any computer with a CD-ROM station and without installing it on the hard drive! Monoppix is based on the live Linux distro Knoppix but with the addition of Mono, a Mono variant of ASP.NET and MySQL database server. It is run completely of the CD and uses the RAM of your computer as temporary storage place, plus it can also use USB memory and burn to CD’s the files that you would like to have for future use. ;)

I gave Mono a spin, and this is how it looked:
Monoppix in action (click for bigger picture)

When testing it, I must say that I was impressed by the speed of Monoppix running inside a trial version of Virtual PC. Heck, there was no apparent lag at all from what I could see! 8O

If you’re into .NET and wish to try out Mono, then this is the Linux distro you should use. Alas, Mono doesn’t fully support Windows.Forms yet, so you can not run graphical .NET applications on it yet. :( Furthermore, C# knowledge is more or less required for compiling just about anything in Mono. You can download the Monoppix ISO using Bittorrent, or using one of the slower HTTP downloads.

Hacking The Pocket Loox 720 Camera Driver
25 February 2005 in Code-ing & Pocket PC | Comments (1)

One of the problems with using the integrated 1.3 megapixel camera on the Fujistu-Siemens Pocket Loox 720 in third party software was that there was no documentation available from FSC about the camera. FSC should follow HP’s example and put up a website with more info about their hardware for developers, but they still haven’t done so and I doubt that they will ever do that. :(

But hey, the camera needs a driver, and the DLL file goes by the name of HTXcamera1.dll, so why not do and swim around the OP codes of the driver? I did, using a freeware hex editor suitably named XVI32 (if you don’t get it, then think Roman numerals). What did I find? Well, the driver should allow external calls (not a surprise), but not in the same way as other HTC manufactured Pocket PCs, like the iMate Pocket PCs.

Hex-a-round in the Loox's driver...

What I found were these methods that are probably possbile to call directly from the driver DLL:

    Camera_Begin - Starts the camera, or takes a photo. Remains to be seen…
    Camera_Deinit - Deinitializes the camera and probably shuts it down so it doesn’t eat the battery the whole day.
    Camera_End - Sort of “closes the shutter” (if this was an analog camera)? Or calls the Deinit function?
    Camera_FlashLight - Has got something to do with the LED flash (duh!).
    Camera_GetProperty - Probably for getting the image quality currently set.
    Camera_Init - Initializes the camera. (A no-brainer… :P )
    Camera_SetProperty - Probably for setting the image quality to use, or if we want to record a video.

What I missed is a Camera_Start since there is a Camera_End function. :? Where is it, if not in the driver?

Oh well, with this info in the public, I hope that someone with more times on their hands can write a .NET class library for us to use in our .NET apps. ;) I would write this myself, if I only had time for such things… :D Also, maybe someone with contacts should get this to Microsoft Research so that they can update Microsoft Portrait to use the Loox’s camera.

Dingo Approaching Proof-of-Concept Stage
31 January 2005 in Code-ing | Comments (0)

My hard work seems to be paying off, with my project “Dingo” soon approaching public release beta. What is Dingo? Well, it is a program that is capable of downloading the timetables (or schedules) that one has stored in my univerisity’s schedule planning web page, called Wompat (refferring to the animal called wombat — don’t ask my why). With me still? Good. Now, the problems I (and more others) faced with Wompat was that there was no automated way of inserting the schedule into your personal scheduling program (Outlook, iCal, you name it), PDA and/or phone.

Dingo Main application -- a screenshot from the latest build as of publishing this post

Dingo is the program that is designed to solve this problem. Currently I am experimenting with getting a transistion from week number and the weekday to a complete date. (Our university plans courses by the week number, not by the dates) So far, I’ve gotten it working for the year 2005 and any other year which doesn’t end or start on a Thursday and/or a leap year. Not perfect yet, but I’m getting there.

The next exiting phase is the generating of iCalendar, vCalendar and Outlook appointments for the exact dates of the courses. My homemade iCalendar/vCalendar generators seem to work nicely, although Outlook doesn’t like my iCalendar files but the vCalendar files (strange, in a way). :? The direct inserting into Outlook is also working fine and no major problems there.

A feature which I’m especially proud of is the automatic downloading of the schedule webpage. See below for the current implementation. This was the trickiest part to execute, codewise, as Wompat utilizes cookies and server-side codes hidden in the HTML code to get the timetable for, e.g. spring 2005 and listing the full schedule. (It is even more trickier to describe how it works on the server. :roll: )

The Dingo Wompat downloader

But, thankfully coding all of this using C# and .Net technologies has made it easier than it is for me to get my Java applet to connect to a MySQL server (does it have to be so impossible for me?). I will have to see how well this will work on Mac OS X running dotGnu and whether dotGnu’s .Net and Windows.Form implementation is complete enough for Dingo to run unmodified.

However, that is currently second priority as there are some things I have to download before being able to compile dotGnu on Mac OS X and I don’t have the energy to compile anything currently. Still, seeing this small one-man-project drawing to a close, I can’t help but saying that “these are exiting times indeed”. ;)


  •  

    October 2008
    M T W T F S S
    « Mar    
     12345
    6789101112
    13141516171819
    20212223242526
    2728293031  
  • Categories