Код (Text): #define PIPENAME L"\\Device\\NamedPipe\\some_pipe" //... HANDLE hPipe; UNICODE_STRING PipeNameUnicode; OBJECT_ATTRIBUTES ObjAttr; IO_STATUS_BLOCK IoStatusBlock; NTSTATUS ns; RtlInitUnicodeString(&PipeNameUnicode, PIPENAME); InitializeObjectAttributes(&ObjAttr, &PipeNameUnicode, OBJ_KERNEL_HANDLE, NULL, NULL); ns = ZwCreateNamedPipeFile(&hPipe, FILE_ALL_ACCESS | SYNCHRONIZE, &ObjAttr, &IoStatusBlock, 0, FILE_CREATE, 0, FALSE, FALSE, FALSE, 1, 0x1000, 0x1000, NULL); //... ZwCreateNamedPipeFile всегда возвращает 0xc000000d (STATUS_INVALID_PARAMETER) не подскажете, в чём проблема?
Код выполняется в ринг3? Или это драйвер Если это юзермод тогда наверное \Device\Namedpipe стоит заменить на \??\PIPE
возможно, там должно быть что-то другое вместо "FALSE, FALSE, FALSE" хотя я на самом деле не разбираюсь..
NTSTATUS NtCreateNamedPipeFile( OUT PHANDLE FileHandle, IN ULONG DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN ULONG NamedPipeType, IN ULONG ReadMode, IN ULONG CompletionMode, IN ULONG MaximumInstances, IN ULONG InboundQuota, IN ULONG OutboundQuota, IN PLARGE_INTEGER DefaultTimeout OPTIONAL ) /*++ Routine Description: Creates and opens the server end handle of the first instance of a specific named pipe or another instance of an existing named pipe. Arguments: FileHandle - Supplies a handle to the file on which the service is being performed. DesiredAccess - Supplies the types of access that the caller would like to the file. ObjectAttributes - Supplies the attributes to be used for file object (name, SECURITY_DESCRIPTOR, etc.) IoStatusBlock - Address of the caller's I/O status block. ShareAccess - Supplies the types of share access that the caller would like to the file. CreateDisposition - Supplies the method for handling the create/open. CreateOptions - Caller options for how to perform the create/open. NamedPipeType - Type of named pipe to create (Bitstream or message). ReadMode - Mode in which to read the pipe (Bitstream or message). CompletionMode - Specifies how the operation is to be completed. MaximumInstances - Maximum number of simultaneous instances of the named pipe. InboundQuota - Specifies the pool quota that is reserved for writes to the inbound side of the named pipe. OutboundQuota - Specifies the pool quota that is reserved for writes to the inbound side of the named pipe. DefaultTimeout - Optional pointer to a timeout value that is used if a timeout value is not specified when waiting for an instance of a named pipe. Return Value: The function value is the final status of the create/open operation. --*/ {