()
return 'cp' + strval.value
Get Windows OEM codepage.
Get Windows OEM codepage.
Get Windows OEM codepage .
def _get_oem_encoding():
    """Get Windows OEM codepage."""
    hkey = HKEY()
    windll.advapi32.RegOpenKeyExW(
        HKEY_LOCAL_MACHINE, LPWSTR(u'SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage'),
        DWORD(0), DWORD(KEY_QUERY_VALUE), byref(hkey))
    strval = ctypes.create_unicode_buffer(255)
    # key HKLM SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage value OEMCP
    size = DWORD(0)
    windll.advapi32.RegQueryValueExW(hkey, LPWSTR(u'OEMCP'), DWORD(0), None, None, byref(size))
    windll.advapi32.RegQueryValueExW(
        hkey, LPWSTR(u'OEMCP'), DWORD(0), None, byref(strval), byref(size)
    )
    windll.advapi32.RegCloseKey(hkey)
    return 'cp' + strval.value
def _get_oem_encoding ( ) : hkey = HKEY ( ) windll . advapi32 . RegOpenKeyExW ( HKEY_LOCAL_MACHINE , LPWSTR ( u'SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage' ) , DWORD ( 0 ) , DWORD ( KEY_QUERY_VALUE ) , byref ( hkey ) ) strval = ctypes . create_unicode_buffer ( 255 ) # key HKLM SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage value OEMCP size = DWORD ( 0 ) windll . advapi32 . RegQueryValueExW ( hkey , LPWSTR ( u'OEMCP' ) , DWORD ( 0 ) , None , None , byref ( size ) ) windll . advapi32 . RegQueryValueExW ( hkey , LPWSTR ( u'OEMCP' ) , DWORD ( 0 ) , None , byref ( strval ) , byref ( size ) ) windll . advapi32 . RegCloseKey ( hkey ) return 'cp' + strval . value