# Path: resources/lib/PhoneBooks/pyicloud/vendorlibs/win32ctypes/_common.py
# LONG_PTR = ctypes.c_long
# 
# Path: resources/lib/PhoneBooks/pyicloud/vendorlibs/win32ctypes/_util.py
# def check_null(result, func, arguments, *args):
#     if result is None:
#         code = GetLastError()
#         description = FormatError(code).strip()
#         if func_name is None:
#             raise error(code, func.__name__, description)
#         else:
#             raise error(code, func_name, description)
#     return result
# 
# def check_zero(result, func, arguments, *args):
#     if result == 0:
#         code = GetLastError()
#         description = FormatError(code).strip()
#         if func_name is None:
#             raise error(code, func.__name__, description)
#         else:
#             raise error(code, func_name, description)
#     return result
# 
# def function_factory(
#         function,  argument_types=None, return_type=None,
#         error_checking=None):
#     if argument_types is not None:
#         function.argtypes = argument_types
#     function.restype = return_type
#     if error_checking is not None:
#         function.errcheck = error_checking
#     return function


import ctypes
from ctypes.wintypes import (
    BOOL, DWORD, HANDLE, HMODULE, LONG, LPCWSTR, WCHAR, WORD, HRSRC,
    HGLOBAL, LPVOID)
from ._common import LONG_PTR
from ._util import check_null, check_zero, function_factory
_EnumResourceTypes = function_factory(
    kernel32.EnumResourceTypesW,
    [HMODULE, ENUMRESTYPEPROC, LONG_PTR],
    BOOL,
    check_zero)

_EnumResourceNames = function_factory(
    kernel32.EnumResourceNamesW,
    [HMODULE, DWORD, ENUMRESNAMEPROC, LONG_PTR],
    BOOL,
    check_zero)

_EnumResourceLanguages = function_factory(
    kernel32.EnumResourceLanguagesW,
    [HMODULE, DWORD, DWORD, ENUMRESLANGPROC, LONG_PTR],
    BOOL,
    check_zero)

_LoadResource = function_factory(
    kernel32.LoadResource,
    [HMODULE, HRSRC],
    HGLOBAL,
    check_zero)

_LockResource = function_factory(
    kernel32.LockResource,
    [HGLOBAL],
    LPVOID,
    check_null)


# Path: resources/lib/PhoneBooks/pyicloud/vendorlibs/win32ctypes/_common.py
# LONG_PTR = ctypes.c_long
# 
# Path: resources/lib/PhoneBooks/pyicloud/vendorlibs/win32ctypes/_util.py
# def check_null(result, func, arguments, *args):
#     if result is None:
#         code = GetLastError()
#         description = FormatError(code).strip()
#         if func_name is None:
#             raise error(code, func.__name__, description)
#         else:
#             raise error(code, func_name, description)
#     return result
# 
# def check_zero(result, func, arguments, *args):
#     if result == 0:
#         code = GetLastError()
#         description = FormatError(code).strip()
#         if func_name is None:
#             raise error(code, func.__name__, description)
#         else:
#             raise error(code, func_name, description)
#     return result
# 
# def function_factory(
#         function,  argument_types=None, return_type=None,
#         error_checking=None):
#     if argument_types is not None:
#         function.argtypes = argument_types
#     function.restype = return_type
#     if error_checking is not None:
#         function.errcheck = error_checking
#     return function


# Path: resources/lib/PhoneBooks/pyicloud/vendorlibs/win32ctypes/_win32api.py
import ctypes
from ctypes.wintypes import (
    BOOL, DWORD, HANDLE, HMODULE, LONG, LPCWSTR, WCHAR, WORD, HRSRC,
    HGLOBAL, LPVOID)
from ._common import LONG_PTR
from ._util import check_null, check_zero, function_factory

_EnumResourceTypes = function_factory(
    kernel32.EnumResourceTypesW,
    [HMODULE, ENUMRESTYPEPROC, LONG_PTR],
    BOOL,
    check_zero)

_EnumResourceNames = function_factory(
    kernel32.EnumResourceNamesW,
    [HMODULE, DWORD, ENUMRESNAMEPROC, LONG_PTR],
    BOOL,
    check_zero)

_EnumResourceLanguages = function_factory(
    kernel32.EnumResourceLanguagesW,
    [HMODULE, DWORD, DWORD, ENUMRESLANGPROC, LONG_PTR],
    BOOL,
    check_zero)

_LoadResource = function_factory(
    kernel32.LoadResource,
    [HMODULE, HRSRC],
    HGLOBAL,
    check_zero)

_LockResource = function_factory(
    kernel32.LockResource,
    [HGLOBAL],
    LPVOID,
    check_null)


_FindResourceEx = function_factory(