Kernel mode pipes

hi guys ,
i read your query regarding the kernel pipes on ntdev.org.
i am doing something very similar.
i have created a filter driver thru which i need to open a named pipe.
in the user mode i create a named pipe called “mypipe”.
the user mode code for creating the named pipe is

serverpipe = CreateNamedPipe( “\\.\pipe\mypipe” , PIPE_ACCESS_INBOUND | FILE_FLAG_WRITE_THROUGH |WRITE_OWNER , PIPE_READMODE_BYTE | PIPE_TYPE_BYTE | PIPE_WAIT , PIPE_UNLIMITED_INSTANCES , 2000 , 2000 ,NMPWAIT_USE_DEFAULT_WAIT , NULL );
the pipe is created , thus this code works fine.

now i need to open this pipe and write to it from the kernel mode driver , i am using ZwcreateFile , this is the code which i have written in the kernel mode

status = ZwCreateFile( &pipeHandle , GENERIC_WRITE , &objattr , &iob , 0 , FILE_ATTRIBUTE_NORMAL ,
FILE_SHARE_READ|FILE_SHARE_WRITE , FILE_OPEN_IF , FILE_WRITE_THROUGH , eabuffer , 0 );

this call fails.
please help me !!!
waiting for your reply !!!

Harshal Vaidya
Project Trainee
Cognizant Technology Solutions.
E-mail - xxxxx@pun.cognizant.com
Phone - 6691960 Ext - 2320


Chat with your friends as soon as they come online. Get Rediff Bol at
http://bol.rediff.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Harshal,

I did something similar under NT4 some time ago. Try this:

NTSTATUS ntStatus;
IO_STATUS_BLOCK IoStatus;
HANDLE NtFileHandle = NULL;
OBJECT_ATTRIBUTES ObjectAttributes;
WCHAR PipeName = L"\DosDevices\Pipe\nmpipe";
// Replace nmpipe with your pipe name
UNICODE_STRING FullFileName;
int i;
LARGE_INTEGER Interval;

RtlInitUnicodeString( &FullFileName, PipeName );
KdPrint((“Attempting to open %wZ\n”, &FullFileName));

InitializeObjectAttributes ( &ObjectAttributes,
&FullFileName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL );

ntStatus = ZwCreateFile( &NtFileHandle,
SYNCHRONIZE | GENERIC_READ | GENERIC_WRITE,
&ObjectAttributes,
&IoStatus,
NULL, // alloc size =
none
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ| FILE_SHARE_WRITE,
FILE_OPEN_IF,
FILE_SYNCHRONOUS_IO_NONALERT,
NULL, // eabuffer
0 ); // ealength

Ric Hunt
xxxxx@HuntConsulting.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Harshal Vaidya
Sent: Monday, June 04, 2001 12:16 AM
To: NT Developers Interest List
Subject: [ntdev] Kernel mode pipes

hi guys ,
i read your query regarding the kernel pipes on ntdev.org.
i am doing something very similar.
i have created a filter driver thru which i need to open a named pipe.
in the user mode i create a named pipe called “mypipe”.
the user mode code for creating the named pipe is

serverpipe = CreateNamedPipe( “\\.\pipe\mypipe” , PIPE_ACCESS_INBOUND
| FILE_FLAG_WRITE_THROUGH |WRITE_OWNER , PIPE_READMODE_BYTE | PIPE_TYPE_BYTE
| PIPE_WAIT , PIPE_UNLIMITED_INSTANCES , 2000 , 2000
,NMPWAIT_USE_DEFAULT_WAIT , NULL );
the pipe is created , thus this code works fine.

now i need to open this pipe and write to it from the kernel mode driver
, i am using ZwcreateFile , this is the code which i have written in the
kernel mode

status = ZwCreateFile( &pipeHandle , GENERIC_WRITE , &objattr , &iob , 0 ,
FILE_ATTRIBUTE_NORMAL ,
FILE_SHARE_READ|FILE_SHARE_WRITE , FILE_OPEN_IF ,
FILE_WRITE_THROUGH , eabuffer , 0 );

this call fails.
please help me !!!
waiting for your reply !!!

Harshal Vaidya
Project Trainee
Cognizant Technology Solutions.
E-mail - xxxxx@pun.cognizant.com
Phone - 6691960 Ext - 2320


Chat with your friends as soon as they come online. Get Rediff Bol at
http://bol.rediff.com


You are currently subscribed to ntdev as: xxxxx@HuntConsulting.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com