Python win32api.LoadLibrary() Examples

The following are 30 code examples of win32api.LoadLibrary(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module win32api , or try the search function .
Example #1
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
def MyComputer(self):
        mc_reg = None
        try:
            mc_reg = _winreg.OpenKey(
                _winreg.HKEY_CLASSES_ROOT,
                "CLSID\\{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
            )
            value, type = _winreg.QueryValueEx(mc_reg, "LocalizedString")
            dll = os.path.split(value.split(",")[0][1:])[1]
            index = -1*int(value.split(",")[1])
            myComputer = LoadString(LoadLibrary(dll), index)
        except:
            myComputer = self.text.myComp
        if mc_reg:
            _winreg.CloseKey(mc_reg)
        return myComputer 
Example #2
Source File: console.py    From eavatar-me with Apache License 2.0 6 votes vote down vote up
def __init__(self, shell):
        win32gui.InitCommonControls()
        self.hinst = win32gui.dllhandle
        # win32api.LoadLibrary('MSFTEDIT.dll')
        self.shell = shell
        self.hicon = None
        self.list_data = {}
        self.className = "AvaConsole"
        self.title = 'Ava Console'
        self.hwnd = None
        self.job_name = 'job-1'
        self.script = ''
        self.row = 1
        self.col = 1
        self.hidden = False
        self.validator = ScriptValidator() 
Example #3
Source File: hook-pywintypes.py    From ConTroll_Remote_Access_Trojan with Apache License 2.0 5 votes vote down vote up
def hook(mod):
    import sys
    newname = 'pywintypes%d%d' % sys.version_info[:2]
    if mod.typ == 'EXTENSION':
        mod.__name__ = newname
    else:
        import win32api
        h = win32api.LoadLibrary(newname + '.dll')
        pth = win32api.GetModuleFileName(h)
        #win32api.FreeLibrary(h)
        mod = PyInstaller.depend.modules.ExtensionModule(newname, pth)
    return mod 
Example #4
Source File: gyptest-link-enable-uac.py    From gyp with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def extract_manifest(path, resource_name):
    """Reads manifest from |path| and returns it as a string.
    Returns None is there is no such manifest."""
    with LoadLibrary(path) as handle:
      try:
        return win32api.LoadResource(handle, RT_MANIFEST, resource_name)
      except pywintypes.error as error:
        if error.args[0] == winerror.ERROR_RESOURCE_DATA_NOT_FOUND:
          return None
        else:
          raise 
Example #5
Source File: gyptest-link-generate-manifest.py    From kawalpemilu2014 with GNU Affero General Public License v3.0 5 votes vote down vote up
def __enter__(self):
      self._handle = win32api.LoadLibrary(self._path)
      return self._handle 
Example #6
Source File: gyptest-link-generate-manifest.py    From kawalpemilu2014 with GNU Affero General Public License v3.0 5 votes vote down vote up
def extract_manifest(path, resource_name):
    """Reads manifest from |path| and returns it as a string.
    Returns None is there is no such manifest."""
    with LoadLibrary(path) as handle:
      try:
        return win32api.LoadResource(handle, RT_MANIFEST, resource_name)
      except pywintypes.error as error:
        if error.args[0] == winerror.ERROR_RESOURCE_DATA_NOT_FOUND:
          return None
        else:
          raise 
Example #7
Source File: gyptest-link-update-manifest.py    From kawalpemilu2014 with GNU Affero General Public License v3.0 5 votes vote down vote up
def __enter__(self):
      self._handle = win32api.LoadLibrary(self._path)
      return self._handle 
Example #8
Source File: gyptest-link-update-manifest.py    From kawalpemilu2014 with GNU Affero General Public License v3.0 5 votes vote down vote up
def extract_manifest(path, resource_name):
    """Reads manifest from |path| and returns it as a string.
    Returns None is there is no such manifest."""
    with LoadLibrary(path) as handle:
      try:
        return win32api.LoadResource(handle, RT_MANIFEST, resource_name)
      except pywintypes.error as error:
        if error.args[0] == winerror.ERROR_RESOURCE_DATA_NOT_FOUND:
          return None
        else:
          raise 
Example #9
Source File: gyptest-link-embed-manifest.py    From kawalpemilu2014 with GNU Affero General Public License v3.0 5 votes vote down vote up
def __enter__(self):
      self._handle = win32api.LoadLibrary(self._path)
      return self._handle 
Example #10
Source File: gyptest-link-enable-uac.py    From kawalpemilu2014 with GNU Affero General Public License v3.0 5 votes vote down vote up
def __enter__(self):
      self._handle = win32api.LoadLibrary(self._path)
      return self._handle 
Example #11
Source File: gyptest-link-enable-uac.py    From kawalpemilu2014 with GNU Affero General Public License v3.0 5 votes vote down vote up
def extract_manifest(path, resource_name):
    """Reads manifest from |path| and returns it as a string.
    Returns None is there is no such manifest."""
    with LoadLibrary(path) as handle:
      try:
        return win32api.LoadResource(handle, RT_MANIFEST, resource_name)
      except pywintypes.error as error:
        if error.args[0] == winerror.ERROR_RESOURCE_DATA_NOT_FOUND:
          return None
        else:
          raise 
Example #12
Source File: notice_dlg.py    From eavatar-me with Apache License 2.0 5 votes vote down vote up
def __init__(self, shell):
        win32gui.InitCommonControls()
        self.hinst = win32gui.dllhandle
        # win32api.LoadLibrary('MSFTEDIT.dll')
        self.shell = shell
        self.hicon = None
        self.list_data = {}
        self.className = "AvaNoticeDialog"
        self.title = 'Notice'
        self.hwnd = None
        self.job_name = 'job-1'
        self.script = ''

        self.hidden = False 
Example #13
Source File: gyptest-link-enable-uac.py    From gyp with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __enter__(self):
      self._handle = win32api.LoadLibrary(self._path)
      return self._handle 
Example #14
Source File: hook-pythoncom.py    From ConTroll_Remote_Access_Trojan with Apache License 2.0 5 votes vote down vote up
def hook(mod):
    import sys
    newname = 'pythoncom%d%d' % sys.version_info[:2]
    if mod.typ == 'EXTENSION':
        mod.__name__ = newname
    else:
        import win32api
        h = win32api.LoadLibrary(newname + '.dll')
        pth = win32api.GetModuleFileName(h)
        #win32api.FreeLibrary(h)
        mod = PyInstaller.depend.modules.ExtensionModule(newname, pth)
    return mod 
Example #15
Source File: gyptest-link-generate-manifest.py    From android-xmrig-miner with GNU General Public License v3.0 5 votes vote down vote up
def __enter__(self):
      self._handle = win32api.LoadLibrary(self._path)
      return self._handle 
Example #16
Source File: gyptest-link-generate-manifest.py    From android-xmrig-miner with GNU General Public License v3.0 5 votes vote down vote up
def extract_manifest(path, resource_name):
    """Reads manifest from |path| and returns it as a string.
    Returns None is there is no such manifest."""
    with LoadLibrary(path) as handle:
      try:
        return win32api.LoadResource(handle, RT_MANIFEST, resource_name)
      except pywintypes.error as error:
        if error.args[0] == winerror.ERROR_RESOURCE_DATA_NOT_FOUND:
          return None
        else:
          raise 
Example #17
Source File: gyptest-link-update-manifest.py    From android-xmrig-miner with GNU General Public License v3.0 5 votes vote down vote up
def __enter__(self):
      self._handle = win32api.LoadLibrary(self._path)
      return self._handle 
Example #18
Source File: gyptest-link-update-manifest.py    From android-xmrig-miner with GNU General Public License v3.0 5 votes vote down vote up
def extract_manifest(path, resource_name):
    """Reads manifest from |path| and returns it as a string.
    Returns None is there is no such manifest."""
    with LoadLibrary(path) as handle:
      try:
        return win32api.LoadResource(handle, RT_MANIFEST, resource_name)
      except pywintypes.error as error:
        if error.args[0] == winerror.ERROR_RESOURCE_DATA_NOT_FOUND:
          return None
        else:
          raise 
Example #19
Source File: gyptest-link-embed-manifest.py    From android-xmrig-miner with GNU General Public License v3.0 5 votes vote down vote up
def __enter__(self):
      self._handle = win32api.LoadLibrary(self._path)
      return self._handle 
Example #20
Source File: gyptest-link-enable-uac.py    From android-xmrig-miner with GNU General Public License v3.0 5 votes vote down vote up
def __enter__(self):
      self._handle = win32api.LoadLibrary(self._path)
      return self._handle 
Example #21
Source File: gyptest-link-enable-uac.py    From android-xmrig-miner with GNU General Public License v3.0 5 votes vote down vote up
def extract_manifest(path, resource_name):
    """Reads manifest from |path| and returns it as a string.
    Returns None is there is no such manifest."""
    with LoadLibrary(path) as handle:
      try:
        return win32api.LoadResource(handle, RT_MANIFEST, resource_name)
      except pywintypes.error as error:
        if error.args[0] == winerror.ERROR_RESOURCE_DATA_NOT_FOUND:
          return None
        else:
          raise 
Example #22
Source File: shell_view.py    From Email_My_PC with MIT License 5 votes vote down vote up
def CreateViewWindow(self, prev, settings, browser, rect):
        print "ScintillaShellView.CreateViewWindow", prev, settings, browser, rect
        # Make sure scintilla.dll is loaded.  If not, find it on sys.path
        # (which it generally is for Pythonwin)
        try:
            win32api.GetModuleHandle("Scintilla.dll")
        except win32api.error:
            for p in sys.path:
                fname = os.path.join(p, "Scintilla.dll")
                if not os.path.isfile(fname):
                    fname = os.path.join(p, "Build", "Scintilla.dll")
                if os.path.isfile(fname):
                    win32api.LoadLibrary(fname)
                    break
            else:
                raise RuntimeError("Can't find scintilla!")

        style = win32con.WS_CHILD | win32con.WS_VSCROLL | \
                win32con.WS_HSCROLL | win32con.WS_CLIPCHILDREN | \
                win32con.WS_VISIBLE
        self.hwnd = win32gui.CreateWindow("Scintilla", "Scintilla", style,
                              rect[0], rect[1], rect[2]-rect[0], rect[3]-rect[1], 
                              self.hwnd_parent, 1000, 0, None)

        message_map = {
                win32con.WM_SIZE: self.OnSize,
        }
#        win32gui.SetWindowLong(self.hwnd, win32con.GWL_WNDPROC, message_map)

        file_data = file(self.filename, "U").read()

        self._SetupLexer()
        self._SendSci(scintillacon.SCI_ADDTEXT, len(file_data), file_data)
        if self.lineno != None:
            self._SendSci(scintillacon.SCI_GOTOLINE, self.lineno)
        print "Scintilla's hwnd is", self.hwnd 
Example #23
Source File: gyptest-link-update-manifest.py    From gyp with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __enter__(self):
      self._handle = win32api.LoadLibrary(self._path)
      return self._handle 
Example #24
Source File: win32timezone.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def __getitem__(self, filename):
		key = filename.lower()
		return self.__cache.setdefault(key, win32api.LoadLibrary(key)) 
Example #25
Source File: gyptest-link-generate-manifest.py    From GYP3 with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __enter__(self):
    self._handle = win32api.LoadLibrary(self._path)
    return self._handle 
Example #26
Source File: gyptest-link-generate-manifest.py    From GYP3 with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def extract_manifest(path, resource_name):
  """Reads manifest from |path| and returns it as a string.
  Returns None is there is no such manifest."""
  with LoadLibrary(path) as handle:
    try:
      return win32api.LoadResource(handle, RT_MANIFEST, resource_name)
    except pywintypes.error as error:
      if error.args[0] == winerror.ERROR_RESOURCE_DATA_NOT_FOUND:
        return None
      else:
        raise 
Example #27
Source File: gyptest-link-update-manifest.py    From GYP3 with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __enter__(self):
    self._handle = win32api.LoadLibrary(self._path)
    return self._handle 
Example #28
Source File: gyptest-link-update-manifest.py    From GYP3 with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def extract_manifest(path, resource_name):
  """Reads manifest from |path| and returns it as a string.
  Returns None is there is no such manifest."""
  with LoadLibrary(path) as handle:
    try:
      return win32api.LoadResource(
          handle, RT_MANIFEST, resource_name).decode('utf-8', 'ignore')
    except pywintypes.error as error:
      if error.args[0] == winerror.ERROR_RESOURCE_DATA_NOT_FOUND:
        return None
      else:
        raise 
Example #29
Source File: gyptest-link-embed-manifest.py    From GYP3 with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __enter__(self):
    self._handle = win32api.LoadLibrary(self._path)
    return self._handle 
Example #30
Source File: gyptest-link-enable-uac.py    From GYP3 with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __enter__(self):
    self._handle = win32api.LoadLibrary(self._path)
    return self._handle