當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。