mirror of
https://github.com/reactos/reactos.git
synced 2026-07-06 15:44:24 +08:00
- Implement GetCPInfoExA/W (not fully)
- Move CODEPAGE_ENTRY struct to header file - Small fix HeapWalk svn path=/trunk/; revision=37164
This commit is contained in:
@@ -38,6 +38,15 @@
|
||||
#define SetLastErrorByStatus(__S__) \
|
||||
((void)SetLastError(RtlNtStatusToDosError(__S__)))
|
||||
|
||||
typedef struct _CODEPAGE_ENTRY
|
||||
{
|
||||
LIST_ENTRY Entry;
|
||||
UINT CodePage;
|
||||
HANDLE SectionHandle;
|
||||
PBYTE SectionMapping;
|
||||
CPTABLEINFO CodePageTable;
|
||||
} CODEPAGE_ENTRY, *PCODEPAGE_ENTRY;
|
||||
|
||||
typedef
|
||||
DWORD
|
||||
(*WaitForInputIdleType)(
|
||||
@@ -171,5 +180,8 @@ BasepMapFile(IN LPCWSTR lpApplicationName,
|
||||
OUT PHANDLE hSection,
|
||||
IN PUNICODE_STRING ApplicationName);
|
||||
|
||||
PCODEPAGE_ENTRY FASTCALL
|
||||
IntGetCodePageEntry(UINT CodePage);
|
||||
|
||||
#endif /* ndef _KERNEL32_INCLUDE_KERNEL32_H */
|
||||
|
||||
|
||||
@@ -262,10 +262,13 @@ HeapWalk(HANDLE hHeap,
|
||||
|
||||
Status = RtlWalkHeap(hHeap, lpEntry);
|
||||
|
||||
if (Status)
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastError(RtlNtStatusToDosError(Status));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return !Status;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
||||
@@ -1267,32 +1267,89 @@ GetCPInfo (
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
STDCALL
|
||||
GetCPInfoExW(
|
||||
UINT CodePage,
|
||||
DWORD dwFlags,
|
||||
LPCPINFOEXW lpCPInfoEx)
|
||||
GetCPInfoExW(UINT CodePage,
|
||||
DWORD dwFlags,
|
||||
LPCPINFOEXW lpCPInfoEx)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
if (!GetCPInfo(CodePage, (LPCPINFO) lpCPInfoEx))
|
||||
return FALSE;
|
||||
|
||||
switch(CodePage)
|
||||
{
|
||||
case CP_UTF7:
|
||||
{
|
||||
static const WCHAR utf7[] = L"Unicode (UTF-7)\0";
|
||||
|
||||
lpCPInfoEx->CodePage = CP_UTF7;
|
||||
lpCPInfoEx->UnicodeDefaultChar = 0x3f;
|
||||
wcscpy(lpCPInfoEx->CodePageName, utf7);
|
||||
}
|
||||
break;
|
||||
|
||||
case CP_UTF8:
|
||||
{
|
||||
static const WCHAR utf8[] = L"Unicode (UTF-8)\0";
|
||||
|
||||
lpCPInfoEx->CodePage = CP_UTF8;
|
||||
lpCPInfoEx->UnicodeDefaultChar = 0x3f;
|
||||
wcscpy(lpCPInfoEx->CodePageName, utf8);
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
PCODEPAGE_ENTRY CodePageEntry;
|
||||
|
||||
CodePageEntry = IntGetCodePageEntry(CodePage);
|
||||
if (CodePageEntry == NULL)
|
||||
{
|
||||
DPRINT1("Could not get CodePage Entry! CodePageEntry = 0\n");
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lpCPInfoEx->CodePage = CodePageEntry->CodePageTable.CodePage;
|
||||
lpCPInfoEx->UnicodeDefaultChar = CodePageEntry->CodePageTable.UniDefaultChar;
|
||||
/* FIXME: We need to get a codepage name */
|
||||
DPRINT1("FIXME: We need to get a codepage name!\n");
|
||||
wcscpy(lpCPInfoEx->CodePageName, L"Unknown\0");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
STDCALL
|
||||
GetCPInfoExA(
|
||||
UINT CodePage,
|
||||
DWORD dwFlags,
|
||||
LPCPINFOEXA lpCPInfoEx)
|
||||
GetCPInfoExA(UINT CodePage,
|
||||
DWORD dwFlags,
|
||||
LPCPINFOEXA lpCPInfoEx)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
CPINFOEXW CPInfo;
|
||||
|
||||
if (!GetCPInfoExW(CodePage, dwFlags, &CPInfo))
|
||||
return FALSE;
|
||||
|
||||
/* the layout is the same except for CodePageName */
|
||||
memcpy(lpCPInfoEx, &CPInfo, sizeof(CPINFOEXA));
|
||||
|
||||
WideCharToMultiByte(CP_ACP,
|
||||
0,
|
||||
CPInfo.CodePageName,
|
||||
-1,
|
||||
lpCPInfoEx->CodePageName,
|
||||
sizeof(lpCPInfoEx->CodePageName),
|
||||
NULL,
|
||||
NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
@@ -20,15 +20,6 @@
|
||||
|
||||
/* GLOBAL VARIABLES ***********************************************************/
|
||||
|
||||
typedef struct _CODEPAGE_ENTRY
|
||||
{
|
||||
LIST_ENTRY Entry;
|
||||
UINT CodePage;
|
||||
HANDLE SectionHandle;
|
||||
PBYTE SectionMapping;
|
||||
CPTABLEINFO CodePageTable;
|
||||
} CODEPAGE_ENTRY, *PCODEPAGE_ENTRY;
|
||||
|
||||
/* Sequence length based on the first character. */
|
||||
static const char UTF8Length[128] =
|
||||
{
|
||||
@@ -185,7 +176,7 @@ IntGetLoadedCodePageEntry(UINT CodePage)
|
||||
* @return Code page entry.
|
||||
*/
|
||||
|
||||
static PCODEPAGE_ENTRY FASTCALL
|
||||
PCODEPAGE_ENTRY FASTCALL
|
||||
IntGetCodePageEntry(UINT CodePage)
|
||||
{
|
||||
CHAR SectionName[40];
|
||||
|
||||
Reference in New Issue
Block a user