Fernando_Gomez 0 Newbie Poster

Hi:
In the application I'm building i use a FileSystemWatcher to monitor changes in any inserted USB flash memory, a FileSystemWatcher is created and started every time a usb flash memory is inserted, my code correctly registers the devices to receive the DBT_DEVICEQUERYREMOVE event from windows so i can unregister the device and stop the FileSystemWatcher assigned to it so it can be safely removed, the problem occurs when I try to find out which device is being removed, I use this line of code to find out the handle of the device querying for removal:

Dim vol As DEV_BROADCAST_HANDLE = CType(m.GetLParam(GetType(DEV_BROADCAST_HANDLE)), DEV_BROADCAST_HANDLE)  

and this is the declared structure that I'm trying to Marshal to:

 <StructLayout(LayoutKind.Sequential)> _
        Public Structure DEV_BROADCAST_HANDLE
            Dim dbch_size As Int32
            Dim dbch_devicetype As Int32
            Dim dbch_reserved As Int32
            Dim dbch_handle As IntPtr
            Dim dbch_hdevnotify As IntPtr
            Dim dbch_eventguid As Guid
            Dim dbch_nameoffset As Long
            Dim dbch_data As Byte
            Dim dbch_data1 As Byte
        End Structure

all the returned values before that line are correct, but the structure returned from Marshal.PtrToStructure have all the values set to zero, so it's impossible for me to know which device is been removed; I read some place that I may have to use another structure declaration for 64 bit applications but i haven't been able to find the right one in vb.net... can anyone help me with this problem?
i'm using windows 7 64 bit edition.

Thanks in advance...