Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista General Discussion > CreateNamedPipe without Disconnect & CloseHandle

Reply
Thread Tools Display Modes

CreateNamedPipe without Disconnect & CloseHandle

 
 
kalpesh
Guest
Posts: n/a

 
      07-05-2007
i have a serious problem with CreateNamedPipe:

I am developing a virtual printer driver in VISTA, for that at one
point i use NamedPipe ok..


Now if my all code is run good then there is no any problem becuse at
the end of printing job i disconnect this named pipe and close this
handle.


Now consider the case that my NamedPipe is created and without close
it my printer driver crash at some point means when ever second time
any print job is there it does not createNamePipe gives me error
ERROR_ALREADY_EXISTS that "Cannot create a file when that file
already
exists".


here i write my code for create named pipe


hBitmapPrinterPipe = CreateNamedPipe( L"\\\\.\\Pipe\
\BitmapPrinterPipe", // pipe name
PIPE_ACCESS_DUPLEX|
FILE_FLAG_OVERLAPPED,
PIPE_TYPE_BYTE
|
PIPE_WAIT,


PIPE_UNLIMITED_INSTANCES,
MAX_PATH,
MAX_PATH,
NMPWAIT_USE_DEFAULT_WAIT,
NULL);


if(hBitmapPrinterPipe == INVALID_HANDLE_VALUE) {
GetLastError());
}


Using this code i create my pipe..


so my question is there is any method from which i can reopen my
existing server pipe and close it..
OR there is any solution from which i can open the another instance
of
the same name pipe..
so please write me which solution is best for me and how can i do
it..


Thanks in advance..

 
Reply With Quote
 
 
 
 
Jon
Guest
Posts: n/a

 
      07-05-2007
A bit specialised for this generalist group. You may get some kind soul will
be willing to plough through your code, but you're more likely to get a
response in one of the development newsgroups. Would suggest a repost.

--
Jon


"kalpesh" <> wrote in message
news: oups.com...
>i have a serious problem with CreateNamedPipe:
>
> I am developing a virtual printer driver in VISTA, for that at one
> point i use NamedPipe ok..
>
>
> Now if my all code is run good then there is no any problem becuse at
> the end of printing job i disconnect this named pipe and close this
> handle.
>
>
> Now consider the case that my NamedPipe is created and without close
> it my printer driver crash at some point means when ever second time
> any print job is there it does not createNamePipe gives me error
> ERROR_ALREADY_EXISTS that "Cannot create a file when that file
> already
> exists".
>
>
> here i write my code for create named pipe
>
>
> hBitmapPrinterPipe = CreateNamedPipe( L"\\\\.\\Pipe\
> \BitmapPrinterPipe", // pipe name
> PIPE_ACCESS_DUPLEX|
> FILE_FLAG_OVERLAPPED,
> PIPE_TYPE_BYTE
> |
> PIPE_WAIT,
>
>
> PIPE_UNLIMITED_INSTANCES,
> MAX_PATH,
> MAX_PATH,
> NMPWAIT_USE_DEFAULT_WAIT,
> NULL);
>
>
> if(hBitmapPrinterPipe == INVALID_HANDLE_VALUE) {
> GetLastError());
> }
>
>
> Using this code i create my pipe..
>
>
> so my question is there is any method from which i can reopen my
> existing server pipe and close it..
> OR there is any solution from which i can open the another instance
> of
> the same name pipe..
> so please write me which solution is best for me and how can i do
> it..
>
>
> Thanks in advance..
>


 
Reply With Quote
 
Andrew McLaren
Guest
Posts: n/a

 
      07-07-2007
> "kalpesh" <> wrote ...
>>i have a serious problem with CreateNamedPipe:
>>
>> Now consider the case that my NamedPipe is created and without close
>> it my printer driver crash at some point means when ever second time
>> any print job is there it does not createNamePipe gives me error
>> ERROR_ALREADY_EXISTS that "Cannot create a file when that file
>>
>> so my question is there is any method from which i can reopen my
>> existing server pipe and close it..
>> OR there is any solution from which i can open the another instance
>> of the same name pipe..


"Jon" <> wrote ...
>A bit specialised for this generalist group. You may get some kind soul
>will be willing to plough through your code, but you're more likely to get
>a response in one of the development newsgroups. Would suggest a repost.


I tend to agree with Jon. "microsoft.public.windows.vista.general" is a
user-oriented group, very few people here know much about Windows or
computers. You will get better answers in a group like
microsoft.public.win32.programmer.networks. (even though your code is
running on a single machine, Named Pipes are usually classified as a form of
network computing ... although they're also very suitable as a form of IPC).

By way of comment ... this is a very fundamental, basic question in Named
Pipes programming. I'm not trying to make fun of you, because you're
probably a much better programmer than me (it wouldn't be hard :-). But,
maybe you need to sit down with a good Named Pipes tutorial and really
understand the paradigm. There are many performance implications to
Overlapped IO, completion ports, etc which you will be missing if you just
find a Named Pipes code snippet which "works".

Good luck with the project!
--
Andrew McLaren
amclar (at) optusnet dot com dot au


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VPN will not disconnect...? Sebastiaan Windows Vista General Discussion 2 09-18-2009 10:11 PM
wow disconnect Raifen Windows Vista General Discussion 1 08-29-2007 11:35 PM
How to CreateNamedPipe with FILE_CREATE_PIPE_INSTANCE access rights kalpesh Windows Vista Security 3 07-05-2007 04:35 PM
How to CreateNamedPipe with FILE_CREATE_PIPE_INSTANCE access rights kalpesh Windows Vista General Discussion 1 07-04-2007 09:43 PM
Disconnect Dialogue Box Rich Windows Vista General Discussion 0 04-27-2007 06:34 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59