mirror of
				https://github.com/noDRM/DeDRM_tools.git
				synced 2025-10-23 23:07:47 -04:00 
			
		
		
		
	Merge pull request #1333 from jpwhiting/fixwinreg
Fixwinreg - thanks, these all look useful and good.
This commit is contained in:
		
						commit
						019abecd05
					
				
					 10 changed files with 12 additions and 13 deletions
				
			
		|  | @ -289,7 +289,7 @@ class KeyIVGen(object): | ||||||
|         sha = hashlib.sha1 |         sha = hashlib.sha1 | ||||||
|         digest_size = sha().digest_size |         digest_size = sha().digest_size | ||||||
|         # l - number of output blocks to produce |         # l - number of output blocks to produce | ||||||
|         l = keylen / digest_size |         l = int(keylen / digest_size) | ||||||
|         if keylen % digest_size != 0: |         if keylen % digest_size != 0: | ||||||
|             l += 1 |             l += 1 | ||||||
|         h = hmac.new( passwd, None, sha ) |         h = hmac.new( passwd, None, sha ) | ||||||
|  |  | ||||||
|  | @ -95,7 +95,7 @@ def getNookLogFiles(): | ||||||
|     logFiles = [] |     logFiles = [] | ||||||
|     found = False |     found = False | ||||||
|     if iswindows: |     if iswindows: | ||||||
|         import _winreg as winreg |         import winreg | ||||||
| 
 | 
 | ||||||
|         # some 64 bit machines do not have the proper registry key for some reason |         # some 64 bit machines do not have the proper registry key for some reason | ||||||
|         # or the python interface to the 32 vs 64 bit registry is broken |         # or the python interface to the 32 vs 64 bit registry is broken | ||||||
|  |  | ||||||
|  | @ -190,7 +190,6 @@ if iswindows: | ||||||
|         create_unicode_buffer, create_string_buffer, CFUNCTYPE, addressof, \ |         create_unicode_buffer, create_string_buffer, CFUNCTYPE, addressof, \ | ||||||
|         string_at, Structure, c_void_p, cast |         string_at, Structure, c_void_p, cast | ||||||
| 
 | 
 | ||||||
|     # import _winreg as winreg |  | ||||||
|     import winreg |     import winreg | ||||||
|     MAX_PATH = 255 |     MAX_PATH = 255 | ||||||
|     kernel32 = windll.kernel32 |     kernel32 = windll.kernel32 | ||||||
|  |  | ||||||
|  | @ -20,7 +20,7 @@ class SimplePrefs(object): | ||||||
|             self.file2key[filename] = key |             self.file2key[filename] = key | ||||||
|         self.target = target + 'Prefs' |         self.target = target + 'Prefs' | ||||||
|         if sys.platform.startswith('win'): |         if sys.platform.startswith('win'): | ||||||
|             import _winreg as winreg |             import winreg | ||||||
|             regkey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\") |             regkey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\") | ||||||
|             path = winreg.QueryValueEx(regkey, 'Local AppData')[0] |             path = winreg.QueryValueEx(regkey, 'Local AppData')[0] | ||||||
|             prefdir = path + os.sep + self.target |             prefdir = path + os.sep + self.target | ||||||
|  |  | ||||||
|  | @ -37,14 +37,14 @@ class legacy_obok(object): | ||||||
|      |      | ||||||
|     def __oldcookiedeviceid(self): |     def __oldcookiedeviceid(self): | ||||||
|         '''Optionally attempt to get a device id using the old cookie method. |         '''Optionally attempt to get a device id using the old cookie method. | ||||||
|         Must have _winreg installed on Windows machines for successful key retrieval.''' |         Must have winreg installed on Windows machines for successful key retrieval.''' | ||||||
|         wsuid = '' |         wsuid = '' | ||||||
|         pwsdid = '' |         pwsdid = '' | ||||||
|         try: |         try: | ||||||
|             if sys.platform.startswith('win'): |             if sys.platform.startswith('win'): | ||||||
|                 import _winreg |                 import winreg | ||||||
|                 regkey_browser = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, 'Software\\Kobo\\Kobo Desktop Edition\\Browser') |                 regkey_browser = winreg.OpenKey(winreg.HKEY_CURRENT_USER, 'Software\\Kobo\\Kobo Desktop Edition\\Browser') | ||||||
|                 cookies = _winreg.QueryValueEx(regkey_browser, 'cookies') |                 cookies = winreg.QueryValueEx(regkey_browser, 'cookies') | ||||||
|                 bytearrays = cookies[0] |                 bytearrays = cookies[0] | ||||||
|             elif sys.platform.startswith('darwin'): |             elif sys.platform.startswith('darwin'): | ||||||
|                 prefs = os.path.join(os.environ['HOME'], 'Library/Preferences/com.kobo.Kobo Desktop Edition.plist') |                 prefs = os.path.join(os.environ['HOME'], 'Library/Preferences/com.kobo.Kobo Desktop Edition.plist') | ||||||
|  |  | ||||||
|  | @ -129,7 +129,7 @@ if iswindows: | ||||||
|         c_long, c_ulong |         c_long, c_ulong | ||||||
| 
 | 
 | ||||||
