From ca30d4af731f7adaab42fe68d41e65fa81190f95 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Wed, 26 Oct 2016 20:23:20 -0700 Subject: [PATCH] Add NCryptFreeObject --- Cargo.toml | 8 +++++++- build.rs | 3 ++- src/shared/mod.rs | 1 + src/shared/sspi.rs | 9 +++++++++ src/um/mod.rs | 1 + src/um/ncrypt.rs | 13 +++++++++++++ 6 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 src/shared/sspi.rs create mode 100644 src/um/ncrypt.rs diff --git a/Cargo.toml b/Cargo.toml index 6b544a38d..6cfd8e95a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,6 +26,7 @@ headers = ["headers-shared", "headers-um", "headers-vc"] "shared-ntdef", "shared-ntstatus", "shared-rpcndr", + "shared-sspi", "shared-windef", "shared-wtypesbase" ] @@ -39,6 +40,7 @@ headers = ["headers-shared", "headers-um", "headers-vc"] "shared-ntdef" = ["shared-basetsd"] "shared-ntstatus" = ["shared-ntdef"] "shared-rpcndr" = [] +"shared-sspi" = ["shared-ntdef"] "shared-windef" = ["shared-minwindef", "um-winnt"] "shared-wtypesbase" = ["shared-minwindef", "shared-rpcndr", "um-winnt"] "headers-um" = [ @@ -46,6 +48,7 @@ headers = ["headers-shared", "headers-um", "headers-vc"] "um-combaseapi", "um-consoleapi", "um-minwinbase", + "um-ncrypt", "um-objidlbase", "um-unknwnbase", "um-wincon", @@ -56,6 +59,7 @@ headers = ["headers-shared", "headers-um", "headers-vc"] "um-combaseapi" = ["shared-basetsd", "shared-minwindef", "shared-wtypesbase", "um-objidlbase", "ole32"] "um-consoleapi" = ["shared-minwindef", "um-wincon", "um-winnt", "kernel32"] "um-minwinbase" = ["shared-ntstatus"] +"um-ncrypt" = ["shared-basetsd", "shared-sspi"] "um-objidlbase" = ["shared-guiddef", "shared-minwindef", "shared-wtypesbase", "um-unknwnbase", "um-winnt"] "um-unknwnbase" = ["shared-guiddef", "shared-minwindef", "um-winnt"] "um-wincon" = ["shared-minwindef", "shared-windef", "um-minwinbase", "um-wingdi", "um-winnt", "kernel32"] @@ -69,7 +73,9 @@ headers = ["headers-shared", "headers-um", "headers-vc"] "vc-vcruntime" = [] libraries = [ "kernel32", - "ole32" + "ole32", + "ncrypt" ] "kernel32" = [] "ole32" = [] +"ncrypt" = [] diff --git a/build.rs b/build.rs index 5a3d82be2..31e1ed71a 100644 --- a/build.rs +++ b/build.rs @@ -7,7 +7,8 @@ use std::env::var; const LIBS: &'static [&'static str] = &[ "kernel32", - "ole32" + "ole32", + "ncrypt" ]; fn main() { let target = var("TARGET").unwrap(); diff --git a/src/shared/mod.rs b/src/shared/mod.rs index 1f529a354..566f06471 100644 --- a/src/shared/mod.rs +++ b/src/shared/mod.rs @@ -15,5 +15,6 @@ #[cfg(feature = "shared-ntstatus")] pub mod ntstatus; #[cfg(feature = "shared-ntdef")] pub mod ntdef; #[cfg(feature = "shared-rpcndr")] pub mod rpcndr; +#[cfg(feature = "shared-sspi")] pub mod sspi; #[cfg(feature = "shared-windef")] pub mod windef; #[cfg(feature = "shared-wtypesbase")] pub mod wtypesbase; diff --git a/src/shared/sspi.rs b/src/shared/sspi.rs new file mode 100644 index 000000000..5561429b2 --- /dev/null +++ b/src/shared/sspi.rs @@ -0,0 +1,9 @@ +// Copyright © 2016 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , 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::ntdef::LONG; + +pub type SECURITY_STATUS = LONG; diff --git a/src/um/mod.rs b/src/um/mod.rs index 279d089eb..7fdfe803c 100644 --- a/src/um/mod.rs +++ b/src/um/mod.rs @@ -14,3 +14,4 @@ #[cfg(feature = "um-wincon")] pub mod wincon; #[cfg(feature = "um-wingdi")] pub mod wingdi; #[cfg(feature = "um-winnt")] pub mod winnt; +#[cfg(feature = "um-ncrypt")] pub mod ncrypt; diff --git a/src/um/ncrypt.rs b/src/um/ncrypt.rs new file mode 100644 index 000000000..cd1d0f382 --- /dev/null +++ b/src/um/ncrypt.rs @@ -0,0 +1,13 @@ +// Copyright © 2016 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , 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::basetsd::ULONG_PTR; +use shared::sspi::SECURITY_STATUS; + +pub type NCRYPT_HANDLE = ULONG_PTR; +EXTERN!{"ncrypt" "stdcall" fn NCryptFreeObject( + hObject: NCRYPT_HANDLE +) -> SECURITY_STATUS}