Re: create named pipe in kernel driver?



Though I can give you example how to open pipes within kernel mode, but it won't help you with remoting. In kernel pipe name has different naming convention that prevents from using "remote pipes".

RtlInitUnicodeString(
	&pipe_name,
	L"\\??\\pipe\\YourPipeName"
);

InitializeObjectAttributes(
	&attr,
	&pipe_name,
	OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
	NULL,
	NULL);

ret = ZwCreateFile(
	&pipe_handle,
	SYNCHRONIZE | FILE_WRITE_DATA ,  // or FILE_READ_DATA
	&attr,
	&iostat,
	NULL,
	FILE_ATTRIBUTE_NORMAL,
	FILE_SHARE_READ | FILE_SHARE_WRITE,
	FILE_OPEN,
	FILE_NON_DIRECTORY_FILE,
	NULL,
	0);

Thus whereas in user-mode formar of pipe is "\\server\pipe\pipename" in kernel it is "\??\pipe\pipename".
In addition, in kerenel default security context is LocalSystem which is not allowed to access network.


varname wrote:
ok ..

somehow I think that with a less explicit post I would've gotten the main
idea of your.

second: it is my understanding that by using a pipe I can use the output of
my driver (actually really a filter driver) on a remote machine aswell,
without any extra code for sending it over the network.
In my case, that would be a nice feature.

One of the consequences of using a ps2 mouse is (as I understand it) that
windows has exclusive control over the port, i.e. I can't just CreateFile on
it. So then I would have to create a second deviceobject to interact with
and use IOCTLs?


"Don Burn" <burn@xxxxxxxxxxxxxxxx> wrote in message news:pcrje.231$NL1.31@xxxxxxxxxxx

Why in the werld do you want to create a named pipe?  This is totally
outside of the normal approaches to communicate from a driver to user

space.

Yes people do it, with a lot of undocumented calls that can change
tommorrow.  People also drive down one way streets the wrong way, ignoring
convention in either case is at least stupid, if not worse.

There are a heck of a lot of normal ways to get this data out, don't do
things in an unconventional and stupid way.


-- Don Burn (MVP, Windows DDK) Windows 2k/XP/2k3 Filesystem and Driver Consulting Remove StopSpam from the email to reply



"varname" <v@xxx> wrote in message news:d6lerj$rlf$1@xxxxxxxxxxxxxxxxxx

hello all,

In relation to a previous question I asked about two weeks ago (cos /

sin

in
kernel driver)', I'm now at a point where I want to create a named pipe

to

'stream' the data coming from my hardware device (modified ps/2 mouse).

Creating named pipes from userland applications is straightforward

enough,

but in kerneldrivers I'm getting a bit confused. Reading several

websites

I've seen people saying to use 'IoCreateFile' directly (as that is what
NtCreateNamedPipeFile uses), using ZwCreateNamedPipeFile (which isn't
exported it seems) and a sort of wrapper
(http://www.ntkernel.com/w&p.php?id=17 last part of page).

Could someone please shed some light on this? What is the (accepted) way
to
create a named pipe from a kernel driver (in DriverEntry for instance)?

again, thanks for any assistance you can give.






.



Relevant Pages

  • problem with linux 2.6.11 and sa
    ... I recall a problem a while back with a pipe from ... kernel and my spamassassin setup. ... sent on to my local MDA. ... To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)
  • problem with linux 2.6.11 and sa
    ... I recall a problem a while back with a pipe from ... /proc/kmsg that was sent by root to a program with a ... The fix was to run the logging program as ... kernel and my spamassassin setup. ...
    (Linux-Kernel)
  • Re: [9fans] Why do we need syspipe() ?
    ... On Jan 4, 2009, at 10:20 PM, Russ Cox wrote: the pipe system call using #|. ... a service the kernel provides. ... for fish; you get fish? ... If iostats tries to interpose on everything ...
    (comp.os.plan9)
  • Re: [patch 00/11] ANNOUNCE: "Syslets", generic asynchronous system call support
    ... the same thread is allowed to continue execution even if the system call ... the kernel switches the user-space ... returns to user-space as if nothing happened - allowing the user-space ... context to 'fill the pipe' as much as it can. ...
    (Linux-Kernel)
  • Re: 2.6.30-rc4 kernel
    ... I think there may be a problem with the 2.6.30 kernel that is ... # Generic Driver Options ... # PCI IDE chipsets support ... # Other IDE chipsets support ...
    (Linux-Kernel)