windy 0.4.0

A Windows strings library that supports ANSI string and wide string
Documentation
// Copyright takubokudori.
// This source code is licensed under the MIT or Apache-2.0 license.
#![allow(
    unused,
    non_camel_case_types,
    clippy::upper_case_acronyms,
    non_snake_case
)]

use crate::WStr;

pub(crate) type c_char = i8;
pub(crate) type c_ushort = u16;
pub(crate) type c_int = i32;
pub(crate) type c_uint = u32;
pub(crate) type c_ulong = u32;

pub(crate) type USHORT = c_ushort;
pub(crate) type UINT = c_uint;
pub(crate) type DWORD = c_ulong;
pub(crate) type LPBOOL = *mut c_int;
pub(crate) type LPSTR = *mut c_char;
pub(crate) type LPCSTR = *const c_char;
pub(crate) type PSTR = LPSTR;
pub(crate) type PCSTR = LPCSTR;
pub(crate) type LPWSTR = *mut u16;
pub(crate) type LPCWSTR = *const u16;
pub(crate) type PWSTR = LPWSTR;
pub(crate) type PCWSTR = LPCWSTR;

unsafe extern "C" {
    pub(crate) fn wcslen(s: *const u16) -> usize;

    pub(crate) fn strlen(s: *const u8) -> usize;

    pub(crate) fn wcsnlen(s: *const u16, len: usize) -> usize;

    pub(crate) fn strnlen(s: *const u8, len: usize) -> usize;
}

unsafe extern "system" {
    pub(crate) fn MultiByteToWideChar(
        CodePage: UINT,
        dwFlags: DWORD,
        lpMultiByteStr: LPCSTR,
        cbMultiByte: c_int,
        lpWideCharStr: LPWSTR,
        cchWideChar: c_int,
    ) -> c_int;

    pub(crate) fn WideCharToMultiByte(
        CodePage: UINT,
        dwFlags: DWORD,
        lpWideCharStr: LPCWSTR,
        cchWideChar: c_int,
        lpMultiByteStr: LPSTR,
        cbMultiByte: c_int,
        lpDefaultChar: LPCSTR,
        lpUsedDefaultChar: LPBOOL,
    ) -> c_int;

    pub(crate) fn GetLastError() -> DWORD;

    pub(crate) fn IsValidCodePage(CodePage: UINT) -> c_int;
}