NtWriteFile is returning STATUS_INVALID_PARAMETER RRS feed

  • Question

  • In my x86 assembly application, I have a button that, when clicked, calls a subroutine "Screenshot2" indirectly. That subroutine takes a screenshot of the application's window. I've got everything: the device contexts, the memory and the handles, except that the file writing is returning 0xC000000D (STATUS_INVALID_PARAMETER).

    I'm passing a valid file handle with access mask 0x0013019F returned by NtCreateFile, a valid IO_STATUS_BLOCK set to zeroes, a valid buffer 0x00103000 bytes long containing the bitmap and the count of bytes to write, 0x00102C36. All other arguments are set to 0.

    Simplified: Status = NtWriteFile(hFile, NULL, NULL, NULL, &statusBlock, buffer, 0x00102C36, NULL, NULL);

    Sunday, October 9, 2016 6:38 PM

All replies

  • Did you pass FILE_SYNCHRONOUS_IO_NONALERT to NtCreateFile?
    Monday, October 17, 2016 7:11 PM