Remove duplicated line in snprintf() which causes a crash introduced by
the commit 1177281049e8bb3df5992da5dc1ca31ad892082e.
Add a check for NULL dereference pointed out by Pluto Cobain.
It's for safety though I don't think it would occur.
Cleanup the code for *test* button and add the functionality to test
MSDTC support.