|     from ctypes.wintypes import LPVOID, DWORD, BOOL |     from ctypes.wintypes import LPVOID, DWORD, BOOL | ||||||
|     import _winreg as winreg |     import winreg | ||||||
| 
 | 
 | ||||||
|     def _load_crypto_libcrypto(): |     def _load_crypto_libcrypto(): | ||||||
|         from ctypes.util import find_library |         from ctypes.util import find_library | ||||||
|  |  | ||||||
|  | @ -98,7 +98,7 @@ def getNookLogFiles(): | ||||||
|     logFiles = [] |     logFiles = [] | ||||||
|     found = False |     found = False | ||||||
|     if iswindows: |     if iswindows: | ||||||
|         import _winreg as winreg |         import winreg | ||||||
| 
 | 
 | ||||||
|         # some 64 bit machines do not have the proper registry key for some reason |         # some 64 bit machines do not have the proper registry key for some reason | ||||||
|         # or the python interface to the 32 vs 64 bit registry is broken |         # or the python interface to the 32 vs 64 bit registry is broken | ||||||
|  |  | ||||||
|  | @ -177,7 +177,7 @@ if iswindows: | ||||||
|         create_unicode_buffer, create_string_buffer, CFUNCTYPE, addressof, \ |         create_unicode_buffer, create_string_buffer, CFUNCTYPE, addressof, \ | ||||||
|         string_at, Structure, c_void_p, cast |         string_at, Structure, c_void_p, cast | ||||||
| 
 | 
 | ||||||
|     import _winreg as winreg |     import winreg | ||||||
|     MAX_PATH = 255 |     MAX_PATH = 255 | ||||||
|     kernel32 = windll.kernel32 |     kernel32 = windll.kernel32 | ||||||
|     advapi32 = windll.advapi32 |     advapi32 = windll.advapi32 | ||||||
|  |  | ||||||
|  | @ -346,7 +346,7 @@ class KoboLibrary(object): | ||||||
|         if (self.kobodir == u""): |         if (self.kobodir == u""): | ||||||
|             # step 4. we haven't found a device with serials, so try desktop apps |             # step 4. we haven't found a device with serials, so try desktop apps | ||||||
|             if sys.platform.startswith('win'): |             if sys.platform.startswith('win'): | ||||||
|                 import _winreg as winreg |                 import winreg | ||||||
|                 if sys.getwindowsversion().major > 5: |                 if sys.getwindowsversion().major > 5: | ||||||
|                     if 'LOCALAPPDATA' in os.environ.keys(): |                     if 'LOCALAPPDATA' in os.environ.keys(): | ||||||
|                         # Python 2.x does not return unicode env. Use Python 3.x |                         # Python 2.x does not return unicode env. Use Python 3.x | ||||||
|  |  | ||||||
|  | @ -2290,7 +2290,7 @@ class PDFDocument(object): | ||||||
|             import win32api |             import win32api | ||||||
|             import win32security |             import win32security | ||||||
|             import win32file |             import win32file | ||||||
|             import _winreg as winreg |             import winreg | ||||||
|         except: |         except: | ||||||
|             raise ADEPTError('PyWin Extension (Win32API module) needed.\n'+\ |             raise ADEPTError('PyWin Extension (Win32API module) needed.\n'+\ | ||||||
|                              'Download from http://sourceforge.net/projects/pywin32/files/ ') |                              'Download from http://sourceforge.net/projects/pywin32/files/ ') | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Apprentice Harper
						Apprentice Harper