How can I/O priority of a process be increased?

后端 未结 6 545
别跟我提以往
别跟我提以往 2020-12-13 16:33

I want to increase the I/O priority of a process. Answers for both .NET and Windows Vista would be nice. processexplorer is ok as well.

6条回答
  •  猫巷女王i
    2020-12-13 17:17

    Be sure to align FILE_IO_PRIORITY_HINT_INFO structure properly when calling SetFileInformationByHandle.

    Otherwise, you will get a ERROR_NOACCESS (error 998, 0x000003E6).

    _declspec(align(8)) FILE_IO_PRIORITY_HINT_INFO priorityHint;
    priorityHint.PriorityHint = IoPriorityHintLow;
    
    BOOL ret = SetFileInformationByHandle(hFile, FileIoPriorityHintInfo, &priorityHint, sizeof(FILE_IO_PRIORITY_HINT_INFO));
    DWORD err = GetLastError();
    

提交回复
热议问题