fflyw

Hello


I writing a port monitor , that that will provide one port, that is not connected with physicall bus or port. it is a virtual port, it makes nothing.this monitor dll exports initialmonitor, addport, dellport, configureport, stardocport,enddocport,enumports,openport,closeport funcions. i did put addresses of these function in MONITOREX struct(returnet by intializemonitor function). Enumports only returns port info struct ,that describes port, provided by this monitor(virtual port).Addport only displays message"this mon doesnot support adding ports", the same delete port an configure port .I wriitenn this port monitor , i installed it succesfully(by calling addMonitor funcion), i installed printer on this port i can print documents on this port, but there is only one problem and i dont know where i made mistake.


Problem:
all works ok but if i remove last printer associated with this port, the spooler should call monitors closePort function but it didnt. i dont know why. ...

And when i want to remewe this monitor by calling delletemonitor, it throws error - print monitor in use.
Can you help my what did i forget

please help me


Re: Software Testing Discussion printing port monitor help needed

Jim Moore [MSFT]

I'm in no way an expert on printer drivers or virtual ports, but it sounds like something has a handle or reference still open.

I'd look at all the places where "close" functionality should exist and make sure things are cleaned up and nothing is left allocated.

Also make sure you are releasing all system resources that were allocated by OpenPort (I'm reading that from ClosePort MSDN documentation).

Might want to confirm that you are keeping track of various handles and not leaving any open.

Sorry, maybe someone else has better ideas.






Re: Software Testing Discussion printing port monitor help needed

Alan Page

Check the signature / address of the pfnClosePort field in the monitorex structure - if that's wrong, the close port function won't be called.



Re: Software Testing Discussion printing port monitor help needed

fflyw

Hi thanks for reply, i checked it, but its good. Maybe i do not close some handles or do not free some allocated memory





Re: Software Testing Discussion printing port monitor help needed

fflyw

Thanks for reply, maybe this is my problem.

My sources are huge now, it will take some time -find place where i do not close some handle or free memory.

But thanks for tip.





Re: Software Testing Discussion printing port monitor help needed

Anton.Sorokin

I also write my port monitor and have the same problem under Vista. Under XP print spooler service calls ClosePort function and then I can delete port and port monitor. What system does Your port monitor work on





Re: Software Testing Discussion printing port monitor help needed

Anton.Sorokin

The reason was found. Print spooler calls EndDocPort and after that stops call ReadPort function. But there are some packets that port kernel-mode driver receives from printer after EndDocPort was called! I think that spooler wait for these packets but can't read it because EndDocPort already has been called. If comment ReadFile calls in ReadPort function at all, this problem will be solved, but you will not see messages like "ink cartrage empty" during printing in printer properties.





Re: Software Testing Discussion printing port monitor help needed

kathy mines

I checked it and it is not listed my brand