Пример #1
0
class IMMDevice(IUnknown):
    _iid_ = GUID('{D666063F-1587-4E43-81F1-B948E807363F}')
    _methods_ = (COMMETHOD(
        [], HRESULT, 'Activate', (['in'], POINTER(GUID), 'iid'),
        (['in'], DWORD, 'dwClsCtx'),
        (['in'], POINTER(DWORD), 'pActivationParams'),
        (['out'], POINTER(POINTER(IUnknown)), 'ppInterface')), )
Пример #2
0
class IMMDeviceCollection(IUnknown):
	_iid_ = GUID('{0BD7A1BE-7A1A-44DB-8397-CC5392387B5E}')
	_methods_ = (
		COMMETHOD([], HRESULT, 'GetCount',
			(['out'], POINTER(UINT), 'pcDevices')),
		COMMETHOD([], HRESULT, 'Item',
			(['in'], UINT, 'nDevice'),
			(['out'], POINTER(POINTER(IMMDevice)), 'ppDevice')))
Пример #3
0
class IMMDeviceEnumerator(IUnknown):
	_iid_ = GUID('{A95664D2-9614-4F35-A746-DE8DB63617E6}')
	_methods_ = (
		COMMETHOD([], HRESULT, 'EnumAudioEndpoints',
			(['in'], DWORD, 'dataFlow'),
			(['in'], DWORD, 'dwStateMask'),
			(['out'], POINTER(POINTER(IMMDeviceCollection)), 'ppDevices')),
		COMMETHOD([], HRESULT, 'GetDefaultAudioEndpoint',
			(['in'], DWORD, 'dataFlow'),
			(['in'], DWORD, 'role'),
			(['out'], POINTER(POINTER(IMMDevice)), 'ppDevices')),)
Пример #4
0
def getVolumeObject():
	CLSID_MMDeviceEnumerator = GUID('{BCDE0395-E52F-467C-8E3D-C4579291692E}')
	deviceEnumerator = CoCreateInstance(CLSID_MMDeviceEnumerator, IMMDeviceEnumerator, 1)
	volObj = cast(
		deviceEnumerator.GetDefaultAudioEndpoint(0, 1).Activate(IAudioEndpointVolume._iid_, 7, None),
		POINTER(IAudioEndpointVolume))
	return volObj
Пример #5
0
class IBugTraqProvider(IUnknown):
    _iid_ = GUID("{298B927C-7220-423C-B7B4-6E241F00CD93}")
    _methods_ = [
        COMMETHOD([], HRESULT, "ValidateParameters",
                  (['in'], comtypes.c_long, "hParentWnd"),
                  (['in'], comtypes.BSTR, "parameters"),
                  (['out', 'retval'], POINTER(comtypes.c_int16), "pRetVal")),
        COMMETHOD([], HRESULT, "GetLinkText",
                  (['in'], comtypes.c_long, "hParentWnd"),
                  (['in'], comtypes.BSTR, "parameters"),
                  (['out', 'retval'], POINTER(comtypes.BSTR), "pRetVal")),
        COMMETHOD([], HRESULT, "GetCommitMessage",
                  (['in'], comtypes.c_long, "hParentWnd"),
                  (['in'], comtypes.BSTR, "parameters"),
                  (['in'], comtypes.BSTR, "commonRoot"),
                  (['in'], _midlSAFEARRAY(comtypes.BSTR), "pathList"),
                  (['in'], comtypes.BSTR, "originalMessage"),
                  (['out', 'retval'], POINTER(comtypes.BSTR), "pRetVal"))
    ]
