コード例 #1
0
/* //////////////////////////////////////////////////////////////////////////////////////
 * implementation
 */
static tb_bool_t tb_shell32_instance_init(tb_handle_t instance, tb_cpointer_t priv)
{
    // check
    tb_shell32_ref_t shell32 = (tb_shell32_ref_t)instance;
    tb_check_return_val(shell32, tb_false);

    // the shell32 module
    HANDLE module = GetModuleHandleA("shell32.dll");
    if (!module) module = tb_dynamic_init("shell32.dll");
    tb_check_return_val(module, tb_false);

    // init interfaces
    TB_INTERFACE_LOAD(shell32, SHGetSpecialFolderLocation);
    TB_INTERFACE_LOAD(shell32, SHGetPathFromIDListW);

    // ok
    return tb_true;
}
コード例 #2
0
ファイル: iphlpapi.c プロジェクト: AlexShiLucky/tbox
/* //////////////////////////////////////////////////////////////////////////////////////
 * implementation
 */
static tb_bool_t tb_iphlpapi_instance_init(tb_handle_t instance, tb_cpointer_t priv)
{
    // check
    tb_iphlpapi_ref_t iphlpapi = (tb_iphlpapi_ref_t)instance;
    tb_assert_and_check_return_val(iphlpapi, tb_false);

    // the iphlpapi module
    HANDLE module = GetModuleHandleA("iphlpapi.dll");
    if (!module) module = tb_dynamic_init("iphlpapi.dll");
    tb_check_return_val(module, tb_false);

    // init interfaces
    TB_INTERFACE_LOAD(iphlpapi, GetNetworkParams);
    TB_INTERFACE_LOAD(iphlpapi, GetAdaptersInfo);
    TB_INTERFACE_LOAD(iphlpapi, GetAdaptersAddresses);

    // ok
    return tb_true;
}
コード例 #3
0
ファイル: kernel32.c プロジェクト: 1060460048/tbox
/* //////////////////////////////////////////////////////////////////////////////////////
 * implementation
 */
static tb_bool_t tb_kernel32_instance_init(tb_handle_t instance)
{
    // check
    tb_kernel32_ref_t kernel32 = (tb_kernel32_ref_t)instance;
    tb_assert_and_check_return_val(kernel32, tb_false);

    // the kernel32 module
    HANDLE module = GetModuleHandleA("kernel32.dll");
    if (!module) module = tb_dynamic_init("kernel32.dll");
    tb_assert_and_check_return_val(module, tb_false);

    // init interfaces
//    TB_INTERFACE_LOAD(kernel32, CancelIoEx);
    TB_INTERFACE_LOAD(kernel32, RtlCaptureStackBackTrace);
    TB_INTERFACE_LOAD(kernel32, GetFileSizeEx);
    TB_INTERFACE_LOAD(kernel32, GetQueuedCompletionStatusEx);
    TB_INTERFACE_LOAD(kernel32, InterlockedCompareExchange64);

    // ok
    return tb_true;
}
コード例 #4
0
ファイル: user32.c プロジェクト: AlexShiLucky/tbox
/* //////////////////////////////////////////////////////////////////////////////////////
 * implementation
 */
static tb_bool_t tb_user32_instance_init(tb_handle_t instance, tb_cpointer_t priv)
{
    // check
    tb_user32_ref_t user32 = (tb_user32_ref_t)instance;
    tb_assert_and_check_return_val(user32, tb_false);

    // the user32 module
    HANDLE module = GetModuleHandleA("user32.dll");
    if (!module) module = tb_dynamic_init("user32.dll");
    tb_assert_and_check_return_val(module, tb_false);

    // init interfaces
    TB_INTERFACE_LOAD(user32, GetSystemMetrics);

    // ok
    return tb_true;
}
コード例 #5
0
ファイル: kernel32.c プロジェクト: BailiShanghai/tbox
/* //////////////////////////////////////////////////////////////////////////////////////
 * implementation
 */
