Handle Leak Analysis via WinDbg


This article illustrates how to investigate the handle leak via WinDbg.

The idea is to take two snapshots and compare them to find out the code where handle was allocated during the period.

Read More »

Hide Console Window From Process Start


Copied from here

I had a similar issue when attempting to start a process without showing the console window. I tested with several different combinations of property values until I found one that exhibited the behavior I wanted.

Here is a page detailing why the UseShellExecute property must be set to false.

Under Remarks section on page:

If the UseShellExecute property is true or the UserName and Password properties are not null, the CreateNoWindow property value is ignored and a new window is created.

ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = fullPath;
startInfo.Arguments = args;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;

Process processTemp = new Process();
processTemp.StartInfo = startInfo;
processTemp.EnableRaisingEvents = true;
catch (Exception e)

Written with StackEdit.

Read More »

WinDbg Incorrect Stack Trace


copied from MDA-Anthology Page288.

One of mistakes beginners make is trusting WinDbg !analyze or kv commands displaying stack trace. WinDbg is only a tool, sometimes information necessary to get correct stack trace is missing and therefore some critical thought is required to distinguish between correct and incorrect stack traces. I call this pattern Incorrect Stack Trace. Incorrect Stack Traces usually

  • Have WinDbg warning: “Following frames may be wrong”
  • Don’t have the correct bottom frame like kernel32!BaseThreadStart (in user-mode)
  • Have function calls that don’t make any sense
  • Have strange looking disassembled function code or code that doesn’t make any sense from compiler perspective
  • Have ChildEBP and RetAddr addresses that don’t make any sense

Read More »

Change the Size of a Column in SQL


##How to Changing the size of a column in SQL Server?

ALTER TABLE [table_name] ALTER COLUMN [column_name] varchar(20)

The varchar(20) is just an example column type, you should change it to your real type and size.

Written with StackEdit.

Read More »

How to change the DEFAULT value for a column


###First, drop the existing default constraint if necessary If the column already has a default value, we can get the existing default constraint name from the Table Designer or DDL.

And then we need to drop the constraint using the command shown below:

ALTER TABLE dbo.YouTableName DROP CONSTRAINT TheExistingConstrainName;

###Add a new default constraint

ALTER TABLE dbo.YouTableName ADD CONSTRAINT YourNewConstraintName
DEFAULT YourNameDefaultValue FOR YourColumnName;

Alternatively, you can reuse the TheExistingConstraintName instead of YourNewConstrainName

Written with StackEdit.

Read More »