Wednesday, December 23, 2015

Get MBCS Support for Visual Studio Express Edition 2013

Leave a Comment
After a long time, I got a chance to setup Visual studio and code few things.

I could setup Visual studio express edition smoothly but when I tried to compile a ready code, it prompted that the support for MBCS is deprecated from MFC projects and the compilation will block at that error.

It seems Microsoft wants to force use of Unicode and that is good, as lazy devs like me won;t spend time porting code to Unicode unless MS blocks it completely.

However MS has an external library to add support for MBCS.

I got the setup from here:


But when I run this setup, it could not detect the Visual studio and MFC installed on my machine.

At first I thought this library will not work for express edition and I will have to use my MSDN account to setup VS pro edition. But the log file helped me to install this library.

The solution is to create some registry entries that this setup is looking for. After a few trials I managed to get all reg entries in place and the setup installed just fine. Some might not be needed but these does not seem harmful anyway.

Here are list of registry entries that needs to be created. Assume I have typed that registry editing warning that you can read on any MSDN articles.


Create following registry keys and entries:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VC\Servicing\12.0\LibrarySelectableMFC
value:install
type:DWORD
data:1

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VC\Servicing\12.0\New Key #1
value:install
type:DWORD
data:1


HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VC\Servicing\12.0\New Key #1\Install

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DevDiv\vs\Servicing\12.0\Professional
value:install
type:DWORD
data:1

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DevDiv\vs\Servicing\12.0\Professional\install

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DevDiv\vs\Servicing\12.0\vscore
value:install
type:DWORD
data:1

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DevDiv\vs\Servicing\12.0\LibrarySelectableMFC

Good luck!

Read More...

Monday, October 07, 2013

Leave a Comment
Use links to use Windbg

Download WinDbg as a standalone installer
http://www.codemachine.com/resources.html

How to setup windbg as default debugger
http://support.citrix.com/article/ctx107528
Read More...

Thursday, September 06, 2012

Sample Perl Script Mail Send (SMTP) Example For Linux

6 comments
Here is an example perl script to send email from a Linux box.

VERY IMPORTAT: @ symbol in this file MUST be escaped as \@.
for e.g. if you want to hardcode an email id say test@mydomain.com, the email id must be specified as test\@mydomain.com

disclaimer: I have been using this on CentOS 5 systems with perl v5.8.8.

#!/usr/bin/perl
#######################################################
#######################################################
#### The parameters in this file are written by   #####
#### script Createmailscriptattach                #####
#### This program takes 4 arguments               #####
#### 1) Toaddress ,2)FromAddress,3) message       #####
#### 4)subject 5)cc                               #####
#######################################################
#######################################################
use MIME::QuotedPrint;
use MIME::Base64;
use Net::SMTP;

$authenabled = 1;
$mailserver = "mail.mymailserver.com";
$username = "useridforsmtpauthentication";
$password = "passwordforauthentication";
$localhostname = "myfqdn";
$port = 25;
$time = `date`;

$to = $ARGV[0];
$from  = $ARGV[1];


$message  = $ARGV[2];
$sub  = $ARGV[3];
$cc= $ARGV[4];



$smtp = Net::SMTP->new("$mailserver",
                    Hello => "$localhostname",
                    Timeout => 60,
                Port => "$port",
                        Debug => 1);

if ( $authenabled eq 1 )
{
$smtp->datasend("AUTH LOGIN\n");
$smtp->response();

$smtp->datasend(encode_base64("$username") );
$smtp->response();

$smtp->datasend(encode_base64("$password") );
$smtp->response();
}

$smtp->mail("$from");
$smtp->to("$to");
if ($cc ne "") {
$smtp->cc("$cc");
}

$smtp->data();
$smtp->datasend("From: $from\n");
$smtp->datasend("To: $to\n");
if ($cc ne "") {
$smtp->datasend("CC: $cc\n");
}
$smtp->datasend("Subject: $sub\n");
$smtp->datasend("Date: $time\n");

$smtp->datasend("\n");
$smtp->datasend("$message");
$smtp->dataend();
$smtp->quit();
Read More...

Saturday, July 07, 2012

Leave a Comment
NTLM SSO Done.

If anyone is interested, I can provide details
Read More...

Saturday, May 21, 2011

Cross Certificates Problem on Windows7 for driver signing

Leave a Comment
If you are signing a driver on Windows 7, you might landup in getting errors related to incomplete certificate chain.

The solution is to install two additional certs:

1. Save the cert from this URL as .cer and run it to install this alternate CA cert:
https://knowledge.verisign.com/support/code-signing-support/index?page=content&actp=CROSSLINK&id=AR1575
2. If you are using verisign certs, download and extract this file and keep the cer file in the signing directory:
http://download.microsoft.com/download/d/7/f/d7fea3df-4e87-4f8e-b748-212334653028/_MSCV-VSClass3.exe

3. Use the signtool command line as:
signtool sign /ac MSCV-VSClass3.cer /f /p /t  http://timestamp.verisign.com/scripts/timstamp.dll

For certs from our SSL cert providers, refer to my earlier post and search for "cross certificates for Microsoft authenticode"

Read More...

Thursday, May 12, 2011

Binary Signing on Windows 7 64 bit

2 comments
Just writing some quick notes.

Its is compulsary to sign your driver with a digital certificate on Windows 7 64bit edition. In fact it is a good practice to sign all your binaries with a digital certificate that will ensure that your binaries are not modified when user;s run them on their machines.

To sign a binary or a driver, you need a buy a Code Signing certificate from Verisign, Thawte  or other cert providers.
If you are going to sign drivers also, it is recommended to purchase your cert only from Microsoft recommended SSL cert vendors as listed on this site: http://msdn.microsoft.com/en-us/windows/hardware/gg487315#EYAAC

Microsoft though has tried to keep the signing simple, but you still need to understand the cross certificate issue as mentioned on the above link and make sure you have compatible certs setup.

For drivers, More details are provided in a document on this URL: http://msdn.microsoft.com/en-us/windows/hardware/gg487328

For simple binary signing, please search for Microsoft Authenticode signing, or signtool. Always refer to documentation only from microsoft domain sites.
 Though scattered, MS does provide all info.


Read More...

Wednesday, December 08, 2010

Kernel Debugging Windows 7

9 comments
Here are the settings that need to be done in Windows 7 for kernel debugging:

1. start cmd with admin rights
2. run bcdedit to see existing boot entries
3. create a copy of current boot entry. run bcdedit to get the ID of newly created entry.
bcdedit /copy {current}/d "debugboot"
4. set new boot entry as default. run bcdedit again to know the Identifier of this new debugboot entry.
bcdedit /default
5. set debug ON for this entry
bcdedit /debug ON
6. set debug settings: for e.g. for Serial port, COM1 and baudrate 115200
bcdedit /dbgsettings serial debugport:1 baudrate:115200
7. reboot the machine and you are done.

For debugging Windows over a Virtual machine; follow these steps;
1. In your windows guest VM, add a serial port as a named pipe with this end as server and other end as application.
2. create a shortcut of windbg and configure shortcut target as :
C:\WinDDK\7600.16385.1\Debuggers\windbg.exe -b -k com:pipe,port=\\.\pipe\com_1,resets=0





Here is some similar documentation on VMWare site:
http://www.vmware.com/support/ws3/doc/ws32_devices3.html#1023803

documentation on MSDN site:

http://technet.microsoft.com/en-us/library/cc721886%28WS.10%29.aspx



Read More...