Browse Source

Drop winapi/advapi32 deps

They take a *long* time to compile on Windows and aren't necessarily worth it.
add-rc-path
Alex Crichton 9 years ago
parent
commit
dc55d11eb2
  1. 13
      Cargo.toml
  2. 52
      src/registry.rs

13
Cargo.toml

@ -13,18 +13,5 @@ code.
"""
keywords = ["build-dependencies"]
[target.i686-pc-windows-msvc.dependencies]
winapi = "0.2.1"
advapi32-sys = "0.1.2"
[target.x86_64-pc-windows-msvc.dependencies]
winapi = "0.2.1"
advapi32-sys = "0.1.2"
[target.i686-pc-windows-gnu.dependencies]
winapi = "0.2.1"
advapi32-sys = "0.1.2"
[target.x86_64-pc-windows-gnu.dependencies]
winapi = "0.2.1"
advapi32-sys = "0.1.2"
[dev-dependencies]
tempdir = "0.3"

52
src/registry.rs

@ -8,18 +8,56 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate winapi;
extern crate advapi32;
use std::io;
use std::ffi::{OsString, OsStr};
use std::os::windows::prelude::*;
use std::io;
use std::ops::RangeFrom;
use self::winapi::*;
use self::advapi32::*;
use std::os::raw;
use std::os::windows::prelude::*;
pub struct RegistryKey(Repr);
type HKEY = *mut u8;
type DWORD = u32;
type LPDWORD = *mut DWORD;
type LPCWSTR = *const u16;
type LPWSTR = *mut u16;
type LONG = raw::c_long;
type PHKEY = *mut HKEY;
type PFILETIME = *mut u8;
type LPBYTE = *mut u8;
type REGSAM = u32;
const ERROR_SUCCESS: DWORD = 0;
const ERROR_NO_MORE_ITEMS: DWORD = 259;
const HKEY_LOCAL_MACHINE: HKEY = 0x80000002 as HKEY;
const REG_SZ: DWORD = 1;
const KEY_READ: DWORD = 0x20019;
const KEY_WOW64_32KEY: DWORD = 0x200;
#[link(name = "advapi32")]
extern "system" {
fn RegOpenKeyExW(key: HKEY,
lpSubKey: LPCWSTR,
ulOptions: DWORD,
samDesired: REGSAM,
phkResult: PHKEY) -> LONG;
fn RegEnumKeyExW(key: HKEY,
dwIndex: DWORD,
lpName: LPWSTR,
lpcName: LPDWORD,
lpReserved: LPDWORD,
lpClass: LPWSTR,
lpcClass: LPDWORD,
lpftLastWriteTime: PFILETIME) -> LONG;
fn RegQueryValueExW(hKey: HKEY,
lpValueName: LPCWSTR,
lpReserved: LPDWORD,
lpType: LPDWORD,
lpData: LPBYTE,
lpcbData: LPDWORD) -> LONG;
fn RegCloseKey(hKey: HKEY) -> LONG;
}
struct OwnedKey(HKEY);
enum Repr {

Loading…
Cancel
Save