static tb_bool_t tb_kernel32_instance_init(tb_handle_t instance, tb_cpointer_t priv)
{
    // check
    tb_kernel32_ref_t kernel32 = (tb_kernel32_ref_t)instance;
    tb_assert_and_check_return_val(kernel32, tb_false);

    // the kernel32 module
    HANDLE module = GetModuleHandleA("kernel32.dll");
    if (!module) module = tb_dynamic_init("kernel32.dll");
    tb_assert_and_check_return_val(module, tb_false);

    // init interfaces
//    TB_INTERFACE_LOAD(kernel32, CancelIoEx);
    TB_INTERFACE_LOAD(kernel32, RtlCaptureStackBackTrace);
    TB_INTERFACE_LOAD(kernel32, GetFileSizeEx);
    TB_INTERFACE_LOAD(kernel32, GetQueuedCompletionStatusEx);
    TB_INTERFACE_LOAD(kernel32, InterlockedCompareExchange64);
    TB_INTERFACE_LOAD(kernel32, GetEnvironmentVariableW);
    TB_INTERFACE_LOAD(kernel32, SetEnvironmentVariableW);
    TB_INTERFACE_LOAD(kernel32, CreateProcessW);
    TB_INTERFACE_LOAD(kernel32, CloseHandle);
    TB_INTERFACE_LOAD(kernel32, WaitForSingleObject);
    TB_INTERFACE_LOAD(kernel32, GetExitCodeProcess);
    TB_INTERFACE_LOAD(kernel32, TerminateProcess);
    TB_INTERFACE_LOAD(kernel32, SuspendThread);
    TB_INTERFACE_LOAD(kernel32, ResumeThread);
    TB_INTERFACE_LOAD(kernel32, GetEnvironmentStringsW);
    TB_INTERFACE_LOAD(kernel32, FreeEnvironmentStringsW);
    TB_INTERFACE_LOAD(kernel32, SetHandleInformation);

    // ok
    return tb_true;
}
コード例 #6
0
ファイル: ws2_32.c プロジェクト: AlexShiLucky/tbox
/* //////////////////////////////////////////////////////////////////////////////////////
 * implementation
 */
static tb_bool_t tb_ws2_32_instance_init(tb_handle_t instance, tb_cpointer_t priv)
{
    // check
    tb_ws2_32_ref_t ws2_32 = (tb_ws2_32_ref_t)instance;
    tb_assert_and_check_return_val(ws2_32, tb_false);

    // the ws2_32 module
    HANDLE module = GetModuleHandleA("ws2_32.dll");
    if (!module) module = tb_dynamic_init("ws2_32.dll");
    tb_assert_and_check_return_val(module, tb_false);

    // init interfaces
    TB_INTERFACE_LOAD(ws2_32, WSAStartup);
    TB_INTERFACE_LOAD(ws2_32, WSACleanup);
    TB_INTERFACE_LOAD(ws2_32, WSASocketA);
    TB_INTERFACE_LOAD(ws2_32, WSAIoctl);
    TB_INTERFACE_LOAD(ws2_32, WSAGetLastError);
    TB_INTERFACE_LOAD(ws2_32, WSASend);
    TB_INTERFACE_LOAD(ws2_32, WSARecv);
    TB_INTERFACE_LOAD(ws2_32, WSASendTo);
    TB_INTERFACE_LOAD(ws2_32, WSARecvFrom);
    TB_INTERFACE_LOAD(ws2_32, bind);
    TB_INTERFACE_LOAD(ws2_32, send);
    TB_INTERFACE_LOAD(ws2_32, recv);
    TB_INTERFACE_LOAD(ws2_32, sendto);
    TB_INTERFACE_LOAD(ws2_32, recvfrom);
    TB_INTERFACE_LOAD(ws2_32, accept);
    TB_INTERFACE_LOAD(ws2_32, listen);
    TB_INTERFACE_LOAD(ws2_32, select);
    TB_INTERFACE_LOAD(ws2_32, connect);
    TB_INTERFACE_LOAD(ws2_32, shutdown);
    TB_INTERFACE_LOAD(ws2_32, getsockname);
    TB_INTERFACE_LOAD(ws2_32, getsockopt);
    TB_INTERFACE_LOAD(ws2_32, setsockopt);
    TB_INTERFACE_LOAD(ws2_32, ioctlsocket);
    TB_INTERFACE_LOAD(ws2_32, closesocket);
    TB_INTERFACE_LOAD(ws2_32, gethostname);
    TB_INTERFACE_LOAD(ws2_32, __WSAFDIsSet);

    // ok
    return tb_true;
}