CreateFile after CloseHandle
-
Hello, I have a problem , Whan I open a port by CreateFile(..) after closing it by CloseHandle(..) the CreateFile fails , I tried to do a Sleep(2000) before reopening its didnt help, on the first time that I am opening it, its succeed it fails just if I open it after closing it. And its happend only in my laptop that have windows 7, on the other computer that have windows XP its work fine. What can be the problem with reopening port after closing it? Thanks!!
-
Hello, I have a problem , Whan I open a port by CreateFile(..) after closing it by CloseHandle(..) the CreateFile fails , I tried to do a Sleep(2000) before reopening its didnt help, on the first time that I am opening it, its succeed it fails just if I open it after closing it. And its happend only in my laptop that have windows 7, on the other computer that have windows XP its work fine. What can be the problem with reopening port after closing it? Thanks!!
-
Typical. MS realley messed up with Vista. It seems a lot of the bugs are still there in Win7. This is typical, how the hell does CloeHandle() succeed withouth flushing the data and leaving the port in a state ready to accept a new CreaeFile()? I have written many many drivers for windows, serial drivers, network drivers, and never has one of my serial drivers behaved like this on Visa and Win7.
============================== Nothing to say.
-
Typical. MS realley messed up with Vista. It seems a lot of the bugs are still there in Win7. This is typical, how the hell does CloeHandle() succeed withouth flushing the data and leaving the port in a state ready to accept a new CreaeFile()? I have written many many drivers for windows, serial drivers, network drivers, and never has one of my serial drivers behaved like this on Visa and Win7.
============================== Nothing to say.
I found this in my 2001 MSDN CloseHandle invalidates the specified object handle, decrements the object’s handle count, and performs object retention checks. After the last handle to an object is closed, the object is removed from the system. Persistent objects such as databases and files will remain in storage, but must be re-opened to be accessed again. Closing a thread handle does not terminate the associated thread. To remove a thread object, you must terminate the thread, then close all handles to the thread. Use CloseHandle to close handles returned by calls to the CreateFile function. Use FindClose to close handles returned by calls to the FindFirstFile function. I am not sure if newer OS , I run XP, should behave any differently if this is ( bold stuff re-opened ) realy true.
-
I found this in my 2001 MSDN CloseHandle invalidates the specified object handle, decrements the object’s handle count, and performs object retention checks. After the last handle to an object is closed, the object is removed from the system. Persistent objects such as databases and files will remain in storage, but must be re-opened to be accessed again. Closing a thread handle does not terminate the associated thread. To remove a thread object, you must terminate the thread, then close all handles to the thread. Use CloseHandle to close handles returned by calls to the CreateFile function. Use FindClose to close handles returned by calls to the FindFirstFile function. I am not sure if newer OS , I run XP, should behave any differently if this is ( bold stuff re-opened ) realy true.