title: C++/C#/Win32_API - Delete Disk Volume/Partition - debug?
body: <p>I'm trying to use <a href="http://msdn.microsoft.com/en-us/library/aa363915%28v=vs.85%29" rel="nofollow">DeleteFileW</a> to remove a disk volume, which <a href="http://msdn.microsoft.com/en-us/library/aa363983%28v=vs.85%29" rel="nofollow">according to the docs</a> is the function I should use.</p>
  
  <p>I used WMI calls to Win32_Volume to get the device ID, which if i tack on a file it works correctly.</p>
  
  <p>However, if I provide just the volume ID, I get an error 5, Access Denied.
  I assume there is some preparatory work that needs to be done before I can delete it, but I cant figure out what.
  I was thinking of attaching a debugger to DiskPart but since the DeleteFile function would be the last call I dont really know how to set a breakpoint to catch all the stuff before that. Also, I'm not awesome with the debugger.</p>
  
  <p>So, the question is how do I delete a volume, or how do I setup the debugger to trap the deletion so I can read the previous function calls?</p>