Пример #6
0
class IBugTraqProvider2(IBugTraqProvider):
    _iid_ = GUID("{C5C85E31-2F9B-4916-A7BA-8E27D481EE83}")
    _methods_ = [
        COMMETHOD(
            [], HRESULT, "GetCommitMessage2",
            (['in'], comtypes.c_long, "hParentWnd"),
            (['in'], comtypes.BSTR, "parameters"),
            (['in'], comtypes.BSTR, "commonURL"),
            (['in'], comtypes.BSTR, "commonRoot"),
            (['in'], _midlSAFEARRAY(comtypes.BSTR), "pathList"),
            (['in'], comtypes.BSTR, "originalMessage"),
            (['in'], comtypes.BSTR, "bugID"),
            (['out'], POINTER(comtypes.BSTR), "bugIDOut"),
            (['out'], POINTER(_midlSAFEARRAY(comtypes.BSTR)), "revPropNames"),
            (['out'], POINTER(_midlSAFEARRAY(comtypes.BSTR)), "revPropValues"),
            (['out', 'retval'], POINTER(comtypes.BSTR), "pRetVal")),
        COMMETHOD([], HRESULT, "CheckCommit",
                  (['in'], comtypes.c_long, "hParentWnd"),
                  (['in'], comtypes.BSTR, "parameters"),
                  (['in'], comtypes.BSTR, "commonURL"),
                  (['in'], comtypes.BSTR, "commonRoot"),
                  (['in'], _midlSAFEARRAY(comtypes.BSTR), "pathList"),
                  (['in'], comtypes.BSTR, "commitMessage"),
                  (['out', 'retval'], POINTER(comtypes.BSTR), "pRetVal")),
        COMMETHOD([], HRESULT, "OnCommitFinished",
                  (['in'], comtypes.c_long, "hParentWnd"),
                  (['in'], comtypes.BSTR, "commonRoot"),
                  (['in'], _midlSAFEARRAY(comtypes.BSTR), "pathList"),
                  (['in'], comtypes.BSTR, "logMessage"),
                  (['in'], comtypes.c_long, "revision"),
                  (['out', 'retval'], POINTER(comtypes.BSTR), "pRetVal")),
        COMMETHOD([], HRESULT, "HasOptions",
                  (['out', 'retval'], POINTER(comtypes.c_int16), "pRetVal")),
        COMMETHOD([], HRESULT, "ShowOptionsDialog",
                  (['in'], comtypes.c_long, "hParentWnd"),
                  (['in'], comtypes.BSTR, "parameters"),
                  (['out', 'retval'], POINTER(comtypes.BSTR), "pRetVal"))
    ]
Пример #7
0
class IAudioEndpointVolume(IUnknown):
	_iid_ = GUID('{5CDF2C82-841E-4546-9722-0CF74078229A}')
	_methods_ = (
		COMMETHOD([], HRESULT, 'NotImpl1'),
		COMMETHOD([], HRESULT, 'NotImpl2'),
		COMMETHOD([], HRESULT, 'GetChannelCount', (['out'], POINTER(UINT), 'pnChannelCount')),
		COMMETHOD([], HRESULT, 'SetMasterVolumeLevel',
			(['in'], c_float, 'fLevelDB'), (['in'], POINTER(GUID), 'pguidEventContext')),
		COMMETHOD([], HRESULT, 'SetMasterVolumeLevelScalar',
			(['in'], c_float, 'fLevel'), (['in'], POINTER(GUID), 'pguidEventContext')),
		COMMETHOD([], HRESULT, 'GetMasterVolumeLevel', (['out'], POINTER(c_float), 'pfLevelDB')),
		COMMETHOD([], HRESULT, 'GetMasterVolumeLevelScalar', (['out'], POINTER(c_float), 'pfLevelDB')),
		COMMETHOD([], HRESULT, 'SetChannelVolumeLevel',
			(['in'], UINT, 'nChannel'), (['in'], c_float, 'fLevelDB'), (['in'], POINTER(GUID), 'pguidEventContext')),
		COMMETHOD([], HRESULT, 'SetChannelVolumeLevelScalar',
			(['in'], DWORD, 'nChannel'), (['in'], c_float, 'fLevelDB'), (['in'], POINTER(GUID), 'pguidEventContext')),
		COMMETHOD([], HRESULT, 'GetChannelVolumeLevel',
			(['in'], UINT, 'nChannel'),
			(['out'], POINTER(c_float), 'pfLevelDB')),
		COMMETHOD([], HRESULT, 'GetChannelVolumeLevelScalar',
			(['in'], DWORD, 'nChannel'),
			(['out'], POINTER(c_float), 'pfLevelDB')),
		COMMETHOD([], HRESULT, 'SetMute', (['in'], BOOL, 'bMute'), (['in'], POINTER(GUID), 'pguidEventContext')),
		COMMETHOD([], HRESULT, 'GetMute', (['out'], POINTER(BOOL), 'pbMute')),
		COMMETHOD([], HRESULT, 'GetVolumeStepInfo',
			(['out'], POINTER(DWORD), 'pnStep'),
			(['out'], POINTER(DWORD), 'pnStepCount')),
		COMMETHOD([], HRESULT, 'VolumeStepUp', (['in'], POINTER(GUID), 'pguidEventContext')),
		COMMETHOD([], HRESULT, 'VolumeStepDown', (['in'], POINTER(GUID), 'pguidEventContext')),
		COMMETHOD([], HRESULT, 'QueryHardwareSupport', (['out'], POINTER(DWORD), 'pdwHardwareSupportMask')),
		COMMETHOD([], HRESULT, 'GetVolumeRange',
			(['out'], POINTER(c_float), 'pfMin'),
			(['out'], POINTER(c_float), 'pfMax'),
			(['out'], POINTER(c_float), 'pfIncr')))
