(cp)
| 38 | |
| 39 | # On small versions of Windows like Windows IoT or Windows Nano Server not all codepages are present |
| 40 | def is_code_page_present(cp): |
| 41 | from ctypes import POINTER, WINFUNCTYPE, WinDLL, Structure |
| 42 | from ctypes.wintypes import BOOL, BYTE, WCHAR, UINT, DWORD |
| 43 | |
| 44 | MAX_LEADBYTES = 12 # 5 ranges, 2 bytes ea., 0 term. |
| 45 | MAX_DEFAULTCHAR = 2 # single or double byte |
| 46 | MAX_PATH = 260 |
| 47 | class CPINFOEXW(Structure): |
| 48 | _fields_ = [("MaxCharSize", UINT), |
| 49 | ("DefaultChar", BYTE*MAX_DEFAULTCHAR), |
| 50 | ("LeadByte", BYTE*MAX_LEADBYTES), |
| 51 | ("UnicodeDefaultChar", WCHAR), |
| 52 | ("CodePage", UINT), |
| 53 | ("CodePageName", WCHAR*MAX_PATH)] |
| 54 | |
| 55 | prototype = WINFUNCTYPE(BOOL, UINT, DWORD, POINTER(CPINFOEXW)) |
| 56 | GetCPInfoEx = prototype(("GetCPInfoExW", WinDLL("kernel32"))) |
| 57 | info = CPINFOEXW() |
| 58 | return GetCPInfoEx(cp, 0, info) |
| 59 | |
| 60 | class Queue(object): |
| 61 | """ |
no test coverage detected
searching dependent graphs…