当前位置: 首页>>代码示例>>Python>>正文


Python _ctypes.call_function方法代码示例

本文整理汇总了Python中_ctypes.call_function方法的典型用法代码示例。如果您正苦于以下问题:Python _ctypes.call_function方法的具体用法?Python _ctypes.call_function怎么用?Python _ctypes.call_function使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在_ctypes的用法示例。


在下文中一共展示了_ctypes.call_function方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_1703286_B

# 需要导入模块: import _ctypes [as 别名]
# 或者: from _ctypes import call_function [as 别名]
def test_1703286_B(self):
        # Since on winXP 64-bit advapi32 loads like described
        # above, the (arbitrarily selected) CloseEventLog function
        # also has a high address.  'call_function' should accept
        # addresses so large.
        from _ctypes import call_function
        advapi32 = windll.advapi32
        # Calling CloseEventLog with a NULL argument should fail,
        # but the call should not segfault or so.
        self.assertEqual(0, advapi32.CloseEventLog(None))
        windll.kernel32.GetProcAddress.argtypes = c_void_p, c_char_p
        windll.kernel32.GetProcAddress.restype = c_void_p
        proc = windll.kernel32.GetProcAddress(advapi32._handle,
                                              "CloseEventLog")
        self.assertTrue(proc)
        # This is the real test: call the function via 'call_function'
        self.assertEqual(0, call_function(proc, (None,))) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:19,代码来源:test_loading.py

示例2: test_1703286_B

# 需要导入模块: import _ctypes [as 别名]
# 或者: from _ctypes import call_function [as 别名]
def test_1703286_B(self):
            # Since on winXP 64-bit advapi32 loads like described
            # above, the (arbitrarily selected) CloseEventLog function
            # also has a high address.  'call_function' should accept
            # addresses so large.
            from _ctypes import call_function
            advapi32 = windll.advapi32
            # Calling CloseEventLog with a NULL argument should fail,
            # but the call should not segfault or so.
            self.assertEqual(0, advapi32.CloseEventLog(None))
            windll.kernel32.GetProcAddress.argtypes = c_void_p, c_char_p
            windll.kernel32.GetProcAddress.restype = c_void_p
            proc = windll.kernel32.GetProcAddress(advapi32._handle, "CloseEventLog")
            self.assertTrue(proc)
            # This is the real test: call the function via 'call_function'
            self.assertEqual(0, call_function(proc, (None,))) 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:18,代码来源:test_loading.py

示例3: test_1703286_B

# 需要导入模块: import _ctypes [as 别名]
# 或者: from _ctypes import call_function [as 别名]
def test_1703286_B(self):
        # Since on winXP 64-bit advapi32 loads like described
        # above, the (arbitrarily selected) CloseEventLog function
        # also has a high address.  'call_function' should accept
        # addresses so large.
        from _ctypes import call_function
        advapi32 = windll.advapi32
        # Calling CloseEventLog with a NULL argument should fail,
        # but the call should not segfault or so.
        self.assertEqual(0, advapi32.CloseEventLog(None))
        windll.kernel32.GetProcAddress.argtypes = c_void_p, c_char_p
        windll.kernel32.GetProcAddress.restype = c_void_p
        proc = windll.kernel32.GetProcAddress(advapi32._handle,
                                              b"CloseEventLog")
        self.assertTrue(proc)
        # This is the real test: call the function via 'call_function'
        self.assertEqual(0, call_function(proc, (None,))) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:19,代码来源:test_loading.py

示例4: test

# 需要导入模块: import _ctypes [as 别名]
# 或者: from _ctypes import call_function [as 别名]
def test(self):
        from _ctypes import call_function
        windll.kernel32.LoadLibraryA.restype = c_void_p
        windll.kernel32.GetProcAddress.argtypes = c_void_p, c_char_p
        windll.kernel32.GetProcAddress.restype = c_void_p

        hdll = windll.kernel32.LoadLibraryA("kernel32")
        funcaddr = windll.kernel32.GetProcAddress(hdll, "GetModuleHandleA")

        self.assertEqual(call_function(funcaddr, (None,)),
                             windll.kernel32.GetModuleHandleA(None)) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:13,代码来源:test_random_things.py

示例5: test

# 需要导入模块: import _ctypes [as 别名]
# 或者: from _ctypes import call_function [as 别名]
def test(self):
            from _ctypes import call_function
            windll.kernel32.LoadLibraryA.restype = c_void_p
            windll.kernel32.GetProcAddress.argtypes = c_void_p, c_char_p
            windll.kernel32.GetProcAddress.restype = c_void_p

            hdll = windll.kernel32.LoadLibraryA("kernel32")
            funcaddr = windll.kernel32.GetProcAddress(hdll, "GetModuleHandleA")

            self.assertEqual(call_function(funcaddr, (None,)),
                                 windll.kernel32.GetModuleHandleA(None)) 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:13,代码来源:test_random_things.py

示例6: test

# 需要导入模块: import _ctypes [as 别名]
# 或者: from _ctypes import call_function [as 别名]
def test(self):
        from _ctypes import call_function
        windll.kernel32.LoadLibraryA.restype = c_void_p
        windll.kernel32.GetProcAddress.argtypes = c_void_p, c_char_p
        windll.kernel32.GetProcAddress.restype = c_void_p

        hdll = windll.kernel32.LoadLibraryA(b"kernel32")
        funcaddr = windll.kernel32.GetProcAddress(hdll, b"GetModuleHandleA")

        self.assertEqual(call_function(funcaddr, (None,)),
                             windll.kernel32.GetModuleHandleA(None)) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:13,代码来源:test_random_things.py


注:本文中的_ctypes.call_function方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。