none
Why the WrtieFile() set the handle to NULL somtime when write data to usb device RRS feed

  • Question

  • Hi

        I use WriteFile() to send data to a usb device ,it work good ,but some time ,the handle may set NULL after call the WriteFile,

    someone know why ?or how to solve this problem? thank you

        My clall the WriteFile like this :

              HANDLE husb = CreateFile(...); // OK
              BOOL  result = WriteFile( husb , ...) // OK
                result = WriteFile( husb , ...) // OK
               .....
                  result = WriteFile( husb , ...) // OK
                    .......
                  result = WriteFile( husb , ...) //  
                   // the Handle  husb  be setted to NULL after call the WriteFile 

                

    Friday, September 26, 2014 9:15 AM

Answers

  • Check your code, WriteFile cannot do this. Your code could by referencing husb in a way that it is zeroed.  Start by verifying that going into the call that husb has the value from the create file, and then single step through the assembler of the WriteFile call to with a watch on husb.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com

    Friday, September 26, 2014 11:16 AM