Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / January 2005

Tip: Looking for answers? Try searching our database.

Overlapped problem with CreateNamedPipe in NT Service

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lewap - 10 Jan 2005 14:20 GMT
Hi!

I have a problem:
Function CreateNamedPipe (a piece of source below) called in a NT service I
get an error 997 - Overlapped I/O operation is in progress.

When I run the same code as oridinal application (not NT service) everything
works properly.

Service is develop in Managed/Unmanaged C++ (.NET Environment). And is
runing on LocalSystem account so I think it is not problem with privileges

<code>
LPTSTR lpszPipename = (LPTSTR) \\\\.\\pipe\\testpipe;

hPipe = CreateNamedPipe(

lpszPipename, // pipe name

PIPE_ACCESS_DUPLEX | // read/write access

FILE_FLAG_OVERLAPPED,

PIPE_TYPE_MESSAGE | // message type pipe

PIPE_READMODE_MESSAGE | // message-read mode

PIPE_WAIT, // blocking mode

1, // number of instances (max. instances - PIPE_UNLIMITED_INSTANCES)

BUFSIZE, // output buffer size

BUFSIZE, // input buffer size

PIPE_TIMEOUT, // client time-out

NULL);

if (hPipe == INVALID_HANDLE_VALUE) {

log->WriteEntry("Error creating pipe!", EventLogEntryType::Error);

err = __box(GetLastError());

logEntry = String::Format("Last error: {0}", err);

log->WriteEntry(logEntry);

}

else {

log->WriteEntry("Success creating pipe!");

}

CloseHandle(hPipe);

<code>

Thanks in advance for any help or suggestions

Best regards
Pawel.
William DePalo [MVP VC++] - 10 Jan 2005 17:05 GMT
> I have a problem:
> Function CreateNamedPipe (a piece of source below) called in a NT service
> I
> get an error 997 - Overlapped I/O operation is in progress.

Instead of this

if (hPipe == INVALID_HANDLE_VALUE) {
log->WriteEntry("Error creating pipe!", EventLogEntryType::Error);
err = __box(GetLastError());

try this

if (hPipe == INVALID_HANDLE_VALUE) {
err = __box(GetLastError());
log->WriteEntry("Error creating pipe!", EventLogEntryType::Error);

Note that a thread saves only its _last_ error.

Regards,
Will
Lewap - 11 Jan 2005 07:33 GMT
U?ytkownik "William DePalo [MVP VC++]" <willd.no.spam@mvps.org> wrote in
message
> Instead of this
>
[quoted text clipped - 9 lines]
>
> Note that a thread saves only its _last_ error.

Thank's a lot! In fact that error was caused by another error appear
earlier - 123 "The file name, directory name, or volume label syntax is
incorrect." So, name of named pipe is wrong, I suppose.

Best regards
Pawel.
William DePalo [MVP VC++] - 11 Jan 2005 17:05 GMT
> Thank's a lot!

You are welcome.

> In fact that error was caused by another error appear
> earlier - 123 "The file name, directory name, or volume
> label syntax is incorrect." So, name of named pipe is
> wrong, I suppose.

This is from the docs on pipe names:

<quote>
The pipename part of the name can include any character
other than a backslash, including numbers and special
characters. The entire pipe name string can be up to 256
characters long. Pipe names are not case sensitive.

Windows Me/98/95:  Pipe names cannot include a colon.
Therefore, if this pipe will be used from a Windows Me/98/95
client, do not include a colon in the name.
</quote>

Please post any follow-up in the kernel group.

Regards,
Will
Lewap - 12 Jan 2005 10:53 GMT
The problem was that I've used wrong conversion for name of pipe. I wrote:

LPTSTR lpszPipename = (LPTSTR) "\\\\.\\pipe\\testpipe";

and should be:

LPTSTR lpszPipename = _T("\\\\.\\pipe\\testpipe");

and now everything works fine.

Thanks again!

Best regards,
Pawel.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.