M-A's

technology blog

Monday, 10 December 2007

Detect if building with Visual Studio 2005 RTM or SP1

#include "windows.h"
extern char VisualStudio2005ServicePack1Detection[10];
C_ASSERT(sizeof(&VisualStudio2005ServicePack1Detection) == 4);

On VS2005 RTM, sizeof(&VisualStudio2005ServicePack1Detection) == 10.

Wednesday, 5 September 2007

DTE.Debugger is not reentrant

Disclaimer: blogspot is really bad at including code.
I tried to make an auto-debug-child processes in VB.NET in VS2005.

First define the breakpoint,
Function SetBreakPoint(ByVal Symbol As String, ByVal Offset As Integer) As EnvDTE.Breakpoints
Dim x As String = DTE.Debugger.GetExpression(Symbol).Value
' Poor's man calculation in VB...
Dim y As String = "0x" + Hex(CULng("&H" + x.Substring(2)) + Offset)
SetBreakPoint = DTE.Debugger.Breakpoints.Add(y)
End Function

Sub SetAutoDebugChildren()
' Set a breakpoint on function return.
Const offset As Integer = 44
SetBreakPoint("{,,kernel32.dll}_CreateProcessA@40", offset)
SetBreakPoint("{,,kernel32.dll}_CreateProcessW@40", offset)
End Sub

Ok, but I haven't found any programmatic way to set the "When Hit..." flag. So I added them manually after. So right click on the breakpoint, "When Hit..." run a macro and continue execution.

I set the macro to something like this:
Sub AttachToProcesses(ByVal process_name As String)
For Each process As EnvDTE.Process In DTE.Debugger.LocalProcesses
If (process.Name.IndexOf(process_name) <> -1) Then
process.Attach()
End If
Next
End Sub

Sub AttachMyExe()
AttachToProcesses("my.exe")
End Sub

So everything seems nice. The problem is that at the process.Attach() line, I was granted with a nice message box:
---------------------------
Error
---------------------------
A macro called a debugger action which is not allowed while responding to an event or while being run because a breakpoint was hit.
---------------------------
OK
---------------------------

Humm OK. If anyone has a solution beside using WinDbg, please comment.

Tuesday, 4 September 2007

How to wipe free space (note to myself)

cipher /w:c

That works on XP and Vista.

Tuesday, 7 August 2007

Save the earth, kill your AV

Can you imagine how much power would be saved if everyone would uninstall their AV? My personal computers have been running AV-virgin for more than a decade now without an itch. What a relief!

Friday, 20 July 2007

Logitech dinovo edge pairing?

I tried to pair a Logitech dinovo edge with a Dell axim x51v with no luck. In fact, they paired correctly but nothing that I type in gets to the x51. That's pretty sad since the x51v is discontinued, it will never work. If anyone got both to work together, please contact me.

I got it to work with my lenovo T60, I had a hard time though. It seems like you have to type the numbers and press enter FAST, otherwise you won't hear the congratulation beep.
The included dongle works well too. It's just not as useful for portable devices. :)

The upper right Windows key starts Winamp, that's nice. :) The missing "application" (or if you prefer "context menu") key is really bothersome.

[Update 2007-07-26] To pair with the WIDCOMM Bluetooth stack, I had to update to version 5.1.0.3600 (For my W2K3 x64). Before the upgrade, I entered the keypass and nothing happened. On Vista, I installed the 6.0.1.5100 driver and I had no problem. To update the stack, you have to have a device that the manufacturer paid for support. That's pretty sad, given the poor support you have with Windows.

Hint: To backup your driver, look in your %TEMP% directory for a directory created at the moment your started the updater, during installation. Copy it in a safe place just in case and/or for analysis.

Tuesday, 3 July 2007

Free build

For people that wants to build VS2005 projects, Microsoft gave an alternative. It's the Microsoft Windows SDK for Vista. It installs on Windows XP too. You simply start the CMD Shell and type vcbuild to build the solution. It almost works all the time!

Update (2007-07-19): I didn't realize that Microsoft released the Windows SDK Update for Windows Vista which now includes the VS2005 SP1 compiler!

That's great (old) news.

Tuesday, 19 June 2007

HowTo recompress SD800 videos

MJPEG is overkill. It's no doubt. PCM 8 bit 11khz sound is too large too (even if it just sounds bad). So let's recode it.

After lot of trial and failure (no, I don't want to rip my DVDs, only transcode my legal stuff...), I found a good setup:

Using MediaCoder
Use this configuration file. It use xvid for video at 90% quality setting, in AVI container, and reduces noise with a "High quality 3D" noise filter. Well, from what I've looked at, it works. The sound is converted to MP3 so my dvd player will be able to the file (it plays xvid files).

Keywords: 8bit sd600 sd700 Canon transcode transcoding