Tech Support > Microsoft Windows > Development Resources > HELP: is it possible to have a named pipe server - in a service ?
HELP: is it possible to have a named pipe server - in a service ?
Posted by Niel Darren on November 14th, 2007


I can get a named pipe server working fine in an application under
XP/2K/2003 - but as soon as i put the same piece of code into a service-stub
and run the service, then no one can write to it ?

What am i missing ?


Posted by Kellie Fitton on November 14th, 2007


On Nov 14, 12:11 pm, "Niel Darren" <n...@pszzxasm.co.uk> wrote:

Hi,

Yes, you can use a named pipe in an NT service process.
here are the APIs that you need to use for a named pipe:

CreateNamedPipe()
SetNamedPipeHandleState()
ConnectNamedPipe()
CreateFile()
ReadFile()
WriteFile()
ImpersonateNamedPipeClient()
CloseHandle()
RevertToSelf()

http://msdn2.microsoft.com/en-us/library/aa365150.aspx

http://msdn2.microsoft.com/en-us/library/aa365787.aspx

http://msdn2.microsoft.com/en-us/library/aa365146.aspx

http://msdn2.microsoft.com/en-us/library/aa363858.aspx

http://msdn2.microsoft.com/en-us/library/aa365467.aspx

http://msdn2.microsoft.com/en-us/library/aa365747.aspx

http://msdn2.microsoft.com/en-us/library/aa378618.aspx

http://msdn2.microsoft.com/en-us/library/ms724211.aspx

http://msdn2.microsoft.com/en-us/library/aa379317.aspx

Kellie.



Posted by Niel Darren on November 15th, 2007


Im using all of them but the ImpersonateNamedPipeClient () and RevertToSelf
() - is that the reason it doesnt work in a service ?



"Kellie Fitton" <KELLIEFITTON@YAHOO.COM> wrote in message
news:1195072213.587540.196450@50g2000hsm.googlegro ups.com...


Posted by Kellie Fitton on November 15th, 2007


On Nov 15, 3:35 am, "Niel Darren" <n...@pszzxasm.co.uk> wrote:

Hi,

If any of the APIs calls are failing, you should use the following
functions and check the returned error code:

GetLastError()

FormatMessage()

http://msdn2.microsoft.com/en-us/library/ms679360.aspx

http://msdn2.microsoft.com/en-us/library/ms679351.aspx

Kellie.




Similar Posts