Пример #8
0
import ctypes
from comtypes import GUID, POINTER
from ctypes.wintypes import ULONG, LONG

LONGLONG = ctypes.c_longlong


class KSAUDIO_CHANNEL_CONFIG(ctypes.Structure):

    _fields_ = [
        ('ActiveSpeakerPositions', LONG)
    ]


PKSAUDIO_CHANNEL_CONFIG = POINTER(KSAUDIO_CHANNEL_CONFIG)


class KSIDENTIFIER_STRUCT(ctypes.Union):
    _fields_ = [
        ('Set', GUID),
        ('Id', ULONG),
        ('Flags', ULONG)
    ]


class KSIDENTIFIER_UNION(ctypes.Union):
    _anonymous_ = 'KSIDENTIFIER_STRUCT'
    _fields_ = [
        ('KSIDENTIFIER_STRUCT', KSIDENTIFIER_STRUCT)
    ]
Пример #9
0
#obtain hwnd of application
time.sleep(10)
hwnd = win32gui.FindWindow(None, "Notepad")
#hwnd = win32gui.FindWindow("Communicator5",None)


def winfun(hwnd, lparam):
    allHwnd.append(hwnd)


#naughty global variable
allHwnd = []
#call winfun to populate allHwnd with all the child hwnds
win32gui.EnumChildWindows(hwnd, winfun, None)

for childHwnd in allHwnd:
    OBJID_NATIVEOM = -16
    p = POINTER(IDispatch)()
    try:
        oledll.oleacc.AccessibleObjectFromWindow(childHwnd, OBJID_NATIVEOM,
                                                 byref(IDispatch._iid_),
                                                 byref(p))
        window = comDy.Dispatch(p)
        CATIA = window.application
        print('winner winner hwnd: ' + str(childHwnd))
        print(CATIA)
    except:
        print('No dice')
#lots of 'No dice' printed with one successful COMObject when the application is Word or Excel.
#only lots of 'No Dice' when running on everything else
Пример #10
0
class KSIDENTIFIER_UNION(ctypes.Union):
    _anonymous_ = 'KSIDENTIFIER_STRUCT'
    _fields_ = [
        ('KSIDENTIFIER_STRUCT', KSIDENTIFIER_STRUCT)
    ]


class KSIDENTIFIER(ctypes.Structure):
    _anonymous_ = 'KSIDENTIFIER_UNION'
    _fields_ = [
        ('KSIDENTIFIER_UNION', KSIDENTIFIER_UNION),
        ('Alignment', LONGLONG)
    ]


PKSIDENTIFIER = POINTER(KSIDENTIFIER)


class KSMETHOD(KSIDENTIFIER):
    pass


PKSMETHOD = POINTER(KSMETHOD)


class KSEVENT(KSIDENTIFIER):
    pass


PKSEVENT = POINTER(KSEVENT)
Пример #11
0
class ISequentialStream(IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{0C733A30-2A1C-11CE-ADE5-00AA0044773D}')
    _idlflags_ = []


class IStream(ISequentialStream):
    _case_insensitive_ = True
    _iid_ = GUID('{0000000C-0000-0000-C000-000000000046}')
    _idlflags_ = []


IPersistStream._methods_ = [
    COMMETHOD([], HRESULT, 'IsDirty'),
    COMMETHOD([], HRESULT, 'Load',
              (['in'], POINTER(IStream), 'pstm')),
    COMMETHOD([], HRESULT, 'Save',
              (['in'], POINTER(IStream), 'pstm'),
              (['in'], c_int, 'fClearDirty')),
    COMMETHOD([], HRESULT, 'GetSizeMax',
              (['out'], POINTER(_ULARGE_INTEGER), 'pcbSize')),
]


class IEnumMoniker(IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID("{00000102-0000-0000-C000-000000000046}")
    _idlflags_ = []


class IMoniker(IPersistStream):