ZwCreateNamedPipe troubles

Тема в разделе "WASM.WIN32", создана пользователем Cr4sh, 8 апр 2007.

  1. Cr4sh

    Cr4sh New Member

    Публикаций:
    0
    Код (Text):
    1. #define PIPENAME    L"\\Device\\NamedPipe\\some_pipe"
    2.  
    3. //...
    4.  
    5.     HANDLE hPipe;
    6.     UNICODE_STRING PipeNameUnicode;
    7.     OBJECT_ATTRIBUTES ObjAttr;
    8.     IO_STATUS_BLOCK IoStatusBlock;
    9.     NTSTATUS ns;
    10.  
    11.     RtlInitUnicodeString(&PipeNameUnicode, PIPENAME);
    12.  
    13.     InitializeObjectAttributes(&ObjAttr, &PipeNameUnicode, OBJ_KERNEL_HANDLE, NULL, NULL);
    14.  
    15.     ns = ZwCreateNamedPipeFile(&hPipe,
    16.         FILE_ALL_ACCESS | SYNCHRONIZE,
    17.         &ObjAttr, &IoStatusBlock, 0, FILE_CREATE, 0, FALSE, FALSE, FALSE, 1, 0x1000, 0x1000, NULL);
    18.    
    19. //...
    ZwCreateNamedPipeFile всегда возвращает 0xc000000d (STATUS_INVALID_PARAMETER)
    не подскажете, в чём проблема?
     
  2. wasm_test

    wasm_test wasm test user

    Публикаций:
    0
    Код выполняется в ринг3? Или это драйвер
    Если это юзермод тогда наверное \Device\Namedpipe стоит заменить на \??\PIPE
     
  3. Cr4sh

    Cr4sh New Member

    Публикаций:
    0
    драйвер, но ZwCreateNamedPipe вызываю через int 2eh
     
  4. wasm_test

    wasm_test wasm test user

    Публикаций:
    0
    Cr4sh
    хм.. а какое в таком случае будет KeGetPreviousMode
     
  5. n0name

    n0name New Member

    Публикаций:
    0
    Great
    KernelMode. адназначна.
     
  6. wasm_test

    wasm_test wasm test user

    Публикаций:
    0
    все равно имхо надежнее юзать общедоступную ссылку \??\PIPE
     
  7. Nouzui

    Nouzui New Member

    Публикаций:
    0
    возможно, там должно быть что-то другое вместо "FALSE, FALSE, FALSE"
    хотя я на самом деле не разбираюсь..
     
  8. wasm_test

    wasm_test wasm test user

    Публикаций:
    0
    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.

    --*/

    {