Computing on GPU – DirectCompute

A while back, I blogged about offloading computation traditionally done on CPU to GPU. Here is an excellent presentation from Chas Boyd at PDC 2009 about DirectCompute, which enables a DirectX 11 application to use GPU for computing tasks. The presentation not only gives an overview of a typical GPU, but also shows among other things High Level Shader Language (HLSL) sample code demonstrating how to dispatch a simple task to GPU and get the results back into main memory from GPU memory. HLSL compilation can be done with fxc or D3DX11CompileFromFile.

Read the rest of this entry »

Physical Memory Imaging

I came across this interesting 2007 paper on Live Memory Acquisition for Windows Operating Systems by Naja Davis that shows some of the tools and techniques used by forensics analysts1 to get at the physical memory and analyze memory contents to get list of processes, threads, files, passwords and other data in memory.
Read the rest of this entry »

A tale of two asserts

There are two popular ways to assert in drivers. One can use the the regular ASSERT macro (int 3) or the relatively newer NT_ASSERT macro (int 2C). Since ASSERT calls RtlAssert, when the debugger breaks in, code would be several frames off of where the ASSERT was. If you use NT_ASSERT however, the debugger would stop right where  NT_ASSERT was called in the code.  That is a nice convenience since you do not have to issue several
Read the rest of this entry »

Deleting a file/directory

How do you delete a file or directory1 in Win32/64 ? You have primarily three options -

  1. DeleteFile, RemoveDirectory
  2. MoveFileEx (…, MOVEFILE_DELAY_UNTIL_REBOOT…)
  3. CreateFile (…, FILE_FLAG_DELETE_ON_CLOSE…)  followed by CloseHandle

First of all DeleteFile cannot be used to delete a directory, you are supposed to use RemoveDirectory instead. If you pass a directory path to DeleteFile, the call fails and GetLastError returns error 5 (ERROR_ACCESS_DENIED) which is rather befuddling when you hit it for the first time. This happens even if the logged on user has  DELETE access permissions for the directory. So what gives ?
Read the rest of this entry »

Conditional breakpoints in WinDbg

When tracking down a very specific issue in a driver (which typically means very low signal to noise ratio) conditional breakpoints in WinDbg tend to the the first thing to use before resorting to modifying driver source with additional tracing code and rebuilding driver.

For example, one of the frequent challenges for file system filter drivers is to track down operations on a specific file. What I resort to in that case is to latch onto the file path length1 largely because string comparisions would take longer than comparing length. Consequently the conditional breakpoint template that I use is along the lines of the following –
Read the rest of this entry »

How is Windows 7 Built ?

As Windows 7 nears1 RTM, Technet interviews Windows 7 Build Engineer Istvan Cseri about Microsoft’s massive build infrastructure for building Windows 7.  For the daily build of Windows 7, it takes about 30 machines (about 10 machines each for x86, amd64, ia64) 12 hours to produce 13TB (3300 ISOs) of build bits for different SKUs (including Server 2008 R2) in 36 languages.
Read the rest of this entry »