Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement avrt with regard to #316 #348

Merged
merged 3 commits into from
Jan 15, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ headers = ["headers-shared", "headers-um", "headers-vc", "headers-winrt"]
"headers-um" = [
"um-audioclient",
"um-audiosessiontypes",
"um-avrt",
"um-cfgmgr32",
"um-cguid",
"um-combaseapi",
Expand Down Expand Up @@ -174,6 +175,7 @@ headers = ["headers-shared", "headers-um", "headers-vc", "headers-winrt"]
]
"um-audioclient" = ["shared-basetsd", "shared-guiddef", "shared-minwindef", "shared-mmreg", "shared-winerror", "shared-wtypesbase", "um-audiosessiontypes", "um-strmif", "um-unknwnbase", "um-winnt"]
"um-audiosessiontypes" = ["shared-minwindef"]
"um-avrt" = ["um-winnt", "avrt"]
"um-cfgmgr32" = ["shared-basetsd", "shared-guiddef", "shared-minwindef", "um-winnt"]
"um-cguid" = ["shared-guiddef"]
"um-combaseapi" = ["shared-basetsd", "shared-minwindef", "shared-wtypesbase", "um-objidlbase", "ole32"]
Expand Down Expand Up @@ -263,6 +265,7 @@ libraries = [
"ole32",
"wininet",
]
"avrt" = []
"kernel32" = []
"ole32" = []
"ncrypt" = []
Expand Down
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// except according to those terms.
use std::env::var;
const LIBS: &'static [&'static str] = &[
"avrt",
"kernel32",
"ncrypt",
"ole32",
Expand Down
Binary file added i686/lib/libavrt.a
Binary file not shown.
81 changes: 81 additions & 0 deletions src/um/avrt.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// Copyright © 2016 winapi-rs developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
// All files in the project carrying such notice may not be copied, modified, or distributed
// except according to those terms.

use shared::minwindef::{BOOL, LPDWORD, PULONG};

use shared::guiddef::GUID;

use um::winnt::{HANDLE, PLARGE_INTEGER, LONGLONG, PHANDLE, LPCWSTR, LPCSTR};

ENUM!{enum AVRT_PRIORITY {
AVRT_PRIORITY_VERYLOW = -2i32 as u32,
AVRT_PRIORITY_LOW = -1i32 as u32,
AVRT_PRIORITY_NORMAL = 0u32,
AVRT_PRIORITY_HIGH = 1u32,
AVRT_PRIORITY_CRITICAL = 2u32,
}}

pub const THREAD_ORDER_GROUP_INFINITE_TIMEOUT: LONGLONG = -1;

FN!(stdcall AvSetMmThreadCharacteristicsA(TaskName: LPCSTR,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FN! is the wrong macro to use. You should be using EXTERN! here. Also the indentation is wrong.
https://github.com/retep998/winapi-rs/blob/dev/CONTRIBUTING.md#functions

TaskIndex: LPDWORD)
-> HANDLE);

FN!(stdcall AvSetMmThreadCharacteristicsW(TaskName: LPCSTR,
TaskIndex: LPDWORD)
-> HANDLE);

FN!(stdcall AvSetMmMaxThreadCharacteristicsA(FirstTask: LPCSTR,
SecondTask: LPCSTR,
TaskIndex: LPDWORD)
-> HANDLE);

FN!(stdcall AvSetMmMaxThreadCharacteristicsW(FirstTask: LPCWSTR,
SecondTask: LPCWSTR,
TaskIndex: LPDWORD)
-> HANDLE);

FN!(stdcall AvRevertMmThreadCharacteristics(avrt_handle: HANDLE) -> BOOL);

FN!( stdcall AvSetMmThreadPriority(AvrtHandle: HANDLE,
Priority: AVRT_PRIORITY)
-> BOOL);

FN!( stdcall AvRtCreateThreadOrderingGroup(Context: PHANDLE,
Period: PLARGE_INTEGER,
ThreadOrderingGuid: *mut GUID,
Timeout: PLARGE_INTEGER)
-> BOOL);

FN!( stdcall AvRtCreateThreadOrderingGroupExA(Context: PHANDLE,
Period: PLARGE_INTEGER,
ThreadOrderingGuid: *mut GUID,
Timeout: PLARGE_INTEGER,
TaskName: LPCSTR)
-> BOOL);

FN!( stdcall AvRtCreateThreadOrderingGroupExW(Context: PHANDLE,
Period: PLARGE_INTEGER,
ThreadOrderingGuid: *mut GUID,
Timeout: PLARGE_INTEGER,
TaskName: LPCWSTR)
-> BOOL);

FN!( stdcall AvRtJoinThreadOrderingGroup(Context: PHANDLE,
ThreadOrderingGuid: *mut GUID,
Before: BOOL)
-> BOOL);

FN!( stdcall AvRtWaitOnThreadOrderingGroup(Context: HANDLE) -> BOOL);

FN!( stdcall AvRtLeaveThreadOrderingGroup(Context: HANDLE) -> BOOL);

FN!( stdcall AvRtDeleteThreadOrderingGroup(Context: HANDLE) -> BOOL);

FN!( stdcall AvQuerySystemResponsiveness(AvrtHandle: HANDLE,
SystemResponsivenessValue: PULONG)
-> BOOL);
1 change: 1 addition & 0 deletions src/um/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub mod gl;

#[cfg(feature = "um-audioclient")] pub mod audioclient;
#[cfg(feature = "um-audiosessiontypes")] pub mod audiosessiontypes;
#[cfg(feature = "um-avrt")] pub mod avrt;
#[cfg(feature = "um-cfgmgr32")] pub mod cfgmgr32;
#[cfg(feature = "um-cguid")] pub mod cguid;
#[cfg(feature = "um-combaseapi")] pub mod combaseapi;
Expand Down
Binary file added x86_64/lib/libavrt.a
Binary file not shown.