From 5be1171389d4b89cb252288601f6ba0ebd8acfbf Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 22 Feb 2014 09:36:42 +0000 Subject: [PATCH 001/113] [NTOSKRNL] CORE-7932 #comment Silence UNIMPLEMENTED warning for SepAdtPrivilegedServiceAuditAlarm, since this function is called relatively often, spamming the debuglog, and it's missing implementation does not directly affect the behavior for applications. svn path=/trunk/; revision=62284 --- reactos/ntoskrnl/se/audit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/se/audit.c b/reactos/ntoskrnl/se/audit.c index f3d826e39f3..5f8177e3395 100644 --- a/reactos/ntoskrnl/se/audit.c +++ b/reactos/ntoskrnl/se/audit.c @@ -206,7 +206,7 @@ SepAdtPrivilegedServiceAuditAlarm( _In_ PPRIVILEGE_SET Privileges, _In_ BOOLEAN AccessGranted) { - UNIMPLEMENTED; + DPRINT("SepAdtPrivilegedServiceAuditAlarm is unimplemented\n"); } VOID From 27787c591812596feaeb1633fe4bdf2db5c7f285 Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Sat, 22 Feb 2014 09:53:25 +0000 Subject: [PATCH 002/113] [KS] - Call Property handler guarded in seh block - Needs to be done in portcls too - svn path=/trunk/; revision=62285 --- reactos/drivers/ksfilter/ks/property.c | 28 +++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/reactos/drivers/ksfilter/ks/property.c b/reactos/drivers/ksfilter/ks/property.c index 960b4997406..7d6a29b704c 100644 --- a/reactos/drivers/ksfilter/ks/property.c +++ b/reactos/drivers/ksfilter/ks/property.c @@ -8,6 +8,9 @@ #include "precomp.h" +/* SEH support with PSEH */ +#include + #define NDEBUG #include @@ -280,8 +283,16 @@ KspPropertyHandler( KSPROPERTY_ITEM_IRP_STORAGE(Irp) = PropertyItem; } - /* call property handler */ - Status = PropertyHandler(Irp, Property, (OutputBufferLength > 0 ? Irp->AssociatedIrp.SystemBuffer : NULL)); + _SEH2_TRY + { + /* call property handler */ + Status = PropertyHandler(Irp, Property, (OutputBufferLength > 0 ? Irp->AssociatedIrp.SystemBuffer : NULL)); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + _SEH2_YIELD(return _SEH2_GetExceptionCode()); + } + _SEH2_END; if (Status == STATUS_BUFFER_TOO_SMALL) { @@ -297,9 +308,16 @@ KspPropertyHandler( /* no memory */ return STATUS_INSUFFICIENT_RESOURCES; } - - /* re-call property handler */ - Status = PropertyHandler(Irp, Property, Irp->AssociatedIrp.SystemBuffer); + _SEH2_TRY + { + /* re-call property handler */ + Status = PropertyHandler(Irp, Property, Irp->AssociatedIrp.SystemBuffer); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; } } } From cefedcb6955f1b01e1a3ea271da2df6328b402b7 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 22 Feb 2014 13:55:29 +0000 Subject: [PATCH 003/113] [NETAPI32] NetGetJoinInformation: Fix netapi32 wksta winetest crash. svn path=/trunk/; revision=62288 --- reactos/dll/win32/netapi32/wksta.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/reactos/dll/win32/netapi32/wksta.c b/reactos/dll/win32/netapi32/wksta.c index 3512d31c06c..4cef46cd02e 100644 --- a/reactos/dll/win32/netapi32/wksta.c +++ b/reactos/dll/win32/netapi32/wksta.c @@ -570,6 +570,9 @@ NET_API_STATUS NET_API_FUNCTION NetGetJoinInformation( { FIXME("Stub %s %p %p\n", wine_dbgstr_w(Server), Name, type); + if (Name == NULL || type == NULL) + return ERROR_INVALID_PARAMETER; + *Name = NULL; *type = NetSetupUnknownStatus; From 9347a16a57ef12c2685f345b67e53169f5b94aca Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 22 Feb 2014 13:58:33 +0000 Subject: [PATCH 004/113] [SYSSETUP] Add date/time to setuplog.txt. Patch by Lee Schroeder. Thanks a lot! CORE-7927 #resolve svn path=/trunk/; revision=62289 --- reactos/dll/win32/syssetup/logfile.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/reactos/dll/win32/syssetup/logfile.c b/reactos/dll/win32/syssetup/logfile.c index ea0db8e547d..5a941d03865 100644 --- a/reactos/dll/win32/syssetup/logfile.c +++ b/reactos/dll/win32/syssetup/logfile.c @@ -97,6 +97,8 @@ SYSSETUP_LogItem(IN const LPSTR lpFileName, DWORD dwMessageSize; DWORD dwWritten; CHAR Buffer[6]; + CHAR TimeBuffer[30]; + SYSTEMTIME stTime; /* Get the severity code string */ switch (dwSeverity) @@ -148,6 +150,28 @@ SYSSETUP_LogItem(IN const LPSTR lpFileName, NULL, FILE_END); + /* Write Time/Date */ + GetLocalTime(&stTime); + + snprintf(TimeBuffer, sizeof(TimeBuffer), + "%02d/%02d/%02d %02d:%02d:%02d.%03d", + stTime.wMonth, + stTime.wDay, + stTime.wYear, + stTime.wHour, + stTime.wMinute, + stTime.wSecond, + stTime.wMilliseconds); + + WriteFile(hLogFile, + TimeBuffer, + strlen(TimeBuffer), + &dwWritten, + NULL); + + /* Write comma */ + WriteFile(hLogFile, ",", 1, &dwWritten, NULL); + /* Write file name */ WriteFile(hLogFile, lpFileName, From 11e1167b0cad0fb4911f4e3b03da8b792862eb6c Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 23 Feb 2014 09:32:44 +0000 Subject: [PATCH 005/113] [MSGINA] Shutdown dialog: Display the current users name in the "log off" list entry. svn path=/trunk/; revision=62297 --- reactos/dll/win32/msgina/gui.c | 4 +++- reactos/dll/win32/msgina/lang/bg-BG.rc | 4 ++-- reactos/dll/win32/msgina/lang/cs-CZ.rc | 4 ++-- reactos/dll/win32/msgina/lang/de-DE.rc | 4 ++-- reactos/dll/win32/msgina/lang/en-US.rc | 5 ++--- reactos/dll/win32/msgina/lang/es-ES.rc | 4 ++-- reactos/dll/win32/msgina/lang/fr-FR.rc | 4 ++-- reactos/dll/win32/msgina/lang/he-IL.rc | 4 ++-- reactos/dll/win32/msgina/lang/id-ID.rc | 4 ++-- reactos/dll/win32/msgina/lang/it-IT.rc | 4 ++-- reactos/dll/win32/msgina/lang/ja-JP.rc | 4 ++-- reactos/dll/win32/msgina/lang/no-NO.rc | 4 ++-- reactos/dll/win32/msgina/lang/pl-PL.rc | 4 ++-- reactos/dll/win32/msgina/lang/ro-RO.rc | 4 ++-- reactos/dll/win32/msgina/lang/ru-RU.rc | 4 ++-- reactos/dll/win32/msgina/lang/sk-SK.rc | 4 ++-- reactos/dll/win32/msgina/lang/sq-AL.rc | 4 ++-- reactos/dll/win32/msgina/lang/tr-TR.rc | 4 ++-- reactos/dll/win32/msgina/lang/uk-UA.rc | 4 ++-- 19 files changed, 39 insertions(+), 38 deletions(-) diff --git a/reactos/dll/win32/msgina/gui.c b/reactos/dll/win32/msgina/gui.c index b14de46b5bc..4b509e6b8ba 100644 --- a/reactos/dll/win32/msgina/gui.c +++ b/reactos/dll/win32/msgina/gui.c @@ -641,6 +641,7 @@ ShutDownOnInit( IN PGINA_CONTEXT pgContext) { WCHAR szBuffer[256]; + WCHAR szBuffer2[256]; HWND hwndList; INT idx, count, i; @@ -651,7 +652,8 @@ ShutDownOnInit( /* Log off */ LoadStringW(hDllInstance, IDS_SHUTDOWN_LOGOFF, szBuffer, sizeof(szBuffer) / sizeof(WCHAR)); - idx = SendMessageW(hwndList, CB_ADDSTRING, 0, (LPARAM)szBuffer); + wsprintfW(szBuffer2, szBuffer, pgContext->UserName); + idx = SendMessageW(hwndList, CB_ADDSTRING, 0, (LPARAM)szBuffer2); if (idx != CB_ERR) SendMessageW(hwndList, CB_SETITEMDATA, idx, WLX_SAS_ACTION_LOGOFF); diff --git a/reactos/dll/win32/msgina/lang/bg-BG.rc b/reactos/dll/win32/msgina/lang/bg-BG.rc index e6933af4b1a..d06701b5941 100644 --- a/reactos/dll/win32/msgina/lang/bg-BG.rc +++ b/reactos/dll/win32/msgina/lang/bg-BG.rc @@ -150,14 +150,14 @@ END /* Shutdown Dialog Strings */ STRINGTABLE BEGIN + IDS_SHUTDOWN_LOGOFF "Log off ""%s""" IDS_SHUTDOWN_SHUTDOWN "Shut down" - IDS_SHUTDOWN_LOGOFF "Log off" IDS_SHUTDOWN_RESTART "Restart" IDS_SHUTDOWN_SLEEP "Sleep" IDS_SHUTDOWN_HIBERNATE "Hibernate" /* Shut down descriptions */ - IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_LOGOFF_DESC "Ends your current session and allows other users to log on to the system." + IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_RESTART_DESC "Ends your current session and reboots the system." IDS_SHUTDOWN_SLEEP_DESC "Puts the system in sleep mode." IDS_SHUTDOWN_HIBERNATE_DESC "Saves the current session and shuts down the computer." diff --git a/reactos/dll/win32/msgina/lang/cs-CZ.rc b/reactos/dll/win32/msgina/lang/cs-CZ.rc index a84bfbe3f82..00ebf875e69 100644 --- a/reactos/dll/win32/msgina/lang/cs-CZ.rc +++ b/reactos/dll/win32/msgina/lang/cs-CZ.rc @@ -155,14 +155,14 @@ END /* Shutdown Dialog Strings */ STRINGTABLE BEGIN + IDS_SHUTDOWN_LOGOFF "Log off ""%s""" IDS_SHUTDOWN_SHUTDOWN "Shut down" - IDS_SHUTDOWN_LOGOFF "Log off" IDS_SHUTDOWN_RESTART "Restart" IDS_SHUTDOWN_SLEEP "Sleep" IDS_SHUTDOWN_HIBERNATE "Hibernate" /* Shut down descriptions */ - IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_LOGOFF_DESC "Ends your current session and allows other users to log on to the system." + IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_RESTART_DESC "Ends your current session and reboots the system." IDS_SHUTDOWN_SLEEP_DESC "Puts the system in sleep mode." IDS_SHUTDOWN_HIBERNATE_DESC "Saves the current session and shuts down the computer." diff --git a/reactos/dll/win32/msgina/lang/de-DE.rc b/reactos/dll/win32/msgina/lang/de-DE.rc index a2e465925e9..79710d88509 100644 --- a/reactos/dll/win32/msgina/lang/de-DE.rc +++ b/reactos/dll/win32/msgina/lang/de-DE.rc @@ -150,14 +150,14 @@ END /* Shutdown Dialog Strings */ STRINGTABLE BEGIN + IDS_SHUTDOWN_LOGOFF "Log off ""%s""" IDS_SHUTDOWN_SHUTDOWN "Shut down" - IDS_SHUTDOWN_LOGOFF "Log off" IDS_SHUTDOWN_RESTART "Restart" IDS_SHUTDOWN_SLEEP "Sleep" IDS_SHUTDOWN_HIBERNATE "Hibernate" /* Shut down descriptions */ - IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_LOGOFF_DESC "Ends your current session and allows other users to log on to the system." + IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_RESTART_DESC "Ends your current session and reboots the system." IDS_SHUTDOWN_SLEEP_DESC "Puts the system in sleep mode." IDS_SHUTDOWN_HIBERNATE_DESC "Saves the current session and shuts down the computer." diff --git a/reactos/dll/win32/msgina/lang/en-US.rc b/reactos/dll/win32/msgina/lang/en-US.rc index 5f424785f7b..e442a6a9e49 100644 --- a/reactos/dll/win32/msgina/lang/en-US.rc +++ b/reactos/dll/win32/msgina/lang/en-US.rc @@ -150,15 +150,14 @@ END /* Shutdown Dialog Strings */ STRINGTABLE BEGIN + IDS_SHUTDOWN_LOGOFF "Log off ""%s""" IDS_SHUTDOWN_SHUTDOWN "Shut down" - IDS_SHUTDOWN_LOGOFF "Log off" IDS_SHUTDOWN_RESTART "Restart" IDS_SHUTDOWN_SLEEP "Sleep" IDS_SHUTDOWN_HIBERNATE "Hibernate" /* Shut down descriptions */ - - IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_LOGOFF_DESC "Ends your current session and allows other users to log on to the system." + IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_RESTART_DESC "Ends your current session and reboots the system." IDS_SHUTDOWN_SLEEP_DESC "Puts the system in sleep mode." IDS_SHUTDOWN_HIBERNATE_DESC "Saves the current session and shuts down the computer." diff --git a/reactos/dll/win32/msgina/lang/es-ES.rc b/reactos/dll/win32/msgina/lang/es-ES.rc index badf1b51aef..fff68d7c5c8 100644 --- a/reactos/dll/win32/msgina/lang/es-ES.rc +++ b/reactos/dll/win32/msgina/lang/es-ES.rc @@ -152,14 +152,14 @@ END /* Shutdown Dialog Strings */ STRINGTABLE BEGIN + IDS_SHUTDOWN_LOGOFF "Log off ""%s""" IDS_SHUTDOWN_SHUTDOWN "Shut down" - IDS_SHUTDOWN_LOGOFF "Log off" IDS_SHUTDOWN_RESTART "Restart" IDS_SHUTDOWN_SLEEP "Sleep" IDS_SHUTDOWN_HIBERNATE "Hibernate" /* Shut down descriptions */ - IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_LOGOFF_DESC "Ends your current session and allows other users to log on to the system." + IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_RESTART_DESC "Ends your current session and reboots the system." IDS_SHUTDOWN_SLEEP_DESC "Puts the system in sleep mode." IDS_SHUTDOWN_HIBERNATE_DESC "Saves the current session and shuts down the computer." diff --git a/reactos/dll/win32/msgina/lang/fr-FR.rc b/reactos/dll/win32/msgina/lang/fr-FR.rc index 5bf4e503e3d..ebe178564e3 100644 --- a/reactos/dll/win32/msgina/lang/fr-FR.rc +++ b/reactos/dll/win32/msgina/lang/fr-FR.rc @@ -150,14 +150,14 @@ END /* Shutdown Dialog Strings */ STRINGTABLE BEGIN + IDS_SHUTDOWN_LOGOFF "Log off ""%s""" IDS_SHUTDOWN_SHUTDOWN "Shut down" - IDS_SHUTDOWN_LOGOFF "Log off" IDS_SHUTDOWN_RESTART "Restart" IDS_SHUTDOWN_SLEEP "Sleep" IDS_SHUTDOWN_HIBERNATE "Hibernate" /* Shut down descriptions */ - IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_LOGOFF_DESC "Ends your current session and allows other users to log on to the system." + IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_RESTART_DESC "Ends your current session and reboots the system." IDS_SHUTDOWN_SLEEP_DESC "Puts the system in sleep mode." IDS_SHUTDOWN_HIBERNATE_DESC "Saves the current session and shuts down the computer." diff --git a/reactos/dll/win32/msgina/lang/he-IL.rc b/reactos/dll/win32/msgina/lang/he-IL.rc index 0796163a213..0a364801c19 100644 --- a/reactos/dll/win32/msgina/lang/he-IL.rc +++ b/reactos/dll/win32/msgina/lang/he-IL.rc @@ -150,14 +150,14 @@ END /* Shutdown Dialog Strings */ STRINGTABLE BEGIN + IDS_SHUTDOWN_LOGOFF "Log off ""%s""" IDS_SHUTDOWN_SHUTDOWN "Shut down" - IDS_SHUTDOWN_LOGOFF "Log off" IDS_SHUTDOWN_RESTART "Restart" IDS_SHUTDOWN_SLEEP "Sleep" IDS_SHUTDOWN_HIBERNATE "Hibernate" /* Shut down descriptions */ - IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_LOGOFF_DESC "Ends your current session and allows other users to log on to the system." + IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_RESTART_DESC "Ends your current session and reboots the system." IDS_SHUTDOWN_SLEEP_DESC "Puts the system in sleep mode." IDS_SHUTDOWN_HIBERNATE_DESC "Saves the current session and shuts down the computer." diff --git a/reactos/dll/win32/msgina/lang/id-ID.rc b/reactos/dll/win32/msgina/lang/id-ID.rc index c58f86367cd..a8c593ba557 100644 --- a/reactos/dll/win32/msgina/lang/id-ID.rc +++ b/reactos/dll/win32/msgina/lang/id-ID.rc @@ -149,14 +149,14 @@ END /* Shutdown Dialog Strings */ STRINGTABLE BEGIN + IDS_SHUTDOWN_LOGOFF "Log off ""%s""" IDS_SHUTDOWN_SHUTDOWN "Shut down" - IDS_SHUTDOWN_LOGOFF "Log off" IDS_SHUTDOWN_RESTART "Restart" IDS_SHUTDOWN_SLEEP "Sleep" IDS_SHUTDOWN_HIBERNATE "Hibernate" /* Shut down descriptions */ - IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_LOGOFF_DESC "Ends your current session and allows other users to log on to the system." + IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_RESTART_DESC "Ends your current session and reboots the system." IDS_SHUTDOWN_SLEEP_DESC "Puts the system in sleep mode." IDS_SHUTDOWN_HIBERNATE_DESC "Saves the current session and shuts down the computer." diff --git a/reactos/dll/win32/msgina/lang/it-IT.rc b/reactos/dll/win32/msgina/lang/it-IT.rc index f4a7571652d..7ab86e7f6f9 100644 --- a/reactos/dll/win32/msgina/lang/it-IT.rc +++ b/reactos/dll/win32/msgina/lang/it-IT.rc @@ -158,14 +158,14 @@ END /* Shutdown Dialog Strings */ STRINGTABLE BEGIN + IDS_SHUTDOWN_LOGOFF "Log off ""%s""" IDS_SHUTDOWN_SHUTDOWN "Shut down" - IDS_SHUTDOWN_LOGOFF "Log off" IDS_SHUTDOWN_RESTART "Restart" IDS_SHUTDOWN_SLEEP "Sleep" IDS_SHUTDOWN_HIBERNATE "Hibernate" /* Shut down descriptions */ - IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_LOGOFF_DESC "Ends your current session and allows other users to log on to the system." + IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_RESTART_DESC "Ends your current session and reboots the system." IDS_SHUTDOWN_SLEEP_DESC "Puts the system in sleep mode." IDS_SHUTDOWN_HIBERNATE_DESC "Saves the current session and shuts down the computer." diff --git a/reactos/dll/win32/msgina/lang/ja-JP.rc b/reactos/dll/win32/msgina/lang/ja-JP.rc index f69607e45e3..a1731d0296c 100644 --- a/reactos/dll/win32/msgina/lang/ja-JP.rc +++ b/reactos/dll/win32/msgina/lang/ja-JP.rc @@ -150,14 +150,14 @@ END /* Shutdown Dialog Strings */ STRINGTABLE BEGIN + IDS_SHUTDOWN_LOGOFF "Log off ""%s""" IDS_SHUTDOWN_SHUTDOWN "Shut down" - IDS_SHUTDOWN_LOGOFF "Log off" IDS_SHUTDOWN_RESTART "Restart" IDS_SHUTDOWN_SLEEP "Sleep" IDS_SHUTDOWN_HIBERNATE "Hibernate" /* Shut down descriptions */ - IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_LOGOFF_DESC "Ends your current session and allows other users to log on to the system." + IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_RESTART_DESC "Ends your current session and reboots the system." IDS_SHUTDOWN_SLEEP_DESC "Puts the system in sleep mode." IDS_SHUTDOWN_HIBERNATE_DESC "Saves the current session and shuts down the computer." diff --git a/reactos/dll/win32/msgina/lang/no-NO.rc b/reactos/dll/win32/msgina/lang/no-NO.rc index 0be753a7239..41b0af8ee2d 100644 --- a/reactos/dll/win32/msgina/lang/no-NO.rc +++ b/reactos/dll/win32/msgina/lang/no-NO.rc @@ -150,14 +150,14 @@ END /* Shutdown Dialog Strings */ STRINGTABLE BEGIN + IDS_SHUTDOWN_LOGOFF "Log off ""%s""" IDS_SHUTDOWN_SHUTDOWN "Shut down" - IDS_SHUTDOWN_LOGOFF "Log off" IDS_SHUTDOWN_RESTART "Restart" IDS_SHUTDOWN_SLEEP "Sleep" IDS_SHUTDOWN_HIBERNATE "Hibernate" /* Shut down descriptions */ - IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_LOGOFF_DESC "Ends your current session and allows other users to log on to the system." + IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_RESTART_DESC "Ends your current session and reboots the system." IDS_SHUTDOWN_SLEEP_DESC "Puts the system in sleep mode." IDS_SHUTDOWN_HIBERNATE_DESC "Saves the current session and shuts down the computer." diff --git a/reactos/dll/win32/msgina/lang/pl-PL.rc b/reactos/dll/win32/msgina/lang/pl-PL.rc index efe84fe1db6..aad32ffc51f 100644 --- a/reactos/dll/win32/msgina/lang/pl-PL.rc +++ b/reactos/dll/win32/msgina/lang/pl-PL.rc @@ -159,14 +159,14 @@ END /* Shutdown Dialog Strings */ STRINGTABLE BEGIN + IDS_SHUTDOWN_LOGOFF "Log off ""%s""" IDS_SHUTDOWN_SHUTDOWN "Shut down" - IDS_SHUTDOWN_LOGOFF "Log off" IDS_SHUTDOWN_RESTART "Restart" IDS_SHUTDOWN_SLEEP "Sleep" IDS_SHUTDOWN_HIBERNATE "Hibernate" /* Shut down descriptions */ - IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_LOGOFF_DESC "Ends your current session and allows other users to log on to the system." + IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_RESTART_DESC "Ends your current session and reboots the system." IDS_SHUTDOWN_SLEEP_DESC "Puts the system in sleep mode." IDS_SHUTDOWN_HIBERNATE_DESC "Saves the current session and shuts down the computer." diff --git a/reactos/dll/win32/msgina/lang/ro-RO.rc b/reactos/dll/win32/msgina/lang/ro-RO.rc index 59db80699c1..f63e48c638a 100644 --- a/reactos/dll/win32/msgina/lang/ro-RO.rc +++ b/reactos/dll/win32/msgina/lang/ro-RO.rc @@ -152,14 +152,14 @@ END /* Shutdown Dialog Strings */ STRINGTABLE BEGIN + IDS_SHUTDOWN_LOGOFF "Log off ""%s""" IDS_SHUTDOWN_SHUTDOWN "Shut down" - IDS_SHUTDOWN_LOGOFF "Log off" IDS_SHUTDOWN_RESTART "Restart" IDS_SHUTDOWN_SLEEP "Sleep" IDS_SHUTDOWN_HIBERNATE "Hibernate" /* Shut down descriptions */ - IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_LOGOFF_DESC "Ends your current session and allows other users to log on to the system." + IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_RESTART_DESC "Ends your current session and reboots the system." IDS_SHUTDOWN_SLEEP_DESC "Puts the system in sleep mode." IDS_SHUTDOWN_HIBERNATE_DESC "Saves the current session and shuts down the computer." diff --git a/reactos/dll/win32/msgina/lang/ru-RU.rc b/reactos/dll/win32/msgina/lang/ru-RU.rc index a884a19831b..0c69e47cfed 100644 --- a/reactos/dll/win32/msgina/lang/ru-RU.rc +++ b/reactos/dll/win32/msgina/lang/ru-RU.rc @@ -152,14 +152,14 @@ END /* Shutdown Dialog Strings */ STRINGTABLE BEGIN + IDS_SHUTDOWN_LOGOFF "Log off ""%s""" IDS_SHUTDOWN_SHUTDOWN "Shut down" - IDS_SHUTDOWN_LOGOFF "Log off" IDS_SHUTDOWN_RESTART "Restart" IDS_SHUTDOWN_SLEEP "Sleep" IDS_SHUTDOWN_HIBERNATE "Hibernate" /* Shut down descriptions */ - IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_LOGOFF_DESC "Ends your current session and allows other users to log on to the system." + IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_RESTART_DESC "Ends your current session and reboots the system." IDS_SHUTDOWN_SLEEP_DESC "Puts the system in sleep mode." IDS_SHUTDOWN_HIBERNATE_DESC "Saves the current session and shuts down the computer." diff --git a/reactos/dll/win32/msgina/lang/sk-SK.rc b/reactos/dll/win32/msgina/lang/sk-SK.rc index 20d16321a68..ead0f3a5d43 100644 --- a/reactos/dll/win32/msgina/lang/sk-SK.rc +++ b/reactos/dll/win32/msgina/lang/sk-SK.rc @@ -155,14 +155,14 @@ END /* Shutdown Dialog Strings */ STRINGTABLE BEGIN + IDS_SHUTDOWN_LOGOFF "Log off ""%s""" IDS_SHUTDOWN_SHUTDOWN "Shut down" - IDS_SHUTDOWN_LOGOFF "Log off" IDS_SHUTDOWN_RESTART "Restart" IDS_SHUTDOWN_SLEEP "Sleep" IDS_SHUTDOWN_HIBERNATE "Hibernate" /* Shut down descriptions */ - IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_LOGOFF_DESC "Ends your current session and allows other users to log on to the system." + IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_RESTART_DESC "Ends your current session and reboots the system." IDS_SHUTDOWN_SLEEP_DESC "Puts the system in sleep mode." IDS_SHUTDOWN_HIBERNATE_DESC "Saves the current session and shuts down the computer." diff --git a/reactos/dll/win32/msgina/lang/sq-AL.rc b/reactos/dll/win32/msgina/lang/sq-AL.rc index 00a631781ee..8c18c16d80f 100644 --- a/reactos/dll/win32/msgina/lang/sq-AL.rc +++ b/reactos/dll/win32/msgina/lang/sq-AL.rc @@ -150,14 +150,14 @@ END /* Shutdown Dialog Strings */ STRINGTABLE BEGIN + IDS_SHUTDOWN_LOGOFF "Log off ""%s""" IDS_SHUTDOWN_SHUTDOWN "Shut down" - IDS_SHUTDOWN_LOGOFF "Log off" IDS_SHUTDOWN_RESTART "Restart" IDS_SHUTDOWN_SLEEP "Sleep" IDS_SHUTDOWN_HIBERNATE "Hibernate" /* Shut down descriptions */ - IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_LOGOFF_DESC "Ends your current session and allows other users to log on to the system." + IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_RESTART_DESC "Ends your current session and reboots the system." IDS_SHUTDOWN_SLEEP_DESC "Puts the system in sleep mode." IDS_SHUTDOWN_HIBERNATE_DESC "Saves the current session and shuts down the computer." diff --git a/reactos/dll/win32/msgina/lang/tr-TR.rc b/reactos/dll/win32/msgina/lang/tr-TR.rc index 2ba7bb56427..9eebba74ed5 100644 --- a/reactos/dll/win32/msgina/lang/tr-TR.rc +++ b/reactos/dll/win32/msgina/lang/tr-TR.rc @@ -152,14 +152,14 @@ END /* Shutdown Dialog Strings */ STRINGTABLE BEGIN + IDS_SHUTDOWN_LOGOFF "Log off ""%s""" IDS_SHUTDOWN_SHUTDOWN "Shut down" - IDS_SHUTDOWN_LOGOFF "Log off" IDS_SHUTDOWN_RESTART "Restart" IDS_SHUTDOWN_SLEEP "Sleep" IDS_SHUTDOWN_HIBERNATE "Hibernate" /* Shut down descriptions */ - IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_LOGOFF_DESC "Ends your current session and allows other users to log on to the system." + IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_RESTART_DESC "Ends your current session and reboots the system." IDS_SHUTDOWN_SLEEP_DESC "Puts the system in sleep mode." IDS_SHUTDOWN_HIBERNATE_DESC "Saves the current session and shuts down the computer." diff --git a/reactos/dll/win32/msgina/lang/uk-UA.rc b/reactos/dll/win32/msgina/lang/uk-UA.rc index 79b08953a0c..34be98fe154 100644 --- a/reactos/dll/win32/msgina/lang/uk-UA.rc +++ b/reactos/dll/win32/msgina/lang/uk-UA.rc @@ -158,14 +158,14 @@ END /* Shutdown Dialog Strings */ STRINGTABLE BEGIN + IDS_SHUTDOWN_LOGOFF "Log off ""%s""" IDS_SHUTDOWN_SHUTDOWN "Shut down" - IDS_SHUTDOWN_LOGOFF "Log off" IDS_SHUTDOWN_RESTART "Restart" IDS_SHUTDOWN_SLEEP "Sleep" IDS_SHUTDOWN_HIBERNATE "Hibernate" /* Shut down descriptions */ - IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_LOGOFF_DESC "Ends your current session and allows other users to log on to the system." + IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." IDS_SHUTDOWN_RESTART_DESC "Ends your current session and reboots the system." IDS_SHUTDOWN_SLEEP_DESC "Puts the system in sleep mode." IDS_SHUTDOWN_HIBERNATE_DESC "Saves the current session and shuts down the computer." From c1e3e32d6dd4b547fb17b6a3e952071b78597937 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 23 Feb 2014 10:37:31 +0000 Subject: [PATCH 006/113] [CMAKE] * Use the appropriate CMake command to get the absolute path. I forgot to commit this change in the transition phase. CORE-7918 #resolve #comment Should be fixed in r62298. Thank you for testing the VS build. svn path=/trunk/; revision=62298 --- reactos/cmake/msvc.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/cmake/msvc.cmake b/reactos/cmake/msvc.cmake index ff82dfab108..99d10f7a18b 100644 --- a/reactos/cmake/msvc.cmake +++ b/reactos/cmake/msvc.cmake @@ -343,9 +343,9 @@ macro(add_asm_files _target) get_directory_property(_defines COMPILE_DEFINITIONS) foreach(_source_file ${ARGN}) get_filename_component(_source_file_base_name ${_source_file} NAME_WE) + get_filename_component(_source_file_full_path ${_source_file} ABSOLUTE) set(_preprocessed_asm_file ${CMAKE_CURRENT_BINARY_DIR}/asm/${_source_file_base_name}_${_target}.tmp) set(_object_file ${CMAKE_CURRENT_BINARY_DIR}/asm/${_source_file_base_name}_${_target}.obj) - set(_source_file_full_path ${CMAKE_CURRENT_SOURCE_DIR}/${_source_file}) get_source_file_property(_defines_semicolon_list ${_source_file_full_path} COMPILE_DEFINITIONS) unset(_source_file_defines) foreach(_define ${_defines_semicolon_list}) From 5d59eafa5737b1e486b30c1292cd12b8c90ec1dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 23 Feb 2014 11:41:56 +0000 Subject: [PATCH 007/113] [MSGINA]: Addendum for r62065 . I don't like freeing this 'msg' object in many places (in the caller and in the thread). svn path=/trunk/; revision=62299 --- reactos/dll/win32/msgina/gui.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/reactos/dll/win32/msgina/gui.c b/reactos/dll/win32/msgina/gui.c index 4b509e6b8ba..e9ad0a99276 100644 --- a/reactos/dll/win32/msgina/gui.c +++ b/reactos/dll/win32/msgina/gui.c @@ -145,11 +145,21 @@ GUIDisplayStatusMessage( &ThreadId); if (Thread) { + /* 'msg' will be freed by 'StartupWindowThread' */ + CloseHandle(Thread); WaitForSingleObject(msg->StartupEvent, INFINITE); CloseHandle(msg->StartupEvent); return TRUE; } + else + { + /* + * The 'StartupWindowThread' thread couldn't be created, + * so we need to free the allocated 'msg'. + */ + HeapFree(GetProcessHeap(), 0, msg); + } return FALSE; } From 5f2e7f0391fa990583d308f0deae4a04c4341974 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 23 Feb 2014 12:25:36 +0000 Subject: [PATCH 008/113] [CMAKE] * Add a workaround for the recent MSVC toolchain (MSBUILD) /MP bug. svn path=/trunk/; revision=62300 --- reactos/cmake/msvc.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/reactos/cmake/msvc.cmake b/reactos/cmake/msvc.cmake index 99d10f7a18b..7d213195eee 100644 --- a/reactos/cmake/msvc.cmake +++ b/reactos/cmake/msvc.cmake @@ -121,7 +121,14 @@ set(CMAKE_ASM_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY}) if(PCH) macro(add_pch _target _pch _sources) - set(_gch ${CMAKE_CURRENT_BINARY_DIR}/${_target}.pch) + + # Workaround for the MSVC toolchain (MSBUILD) /MP bug + set(_temp_gch ${CMAKE_CURRENT_BINARY_DIR}/${_target}.pch) + if(MSVC_IDE) + file(TO_NATIVE_PATH ${_temp_gch} _gch) + else() + set(_gch ${_temp_gch}) + endif() if(IS_CPP) set(_pch_language CXX) From 9b4d645ad080f8d6071581a947fcd14422fa238d Mon Sep 17 00:00:00 2001 From: James Tabor Date: Tue, 25 Feb 2014 03:39:23 +0000 Subject: [PATCH 009/113] [Ext2fs] - Fixed the driver start up for Ext2 partitions and drives. Now the driver loads. - At one time this driver worked on the same hardware I have today, same drives nothing has changed. Now since all the changes else where, guessing it broke something. - Don't assign and bug reports to me, if so, I will remove them! svn path=/trunk/; revision=62326 --- reactos/boot/bootdata/hivesys.inf | 10 +++++++++- reactos/drivers/filesystems/ext2/src/ext2init.c | 2 +- reactos/drivers/filesystems/ext2/src/fsctrl.c | 8 ++++++++ reactos/drivers/filesystems/fs_rec/ext2.c | 2 +- reactos/drivers/filesystems/fs_rec/fs_rec.c | 6 +++--- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/reactos/boot/bootdata/hivesys.inf b/reactos/boot/bootdata/hivesys.inf index 010a2ba52d7..b704b6bd28c 100644 --- a/reactos/boot/bootdata/hivesys.inf +++ b/reactos/boot/bootdata/hivesys.inf @@ -1561,6 +1561,14 @@ HKLM,"SYSTEM\CurrentControlSet\Services\usbccgp","ImagePath",0x00020000,"system3 HKLM,"SYSTEM\CurrentControlSet\Services\usbccgp","Start",0x00010001,0x00000000 HKLM,"SYSTEM\CurrentControlSet\Services\usbccgp","Type",0x00010001,0x00000001 +; MountMgr driver +;HKLM,"SYSTEM\CurrentControlSet\Services\MountMgr","ErrorControl",0x00010001,0x00000001 +;HKLM,"SYSTEM\CurrentControlSet\Services\MountMgr","Group",0x00000000,"Boot Bus Extender" +;HKLM,"SYSTEM\CurrentControlSet\Services\MountMgr","ImagePath",0x00020000,"system32\drivers\mountmgr.sys" +;HKLM,"SYSTEM\CurrentControlSet\Services\MountMgr","Start",0x00010001,0x00000000 +;HKLM,"SYSTEM\CurrentControlSet\Services\MountMgr","Tag",0x00010001,0x00000008 +;HKLM,"SYSTEM\CurrentControlSet\Services\MountMgr","Type",0x00010001,0x00000001 + ; ACPI driver HKLM,"SYSTEM\CurrentControlSet\Services\acpi","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\acpi","Group",0x00000000,"Boot Bus Extender" @@ -1859,7 +1867,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\RamDisk","Type",0x00010001,0x00000002 ; EXT2 Filesystem driver HKLM,"SYSTEM\CurrentControlSet\Services\Ext2fs","ErrorControl",0x00010001,0x00000000 HKLM,"SYSTEM\CurrentControlSet\Services\Ext2fs","Group",0x00000000,"Boot File System" -HKLM,"SYSTEM\CurrentControlSet\Services\Ext2fs","ImagePath",0x00020000,"system32\drivers\ext2.sys" +HKLM,"SYSTEM\CurrentControlSet\Services\Ext2fs","ImagePath",0x00020000,"system32\drivers\ext2fs.sys" HKLM,"SYSTEM\CurrentControlSet\Services\Ext2fs","Start",0x00010001,0x00000003 HKLM,"SYSTEM\CurrentControlSet\Services\Ext2fs","Type",0x00010001,0x00000002 diff --git a/reactos/drivers/filesystems/ext2/src/ext2init.c b/reactos/drivers/filesystems/ext2/src/ext2init.c index 68e84f1bcc9..4ad2540ead4 100644 --- a/reactos/drivers/filesystems/ext2/src/ext2init.c +++ b/reactos/drivers/filesystems/ext2/src/ext2init.c @@ -20,7 +20,7 @@ #define EXT2_BUG_CHECK_ID EXT2_FILE_INIT #define DEBUG_LEVEL (DEBUG_TRACE_INIT) -#define EXT2_FS_NAME L"\\ext2" +#define EXT2_FS_NAME L"\\Ext2fs" // Must match others! // global variables are declared here Ext2Data Ext2GlobalData; diff --git a/reactos/drivers/filesystems/ext2/src/fsctrl.c b/reactos/drivers/filesystems/ext2/src/fsctrl.c index 26837451394..4af6001fe81 100644 --- a/reactos/drivers/filesystems/ext2/src/fsctrl.c +++ b/reactos/drivers/filesystems/ext2/src/fsctrl.c @@ -535,6 +535,7 @@ Ext2MountVolume ( else { DebugTrace(DEBUG_TRACE_MOUNT, "Failing mount. Partition not Ext2...", 0); + DbgPrint("Supper Blk Magic %x\n",SuperBlock->s_magic); } try_exit: NOTHING; @@ -782,7 +783,13 @@ BOOLEAN Ext2PerformVerifyDiskRead( if (Status == STATUS_INVALID_PARAMETER) { + DbgPrint("Ext2PerformVerifyDiskRead Invalid Param\n"); + return FALSE; + } + if (Status == STATUS_NO_MEDIA_IN_DEVICE) + { + DbgPrint("Ext2PerformVerifyDiskRead NO MEDIA in DEVICE!!! BS!!\n"); return FALSE; } @@ -792,6 +799,7 @@ BOOLEAN Ext2PerformVerifyDiskRead( if (!NT_SUCCESS(Status)) { + DbgPrint("Ext2PerformVerifyDiskRead Fail Status %x\n",Status); return FALSE; } diff --git a/reactos/drivers/filesystems/fs_rec/ext2.c b/reactos/drivers/filesystems/fs_rec/ext2.c index d940253247c..fa06eb0dfe3 100644 --- a/reactos/drivers/filesystems/fs_rec/ext2.c +++ b/reactos/drivers/filesystems/fs_rec/ext2.c @@ -93,7 +93,7 @@ FsRecExt2FsControl(IN PDEVICE_OBJECT DeviceObject, /* Load the file system */ Status = FsRecLoadFileSystem(DeviceObject, - L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Ext2"); + L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Ext2fs"); break; default: diff --git a/reactos/drivers/filesystems/fs_rec/fs_rec.c b/reactos/drivers/filesystems/fs_rec/fs_rec.c index 00b0a67b103..17293013dfc 100644 --- a/reactos/drivers/filesystems/fs_rec/fs_rec.c +++ b/reactos/drivers/filesystems/fs_rec/fs_rec.c @@ -373,14 +373,14 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject, if (NT_SUCCESS(Status)) DeviceCount++; /* Register EXT2 */ - /*Status = FsRecRegisterFs(DriverObject, + Status = FsRecRegisterFs(DriverObject, NULL, NULL, - L"\\Ext2", + L"\\Ext2fs", L"\\FileSystem\\Ext2Recognizer", FS_TYPE_EXT2, FILE_DEVICE_DISK_FILE_SYSTEM); - if (NT_SUCCESS(Status)) DeviceCount++;*/ + if (NT_SUCCESS(Status)){ DeviceCount++; DPRINT1("2 Ext2FS!!!!!\n");} /* Return appropriate Status */ return (DeviceCount > 0) ? STATUS_SUCCESS : STATUS_IMAGE_ALREADY_LOADED; From 38758f72ac0b6a277a9c3f98826ae0b694d264ca Mon Sep 17 00:00:00 2001 From: James Tabor Date: Tue, 25 Feb 2014 05:29:00 +0000 Subject: [PATCH 010/113] [Win32ss] - MapWindowPoints return incorrect result for windows with WS_EX_LAYOUTRTL style. - Patch by Maxim Andreyanov. see CORE-7947. svn path=/trunk/; revision=62327 --- reactos/win32ss/user/ntuser/window.c | 11 +++++++++++ reactos/win32ss/user/ntuser/winpos.c | 2 -- reactos/win32ss/user/user32/windows/winpos.c | 2 -- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/reactos/win32ss/user/ntuser/window.c b/reactos/win32ss/user/ntuser/window.c index 91feae4df56..e0e57643c5a 100644 --- a/reactos/win32ss/user/ntuser/window.c +++ b/reactos/win32ss/user/ntuser/window.c @@ -2313,6 +2313,17 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs, ParentWindow->rcClient.top); } */ + /* correct child window coordinates if mirroring on parent is enabled */ + if (ParentWindow != NULL) + { + if ( ((Cs->style & WS_CHILD) == WS_CHILD) && + ((ParentWindow->ExStyle & WS_EX_LAYOUTRTL) == WS_EX_LAYOUTRTL)) + { + Window->rcWindow.right = ParentWindow->rcClient.right - (Window->rcWindow.left - ParentWindow->rcClient.left); + Window->rcWindow.left = Window->rcWindow.right - Size.cx; + } + } + Window->rcClient = Window->rcWindow; /* Link the window */ diff --git a/reactos/win32ss/user/ntuser/winpos.c b/reactos/win32ss/user/ntuser/winpos.c index ab2c722b92c..da0f7e8f985 100644 --- a/reactos/win32ss/user/ntuser/winpos.c +++ b/reactos/win32ss/user/ntuser/winpos.c @@ -120,8 +120,6 @@ IntMapWindowPoints(PWND FromWnd, PWND ToWnd, LPPOINT lpPoints, UINT cPoints) Delta.y -= ToWnd->rcClient.top; } - if (mirror_from) Delta.x = -Delta.x; - for (i = 0; i != cPoints; i++) { lpPoints[i].x += Delta.x; diff --git a/reactos/win32ss/user/user32/windows/winpos.c b/reactos/win32ss/user/user32/windows/winpos.c index 8917ea4718f..30b43f7199b 100644 --- a/reactos/win32ss/user/user32/windows/winpos.c +++ b/reactos/win32ss/user/user32/windows/winpos.c @@ -218,8 +218,6 @@ MapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT cPoints) Delta.y -= ToWnd->rcClient.top; } - if (mirror_from) Delta.x = -Delta.x; - for (i = 0; i != cPoints; i++) { lpPoints[i].x += Delta.x; From bcc1390a3611772beb8f57cdd258629989e7a351 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Wed, 26 Feb 2014 22:54:03 +0000 Subject: [PATCH 011/113] [User32Test] - Update listbox and msg test to wine 1.7.13. svn path=/trunk/; revision=62338 --- rostests/winetests/user32/listbox.c | 30 ++++++++++++++++ rostests/winetests/user32/msg.c | 56 +++++++++++++++-------------- 2 files changed, 59 insertions(+), 27 deletions(-) diff --git a/rostests/winetests/user32/listbox.c b/rostests/winetests/user32/listbox.c index fdc190d8e6d..8e3fbcd34a1 100644 --- a/rostests/winetests/user32/listbox.c +++ b/rostests/winetests/user32/listbox.c @@ -234,6 +234,8 @@ static void check_item_height(void) DestroyWindow (hLB); } +static int got_selchange; + static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { switch (msg) @@ -267,6 +269,10 @@ static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA break; } + case WM_COMMAND: + if (HIWORD( wparam ) == LBN_SELCHANGE) got_selchange++; + break; + default: break; } @@ -1588,6 +1594,29 @@ todo_wine DestroyWindow(parent); } +static void test_missing_lbuttonup( void ) +{ + HWND listbox, parent, capture; + + parent = create_parent(); + listbox = create_listbox(WS_CHILD | WS_VISIBLE, parent); + + /* Send button down without a corresponding button up */ + SendMessageA(listbox, WM_LBUTTONDOWN, 0, MAKELPARAM(10,10)); + capture = GetCapture(); + ok(capture == listbox, "got %p expected %p\n", capture, listbox); + + /* Capture is released and LBN_SELCHANGE sent during WM_KILLFOCUS */ + got_selchange = 0; + SetFocus(NULL); + capture = GetCapture(); + ok(capture == NULL, "got %p\n", capture); + ok(got_selchange, "got %d\n", got_selchange); + + DestroyWindow(listbox); + DestroyWindow(parent); +} + START_TEST(listbox) { const struct listbox_test SS = @@ -1668,4 +1697,5 @@ START_TEST(listbox) test_listbox_dlgdir(); test_set_count(); test_GetListBoxInfo(); + test_missing_lbuttonup(); } diff --git a/rostests/winetests/user32/msg.c b/rostests/winetests/user32/msg.c index 530df4d9df6..a0c610b8c3f 100755 --- a/rostests/winetests/user32/msg.c +++ b/rostests/winetests/user32/msg.c @@ -1719,11 +1719,11 @@ static const struct message WmSHOWNATopInvisible[] = { { 0 } }; -static int after_end_dialog, test_def_id; +static BOOL after_end_dialog, test_def_id, paint_loop_done; static int sequence_cnt, sequence_size; static struct recvd_message* sequence; static int log_all_parent_messages; -static int paint_loop_done; +static CRITICAL_SECTION sequence_cs; /* user32 functions */ static HWND (WINAPI *pGetAncestor)(HWND,UINT); @@ -1814,7 +1814,8 @@ static void add_message_(int line, const struct recvd_message *msg) { struct recvd_message *seq; - if (!sequence) + EnterCriticalSection( &sequence_cs ); + if (!sequence) { sequence_size = 10; sequence = HeapAlloc( GetProcessHeap(), 0, sequence_size * sizeof(*sequence) ); @@ -1826,7 +1827,7 @@ static void add_message_(int line, const struct recvd_message *msg) } assert(sequence); - seq = &sequence[sequence_cnt]; + seq = &sequence[sequence_cnt++]; seq->hwnd = msg->hwnd; seq->message = msg->message; seq->flags = msg->flags; @@ -1835,6 +1836,7 @@ static void add_message_(int line, const struct recvd_message *msg) seq->line = line; seq->descr = msg->descr; seq->output[0] = 0; + LeaveCriticalSection( &sequence_cs ); if (msg->descr) { @@ -1919,8 +1921,6 @@ static void add_message_(int line, const struct recvd_message *msg) sprintf( seq->output + strlen(seq->output), " (flags %x)", msg->flags ); } } - - sequence_cnt++; } /* try to make sure pending X events have been processed before continuing */ @@ -1941,9 +1941,11 @@ static void flush_events(void) static void flush_sequence(void) { + EnterCriticalSection( &sequence_cs ); HeapFree(GetProcessHeap(), 0, sequence); sequence = 0; sequence_cnt = sequence_size = 0; + LeaveCriticalSection( &sequence_cs ); } static void dump_sequence(const struct message *expected, const char *context, const char *file, int line) @@ -2030,7 +2032,7 @@ static void dump_sequence(const struct message *expected, const char *context, c ok_sequence_( (exp), (contx), (todo), __FILE__, __LINE__) -static void ok_sequence_(const struct message *expected_list, const char *context, int todo, +static void ok_sequence_(const struct message *expected_list, const char *context, BOOL todo, const char *file, int line) { static const struct recvd_message end_of_sequence; @@ -4762,17 +4764,17 @@ static void test_messages(void) flush_sequence(); - test_def_id = 1; + test_def_id = TRUE; SendMessageA(hwnd, WM_NULL, 0, 0); flush_sequence(); - after_end_dialog = 1; + after_end_dialog = TRUE; EndDialog( hwnd, 0 ); ok_sequence(WmEndCustomDialogSeq, "EndCustomDialog", FALSE); DestroyWindow(hwnd); - after_end_dialog = 0; - test_def_id = 0; + after_end_dialog = FALSE; + test_def_id = FALSE; hwnd = CreateWindowExA(0, "TestDialogClass", NULL, WS_POPUP, 0, 0, 100, 100, 0, 0, GetModuleHandleA(0), NULL); @@ -7886,7 +7888,7 @@ static LRESULT WINAPI PaintLoopProcA(HWND hWnd, UINT msg, WPARAM wParam, LPARAM } else ok(broken(1), "infinite loop\n"); if ( i == 0) - paint_loop_done = 1; + paint_loop_done = TRUE; return DefWindowProcA(hWnd,msg,wParam,lParam); } } @@ -9040,22 +9042,22 @@ static void test_scrollwindowex(void) trace("start scroll\n"); ScrollWindowEx( hwnd, 10, 10, &rect, NULL, NULL, NULL, SW_ERASE|SW_INVALIDATE); - ok_sequence(WmEmptySeq, "ScrollWindowEx", 0); + ok_sequence(WmEmptySeq, "ScrollWindowEx", FALSE); trace("end scroll\n"); flush_sequence(); flush_events(); - ok_sequence(ScrollWindowPaint1, "ScrollWindowEx", 0); + ok_sequence(ScrollWindowPaint1, "ScrollWindowEx", FALSE); flush_events(); flush_sequence(); /* Now without the SW_ERASE flag */ trace("start scroll\n"); ScrollWindowEx( hwnd, 10, 10, &rect, NULL, NULL, NULL, SW_INVALIDATE); - ok_sequence(WmEmptySeq, "ScrollWindowEx", 0); + ok_sequence(WmEmptySeq, "ScrollWindowEx", FALSE); trace("end scroll\n"); flush_sequence(); flush_events(); - ok_sequence(ScrollWindowPaint2, "ScrollWindowEx", 0); + ok_sequence(ScrollWindowPaint2, "ScrollWindowEx", FALSE); flush_events(); flush_sequence(); @@ -9069,7 +9071,7 @@ static void test_scrollwindowex(void) trace("end scroll\n"); flush_sequence(); flush_events(); - ok_sequence(ScrollWindowPaint1, "ScrollWindowEx", 0); + ok_sequence(ScrollWindowPaint1, "ScrollWindowEx", FALSE); flush_events(); flush_sequence(); @@ -9079,7 +9081,7 @@ static void test_scrollwindowex(void) trace("end scroll\n"); flush_sequence(); flush_events(); - ok_sequence(ScrollWindowPaint1, "ScrollWindow", 0); + ok_sequence(ScrollWindowPaint1, "ScrollWindow", FALSE); ok(DestroyWindow(hchild), "failed to destroy window\n"); ok(DestroyWindow(hwnd), "failed to destroy window\n"); @@ -9212,7 +9214,7 @@ static void test_DestroyWindow(void) ret = DestroyWindow(parent); ok( ret, "DestroyWindow() error %d\n", GetLastError()); test_DestroyWindow_flag = FALSE; - ok_sequence(destroy_window_with_children, "destroy window with children", 0); + ok_sequence(destroy_window_with_children, "destroy window with children", FALSE); ok(!IsWindow(parent), "parent still exists\n"); ok(!IsWindow(child1), "child1 still exists\n"); @@ -10229,8 +10231,7 @@ static void wait_move_event(HWND hwnd, int x, int y) { MSG msg; DWORD time; - BOOL ret; - int go = 0; + BOOL ret, go = FALSE; time = GetTickCount(); while (GetTickCount() - time < 200 && !go) { @@ -12590,6 +12591,7 @@ static void test_menu_messages(void) SetMenu(hwnd, hmenu); SetForegroundWindow( hwnd ); + flush_events(); set_menu_style(hmenu, MNS_NOTIFYBYPOS); style = get_menu_style(hmenu); @@ -12708,7 +12710,7 @@ static void test_paintingloop(void) { HWND hwnd; - paint_loop_done = 0; + paint_loop_done = FALSE; hwnd = CreateWindowExA(0x0,"PaintLoopWindowClass", "PaintLoopWindowClass",WS_OVERLAPPEDWINDOW, 100, 100, 100, 100, 0, 0, 0, NULL ); @@ -12732,7 +12734,7 @@ static void test_defwinproc(void) { HWND hwnd; MSG msg; - int gotwmquit = FALSE; + BOOL gotwmquit = FALSE; hwnd = CreateWindowExA(0, "static", "test_defwndproc", WS_POPUP, 0,0,0,0,0,0,0, NULL); assert(hwnd); DefWindowProcA( hwnd, WM_ENDSESSION, 1, 0); @@ -12740,7 +12742,7 @@ static void test_defwinproc(void) if( msg.message == WM_QUIT) gotwmquit = TRUE; DispatchMessageA( &msg ); } - ok( gotwmquit == FALSE, "Unexpected WM_QUIT message!\n"); + ok(!gotwmquit, "Unexpected WM_QUIT message!\n"); DestroyWindow( hwnd); } @@ -14292,6 +14294,7 @@ START_TEST(msg) return; } + InitializeCriticalSection( &sequence_cs ); init_procs(); hModuleImm32 = LoadLibraryA("imm32.dll"); @@ -14327,7 +14330,6 @@ START_TEST(msg) test_winevents(); /* Fix message sequences before removing 4 lines below */ -#if 1 if (pUnhookWinEvent && hEvent_hook) { ret = pUnhookWinEvent(hEvent_hook); @@ -14335,7 +14337,6 @@ START_TEST(msg) pUnhookWinEvent = 0; } hEvent_hook = 0; -#endif test_SetFocus(); test_SetParent(); @@ -14358,7 +14359,7 @@ START_TEST(msg) test_paint_messages(); if(!winetest_interactive) skip("ReactOS ActivateActCtx seems to be broken.\n"); - else + else test_interthread_messages(); test_message_conversion(); test_accelerators(); @@ -14407,4 +14408,5 @@ START_TEST(msg) GetLastError() == 0xdeadbeef, /* Win9x */ "unexpected error %d\n", GetLastError()); } + DeleteCriticalSection( &sequence_cs ); } From f08e1261edff24dbc2db8a00d26b31ba14cbd1bc Mon Sep 17 00:00:00 2001 From: James Tabor Date: Wed, 26 Feb 2014 22:56:27 +0000 Subject: [PATCH 012/113] [User32|ListBox] - Patch by Huw Davies: If the listbox loses focus while holding capture, release it by essentially simulating a button up event. svn path=/trunk/; revision=62339 --- reactos/win32ss/user/user32/controls/listbox.c | 1 + 1 file changed, 1 insertion(+) diff --git a/reactos/win32ss/user/user32/controls/listbox.c b/reactos/win32ss/user/user32/controls/listbox.c index 09081e749dc..18e0fe99660 100644 --- a/reactos/win32ss/user/user32/controls/listbox.c +++ b/reactos/win32ss/user/user32/controls/listbox.c @@ -3052,6 +3052,7 @@ LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg, SEND_NOTIFICATION( descr, LBN_SETFOCUS ); return 0; case WM_KILLFOCUS: + LISTBOX_HandleLButtonUp( descr ); /* Release capture if we have it */ descr->in_focus = FALSE; descr->wheel_remain = 0; if ((descr->focus_item != -1) && descr->caret_on) From 4d92b88dea7bfc18fa647bf81169dc151859582d Mon Sep 17 00:00:00 2001 From: James Tabor Date: Thu, 27 Feb 2014 01:12:32 +0000 Subject: [PATCH 013/113] [Win32k] - Fix server side call for Get Combo and ListBox information so it does not loop through the message loop. svn path=/trunk/; revision=62340 --- reactos/win32ss/user/ntuser/window.c | 143 ++++++++++++++++++++++++++- 1 file changed, 141 insertions(+), 2 deletions(-) diff --git a/reactos/win32ss/user/ntuser/window.c b/reactos/win32ss/user/ntuser/window.c index e0e57643c5a..90382406243 100644 --- a/reactos/win32ss/user/ntuser/window.c +++ b/reactos/win32ss/user/ntuser/window.c @@ -3248,7 +3248,40 @@ CLEANUP: END_CLEANUP; } +//// +//// ReactOS work around! Keep it the sames as in Combo.c and Controls.h +//// +/* combo state struct */ +typedef struct +{ + HWND self; + HWND owner; + UINT dwStyle; + HWND hWndEdit; + HWND hWndLBox; + UINT wState; + HFONT hFont; + RECT textRect; + RECT buttonRect; + RECT droppedRect; + INT droppedIndex; + INT fixedOwnerDrawHeight; + INT droppedWidth; /* last two are not used unless set */ + INT editHeight; /* explicitly */ + LONG UIState; +} HEADCOMBO,*LPHEADCOMBO; +// Window Extra data container. +typedef struct _WND2CBOX +{ + WND; + LPHEADCOMBO pCBox; +} WND2CBOX, *PWND2CBOX; + +#define CBF_BUTTONDOWN 0x0002 +//// +//// +//// BOOL APIENTRY NtUserGetComboBoxInfo( @@ -3256,6 +3289,9 @@ NtUserGetComboBoxInfo( PCOMBOBOXINFO pcbi) { PWND Wnd; + PPROCESSINFO ppi; + BOOL NotSameppi = FALSE; + BOOL Ret = TRUE; DECLARE_RETURN(BOOL); TRACE("Enter NtUserGetComboBoxInfo\n"); @@ -3281,22 +3317,95 @@ NtUserGetComboBoxInfo( } _SEH2_END; + if (pcbi->cbSize < sizeof(COMBOBOXINFO)) + { + EngSetLastError(ERROR_INVALID_PARAMETER); + RETURN(FALSE); + } + // Pass the user pointer, it was already probed. - RETURN( (BOOL) co_IntSendMessage( Wnd->head.h, CB_GETCOMBOBOXINFO, 0, (LPARAM)pcbi)); + if ((Wnd->pcls->atomClassName != gpsi->atomSysClass[ICLS_COMBOBOX]) && Wnd->fnid != FNID_COMBOBOX) + { + RETURN( (BOOL) co_IntSendMessage( Wnd->head.h, CB_GETCOMBOBOXINFO, 0, (LPARAM)pcbi)); + } + + ppi = PsGetCurrentProcessWin32Process(); + NotSameppi = ppi != Wnd->head.pti->ppi; + if (NotSameppi) + { + KeAttachProcess(&Wnd->head.pti->ppi->peProcess->Pcb); + } + + _SEH2_TRY + { + LPHEADCOMBO lphc = ((PWND2CBOX)Wnd)->pCBox; + pcbi->rcItem = lphc->textRect; + pcbi->rcButton = lphc->buttonRect; + pcbi->stateButton = 0; + if (lphc->wState & CBF_BUTTONDOWN) + pcbi->stateButton |= STATE_SYSTEM_PRESSED; + if (RECTL_bIsEmptyRect(&lphc->buttonRect)) + pcbi->stateButton |= STATE_SYSTEM_INVISIBLE; + pcbi->hwndCombo = lphc->self; + pcbi->hwndItem = lphc->hWndEdit; + pcbi->hwndList = lphc->hWndLBox; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Ret = FALSE; + SetLastNtError(_SEH2_GetExceptionCode()); + } + _SEH2_END; + + RETURN( Ret); CLEANUP: + if (NotSameppi) KeDetachProcess(); TRACE("Leave NtUserGetComboBoxInfo, ret=%i\n",_ret_); UserLeave(); END_CLEANUP; } +//// +//// ReactOS work around! Keep it the sames as in Listbox.c +//// +/* Listbox structure */ +typedef struct +{ + HWND self; /* Our own window handle */ + HWND owner; /* Owner window to send notifications to */ + UINT style; /* Window style */ + INT width; /* Window width */ + INT height; /* Window height */ + VOID *items; /* Array of items */ + INT nb_items; /* Number of items */ + INT top_item; /* Top visible item */ + INT selected_item; /* Selected item */ + INT focus_item; /* Item that has the focus */ + INT anchor_item; /* Anchor item for extended selection */ + INT item_height; /* Default item height */ + INT page_size; /* Items per listbox page */ + INT column_width; /* Column width for multi-column listboxes */ +} LB_DESCR; +// Window Extra data container. +typedef struct _WND2LB +{ + WND; + LB_DESCR * pLBiv; +} WND2LB, *PWND2LB; +//// +//// +//// DWORD APIENTRY NtUserGetListBoxInfo( HWND hWnd) { PWND Wnd; + PPROCESSINFO ppi; + BOOL NotSameppi = FALSE; + DWORD Ret = 0; DECLARE_RETURN(DWORD); TRACE("Enter NtUserGetListBoxInfo\n"); @@ -3307,9 +3416,39 @@ NtUserGetListBoxInfo( RETURN( 0 ); } - RETURN( (DWORD) co_IntSendMessage( Wnd->head.h, LB_GETLISTBOXINFO, 0, 0 )); + if ((Wnd->pcls->atomClassName != gpsi->atomSysClass[ICLS_LISTBOX]) && Wnd->fnid != FNID_LISTBOX) + { + RETURN( (DWORD) co_IntSendMessage( Wnd->head.h, LB_GETLISTBOXINFO, 0, 0 )); + } + + // wine lisbox:test_GetListBoxInfo lb_getlistboxinfo = 0, should not send a message! + ppi = PsGetCurrentProcessWin32Process(); + NotSameppi = ppi != Wnd->head.pti->ppi; + if (NotSameppi) + { + KeAttachProcess(&Wnd->head.pti->ppi->peProcess->Pcb); + } + + _SEH2_TRY + { + LB_DESCR *descr = ((PWND2LB)Wnd)->pLBiv; + // See Controls ListBox.c:LB_GETLISTBOXINFO must match... + if (descr->style & LBS_MULTICOLUMN) //// ReactOS + Ret = descr->page_size * descr->column_width; + else + Ret = descr->page_size; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Ret = 0; + SetLastNtError(_SEH2_GetExceptionCode()); + } + _SEH2_END; + + RETURN( Ret); CLEANUP: + if (NotSameppi) KeDetachProcess(); TRACE("Leave NtUserGetListBoxInfo, ret=%lu\n", _ret_); UserLeave(); END_CLEANUP; From 5729a923fe373e2ac9974789756d8f8cbdb050de Mon Sep 17 00:00:00 2001 From: James Tabor Date: Thu, 27 Feb 2014 13:20:59 +0000 Subject: [PATCH 014/113] - Remove debug print. svn path=/trunk/; revision=62348 --- reactos/drivers/filesystems/ext2/src/fsctrl.c | 1 - 1 file changed, 1 deletion(-) diff --git a/reactos/drivers/filesystems/ext2/src/fsctrl.c b/reactos/drivers/filesystems/ext2/src/fsctrl.c index 4af6001fe81..642743ac3c4 100644 --- a/reactos/drivers/filesystems/ext2/src/fsctrl.c +++ b/reactos/drivers/filesystems/ext2/src/fsctrl.c @@ -535,7 +535,6 @@ Ext2MountVolume ( else { DebugTrace(DEBUG_TRACE_MOUNT, "Failing mount. Partition not Ext2...", 0); - DbgPrint("Supper Blk Magic %x\n",SuperBlock->s_magic); } try_exit: NOTHING; From 06a96d5805bef568f0dfe2a24e616b707df25e33 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Fri, 28 Feb 2014 16:18:41 +0000 Subject: [PATCH 015/113] [CMAKE] * Add support for marking an image as hotpatchable. [INCLUDES] * Introduce a way to allow us to mark pretty much any function in our codebase as DECLSPEC_HOTPATCH (not just in Wine modules). * Fix DECLSPEC_HOTPATCH define and enable this hot patching feature support. CORE-7959 svn path=/trunk/; revision=62354 --- reactos/cmake/CMakeMacros.cmake | 13 ++++++++++++- reactos/include/crt/_mingw.h | 9 +++++++++ reactos/include/reactos/wine/config.h | 6 ++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/reactos/cmake/CMakeMacros.cmake b/reactos/cmake/CMakeMacros.cmake index f6f4bcbfb2f..1229654bab5 100644 --- a/reactos/cmake/CMakeMacros.cmake +++ b/reactos/cmake/CMakeMacros.cmake @@ -417,7 +417,7 @@ function(add_importlibs _module) endfunction() function(set_module_type MODULE TYPE) - cmake_parse_arguments(__module "UNICODE" "IMAGEBASE" "ENTRYPOINT" ${ARGN}) + cmake_parse_arguments(__module "UNICODE;HOTPATCHABLE" "IMAGEBASE" "ENTRYPOINT" ${ARGN}) if(__module_UNPARSED_ARGUMENTS) message(STATUS "set_module_type : unparsed arguments ${__module_UNPARSED_ARGUMENTS}, module : ${MODULE}") @@ -457,6 +457,17 @@ function(set_module_type MODULE TYPE) add_target_compile_definitions(${MODULE} UNICODE _UNICODE) endif() + # Handle hotpatchable images. + # GCC has this as a function attribute so we're handling it using DECLSPEC_HOTPATCH + if(__module_HOTPATCHABLE AND MSVC) + set_property(TARGET ${_target} APPEND_STRING PROPERTY COMPILE_FLAGS " /hotpatch") + if(ARCH STREQUAL "i386") + set_property(TARGET ${_target} APPEND_STRING PROPERTY LINK_FLAGS " /FUNCTIONPADMIN:5") + elseif(ARCH STREQUAL "amd64") + set_property(TARGET ${_target} APPEND_STRING PROPERTY LINK_FLAGS " /FUNCTIONPADMIN:6") + endif() + endif() + # set entry point if(__module_ENTRYPOINT OR (__module_ENTRYPOINT STREQUAL "0")) list(GET __module_ENTRYPOINT 0 __entrypoint) diff --git a/reactos/include/crt/_mingw.h b/reactos/include/crt/_mingw.h index f63e7dac32e..40b8b11ed39 100644 --- a/reactos/include/crt/_mingw.h +++ b/reactos/include/crt/_mingw.h @@ -215,6 +215,15 @@ allow GCC to optimize away some EH unwind code, at least in DW2 case. */ #define _DECLSPEC_INTRIN_TYPE #endif +/* Define to a function attribute for Microsoft hotpatch assembly prefix. */ +#ifndef DECLSPEC_HOTPATCH +#ifdef _MSC_VER +#define DECLSPEC_HOTPATCH +#else +#define DECLSPEC_HOTPATCH __attribute__((__ms_hook_prologue__)) +#endif +#endif /* DECLSPEC_HOTPATCH */ + #include "_mingw_mac.h" #endif /* !_INC_MINGW */ diff --git a/reactos/include/reactos/wine/config.h b/reactos/include/reactos/wine/config.h index 6f1d8d632cb..36bb5c2a0a1 100644 --- a/reactos/include/reactos/wine/config.h +++ b/reactos/include/reactos/wine/config.h @@ -1,7 +1,13 @@ #define __WINE_CONFIG_H /* Define to a function attribute for Microsoft hotpatch assembly prefix. */ +#ifndef DECLSPEC_HOTPATCH +#ifdef _MSC_VER #define DECLSPEC_HOTPATCH +#else +#define DECLSPEC_HOTPATCH __attribute__((__ms_hook_prologue__)) +#endif +#endif /* DECLSPEC_HOTPATCH */ /* Define to the file extension for executables. */ #define EXEEXT ".exe" From 09dfcb57208d4321181e3dcd4751f0fb2a268a3e Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Fri, 28 Feb 2014 16:21:10 +0000 Subject: [PATCH 016/113] [USER32] * Mark as hotpatchable. * Uncomment out the hot patching attribute for ShowCursor() now that the feature is supported. * More will come. CORE-7959 svn path=/trunk/; revision=62355 --- reactos/win32ss/user/user32/CMakeLists.txt | 2 +- reactos/win32ss/user/user32/windows/cursoricon.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/win32ss/user/user32/CMakeLists.txt b/reactos/win32ss/user/user32/CMakeLists.txt index 58df58e5ce4..8ea0ea1f840 100644 --- a/reactos/win32ss/user/user32/CMakeLists.txt +++ b/reactos/win32ss/user/user32/CMakeLists.txt @@ -71,7 +71,7 @@ add_library(user32 SHARED user32.rc ${CMAKE_CURRENT_BINARY_DIR}/user32.def) -set_module_type(user32 win32dll ENTRYPOINT DllMain 12 UNICODE) +set_module_type(user32 win32dll ENTRYPOINT DllMain 12 UNICODE HOTPATCHABLE) target_link_libraries(user32 user32_wsprintf wine win32ksys ${PSEH_LIB}) if(MSVC) diff --git a/reactos/win32ss/user/user32/windows/cursoricon.c b/reactos/win32ss/user/user32/windows/cursoricon.c index ba5c1a66287..cfe5aa0dd43 100644 --- a/reactos/win32ss/user/user32/windows/cursoricon.c +++ b/reactos/win32ss/user/user32/windows/cursoricon.c @@ -1252,7 +1252,7 @@ BOOL WINAPI DrawIcon( HDC hdc, INT x, INT y, HICON hIcon ) /*********************************************************************** * ShowCursor (USER32.@) */ -INT WINAPI /*DECLSPEC_HOTPATCH*/ ShowCursor( BOOL bShow ) +INT WINAPI DECLSPEC_HOTPATCH ShowCursor( BOOL bShow ) { return NtUserxShowCursor(bShow); } From 66e64a9325817796c0ba8dfecff17869d05a421b Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Fri, 28 Feb 2014 16:24:50 +0000 Subject: [PATCH 017/113] [DIRECTX] * Mark some modules as hotpatchable. CORE-7959 svn path=/trunk/; revision=62356 --- reactos/dll/directx/wine/d3d8/CMakeLists.txt | 2 +- reactos/dll/directx/wine/d3d9/CMakeLists.txt | 2 +- reactos/dll/directx/wine/ddraw/CMakeLists.txt | 2 +- reactos/dll/directx/wine/dinput/CMakeLists.txt | 2 +- reactos/dll/directx/wine/dinput8/CMakeLists.txt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/reactos/dll/directx/wine/d3d8/CMakeLists.txt b/reactos/dll/directx/wine/d3d8/CMakeLists.txt index d96473e41a0..cb111aee279 100644 --- a/reactos/dll/directx/wine/d3d8/CMakeLists.txt +++ b/reactos/dll/directx/wine/d3d8/CMakeLists.txt @@ -26,7 +26,7 @@ add_library(d3d8 SHARED version.rc ${CMAKE_CURRENT_BINARY_DIR}/d3d8.def) -set_module_type(d3d8 win32dll UNICODE) +set_module_type(d3d8 win32dll UNICODE HOTPATCHABLE) target_link_libraries(d3d8 uuid wine) add_importlibs(d3d8 wined3d msvcrt kernel32 ntdll) add_pch(d3d8 d3d8_private.h SOURCE) diff --git a/reactos/dll/directx/wine/d3d9/CMakeLists.txt b/reactos/dll/directx/wine/d3d9/CMakeLists.txt index 77bdc5472b4..330dc93ca07 100644 --- a/reactos/dll/directx/wine/d3d9/CMakeLists.txt +++ b/reactos/dll/directx/wine/d3d9/CMakeLists.txt @@ -29,7 +29,7 @@ add_library(d3d9 SHARED ${CMAKE_CURRENT_BINARY_DIR}/d3d9_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/d3d9.def) -set_module_type(d3d9 win32dll UNICODE) +set_module_type(d3d9 win32dll UNICODE HOTPATCHABLE) target_link_libraries(d3d9 wine) add_importlibs(d3d9 wined3d msvcrt kernel32 ntdll) add_pch(d3d9 d3d9_private.h SOURCE) diff --git a/reactos/dll/directx/wine/ddraw/CMakeLists.txt b/reactos/dll/directx/wine/ddraw/CMakeLists.txt index 115bc59fb6c..aa34f1760c7 100644 --- a/reactos/dll/directx/wine/ddraw/CMakeLists.txt +++ b/reactos/dll/directx/wine/ddraw/CMakeLists.txt @@ -34,7 +34,7 @@ add_library(ddraw SHARED ddraw.rc ${CMAKE_CURRENT_BINARY_DIR}/ddraw.def) -set_module_type(ddraw win32dll) +set_module_type(ddraw win32dll HOTPATCHABLE) target_link_libraries(ddraw wine uuid dxguid ${PSEH_LIB}) add_importlibs(ddraw advapi32 gdi32 user32 wined3d msvcrt kernel32 ntdll) add_dependencies(ddraw wineheaders) diff --git a/reactos/dll/directx/wine/dinput/CMakeLists.txt b/reactos/dll/directx/wine/dinput/CMakeLists.txt index 5e2809fff35..c2b10420576 100644 --- a/reactos/dll/directx/wine/dinput/CMakeLists.txt +++ b/reactos/dll/directx/wine/dinput/CMakeLists.txt @@ -24,7 +24,7 @@ add_library(dinput SHARED add_library(dinput_data_formats data_formats.c) add_dependencies(dinput_data_formats psdk) -set_module_type(dinput win32dll) +set_module_type(dinput win32dll HOTPATCHABLE) target_link_libraries(dinput dxguid uuid wine) add_importlibs(dinput comctl32 ole32 user32 advapi32 msvcrt kernel32 ntdll) add_pch(dinput dinput_private.h SOURCE) diff --git a/reactos/dll/directx/wine/dinput8/CMakeLists.txt b/reactos/dll/directx/wine/dinput8/CMakeLists.txt index 804d97b1c17..d2907e689e0 100644 --- a/reactos/dll/directx/wine/dinput8/CMakeLists.txt +++ b/reactos/dll/directx/wine/dinput8/CMakeLists.txt @@ -8,7 +8,7 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/dinput8.def) add_library(dinput8 SHARED ${SOURCE} version.rc) -set_module_type(dinput8 win32dll) +set_module_type(dinput8 win32dll HOTPATCHABLE) target_link_libraries(dinput8 dxguid uuid wine) add_importlibs(dinput8 ole32 msvcrt kernel32 ntdll) add_cd_file(TARGET dinput8 DESTINATION reactos/system32 FOR all) From ccee4fcbcee0f8bd419ce7d9d27e5c471e3f26ce Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Fri, 28 Feb 2014 18:39:29 +0000 Subject: [PATCH 018/113] [IPHLPAPI] * Mark as hotpatchable. CORE-7959 svn path=/trunk/; revision=62358 --- reactos/dll/win32/iphlpapi/CMakeLists.txt | 2 +- reactos/dll/win32/iphlpapi/iphlpapi_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/dll/win32/iphlpapi/CMakeLists.txt b/reactos/dll/win32/iphlpapi/CMakeLists.txt index ce365f72ce2..3d15eb6aded 100644 --- a/reactos/dll/win32/iphlpapi/CMakeLists.txt +++ b/reactos/dll/win32/iphlpapi/CMakeLists.txt @@ -24,7 +24,7 @@ add_library(iphlpapi SHARED iphlpapi.rc ${CMAKE_CURRENT_BINARY_DIR}/iphlpapi.def) -set_module_type(iphlpapi win32dll UNICODE) +set_module_type(iphlpapi win32dll UNICODE HOTPATCHABLE) target_link_libraries(iphlpapi wine tdilib) add_importlibs(iphlpapi icmp dhcpcsvc advapi32 ws2_32 msvcrt kernel32 ntdll) add_pch(iphlpapi iphlpapi_private.h SOURCE) diff --git a/reactos/dll/win32/iphlpapi/iphlpapi_main.c b/reactos/dll/win32/iphlpapi/iphlpapi_main.c index b61ae6f0394..dff38c05714 100644 --- a/reactos/dll/win32/iphlpapi/iphlpapi_main.c +++ b/reactos/dll/win32/iphlpapi/iphlpapi_main.c @@ -2281,7 +2281,7 @@ PIP_ADAPTER_ORDER_MAP WINAPI GetAdapterOrderMap(VOID) /* * @implemented */ -DWORD WINAPI GetAdaptersAddresses(ULONG Family,ULONG Flags,PVOID Reserved,PIP_ADAPTER_ADDRESSES pAdapterAddresses,PULONG pOutBufLen) +DWORD WINAPI DECLSPEC_HOTPATCH GetAdaptersAddresses(ULONG Family,ULONG Flags,PVOID Reserved,PIP_ADAPTER_ADDRESSES pAdapterAddresses,PULONG pOutBufLen) { #if 0 InterfaceIndexTable *indexTable; From 9892a47037ea076928fd4fe927b9602cbbe5d2cc Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Fri, 28 Feb 2014 21:24:32 +0000 Subject: [PATCH 019/113] [OPENGL32] * Mark as hotpatchable. CORE-7959 svn path=/trunk/; revision=62360 --- reactos/dll/opengl/opengl32/CMakeLists.txt | 2 +- reactos/dll/opengl/opengl32/wgl.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/dll/opengl/opengl32/CMakeLists.txt b/reactos/dll/opengl/opengl32/CMakeLists.txt index 17d7da19de3..9a14f68ee0e 100644 --- a/reactos/dll/opengl/opengl32/CMakeLists.txt +++ b/reactos/dll/opengl/opengl32/CMakeLists.txt @@ -53,7 +53,7 @@ if((ARCH STREQUAL "i386") AND (NOT MSVC)) target_link_libraries(opengl32 mesa_x86) endif() -set_module_type(opengl32 win32dll) +set_module_type(opengl32 win32dll HOTPATCHABLE) add_importlibs(opengl32 gdi32 user32 advapi32 msvcrt kernel32 ntdll) add_pch(opengl32 opengl32.h SOURCE) diff --git a/reactos/dll/opengl/opengl32/wgl.c b/reactos/dll/opengl/opengl32/wgl.c index 32503e7344b..8da98b9d350 100644 --- a/reactos/dll/opengl/opengl32/wgl.c +++ b/reactos/dll/opengl/opengl32/wgl.c @@ -871,7 +871,7 @@ BOOL WINAPI wglShareLists(HGLRC hglrcSrc, HGLRC hglrcDst) return sw_ShareLists(ctx_src->dhglrc, ctx_dst->dhglrc); } -BOOL WINAPI wglSwapBuffers(HDC hdc) +BOOL WINAPI DECLSPEC_HOTPATCH wglSwapBuffers(HDC hdc) { struct wgl_dc_data* dc_data = get_dc_data(hdc); From 4644ad4140877c02d816ac61b0bb7677fcb3645a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Fri, 28 Feb 2014 23:34:32 +0000 Subject: [PATCH 020/113] [CMAKE] Make MSVC warning C4020 "Too many actual parameters" an error CORE-7960 #resolve #comment Committed in revision 62361. svn path=/trunk/; revision=62361 --- reactos/cmake/msvc.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reactos/cmake/msvc.cmake b/reactos/cmake/msvc.cmake index 7d213195eee..16949003343 100644 --- a/reactos/cmake/msvc.cmake +++ b/reactos/cmake/msvc.cmake @@ -43,6 +43,7 @@ add_compile_flags("/wd4290") # The following warnings are treated as errors: # - C4013: implicit function declaration +# - C4020: too many actual parameters # - C4022: pointer type mismatch for parameter # - TODO: C4028: formal parameter different from declaration # - C4047: different level of indirection @@ -55,7 +56,7 @@ add_compile_flags("/wd4290") # - C4229: modifiers on data are ignored # - C4700: uninitialized variable usage # - C4603: macro is not defined or definition is different after precompiled header use -add_compile_flags("/we4013 /we4022 /we4047 /we4098 /we4113 /we4129 /we4229 /we4700 /we4603") +add_compile_flags("/we4013 /we4020 /we4022 /we4047 /we4098 /we4113 /we4129 /we4229 /we4700 /we4603") # Enable warnings above the default level, but don't treat them as errors: # - C4115: named type definition in parentheses From de68f2df0f520fbbdfb5c7ca89492726d5943fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Fri, 28 Feb 2014 23:55:40 +0000 Subject: [PATCH 021/113] [CMD][HELP] Fix the IsConsoleHandle helper. svn path=/trunk/; revision=62362 --- reactos/base/applications/cmdutils/help/help.c | 3 ++- reactos/base/shell/cmd/console.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/reactos/base/applications/cmdutils/help/help.c b/reactos/base/applications/cmdutils/help/help.c index 69af5ebd091..2a2b67cb5ba 100644 --- a/reactos/base/applications/cmdutils/help/help.c +++ b/reactos/base/applications/cmdutils/help/help.c @@ -25,7 +25,8 @@ BOOL IsConsoleHandle(HANDLE hHandle) DWORD dwMode; /* Check whether the handle may be that of a console... */ - if ((GetFileType(hHandle) & FILE_TYPE_CHAR) == 0) return FALSE; + if ((GetFileType(hHandle) & ~FILE_TYPE_REMOTE) != FILE_TYPE_CHAR) + return FALSE; /* * It may be. Perform another test... The idea comes from the diff --git a/reactos/base/shell/cmd/console.c b/reactos/base/shell/cmd/console.c index 921684b08ba..a01c0c8d748 100644 --- a/reactos/base/shell/cmd/console.c +++ b/reactos/base/shell/cmd/console.c @@ -31,7 +31,8 @@ BOOL IsConsoleHandle(HANDLE hHandle) DWORD dwMode; /* Check whether the handle may be that of a console... */ - if ((GetFileType(hHandle) & FILE_TYPE_CHAR) == 0) return FALSE; + if ((GetFileType(hHandle) & ~FILE_TYPE_REMOTE) != FILE_TYPE_CHAR) + return FALSE; /* * It may be. Perform another test... The idea comes from the From 2d1a100b5717f4f29fa2b3d85fb3b364f8197fea Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 1 Mar 2014 11:37:23 +0000 Subject: [PATCH 022/113] [NETAPI32] - NetUserSetInfo: Implement the info level 22. - Update the users DACL according to the user flags for the info levels 1, 2, 3, 4, 22 and 1008. svn path=/trunk/; revision=62364 --- reactos/dll/win32/netapi32/user.c | 154 +++++++++++++++++++++++++++--- 1 file changed, 143 insertions(+), 11 deletions(-) diff --git a/reactos/dll/win32/netapi32/user.c b/reactos/dll/win32/netapi32/user.c index 6452a4ad225..01d787a1e65 100644 --- a/reactos/dll/win32/netapi32/user.c +++ b/reactos/dll/win32/netapi32/user.c @@ -250,6 +250,28 @@ GetPasswordAge(IN PLARGE_INTEGER PasswordLastSet) } +static +VOID +ChangeUserDacl(IN PACL Dacl, + IN ULONG Flags) +{ + PACCESS_ALLOWED_ACE Ace = NULL; + NTSTATUS Status; + + if (Dacl == NULL) + return; + + Status = GetAllowedWorldAce(Dacl, &Ace); + if (!NT_SUCCESS(Status)) + return; + + if (Flags & UF_PASSWD_CANT_CHANGE) + Ace->Mask &= ~USER_CHANGE_PASSWORD; + else + Ace->Mask |= USER_CHANGE_PASSWORD; +} + + static NET_API_STATUS GetUserDacl(IN SAM_HANDLE UserHandle, @@ -1511,6 +1533,7 @@ SetUserInfo(SAM_HANDLE UserHandle, PUSER_INFO_2 UserInfo2; PUSER_INFO_3 UserInfo3; PUSER_INFO_4 UserInfo4; + PUSER_INFO_22 UserInfo22; PUSER_INFO_1003 UserInfo1003; PUSER_INFO_1006 UserInfo1006; PUSER_INFO_1007 UserInfo1007; @@ -1527,11 +1550,20 @@ SetUserInfo(SAM_HANDLE UserHandle, PUSER_INFO_1051 UserInfo1051; PUSER_INFO_1052 UserInfo1052; PUSER_INFO_1053 UserInfo1053; + PACL Dacl = NULL; NET_API_STATUS ApiStatus = NERR_Success; NTSTATUS Status = STATUS_SUCCESS; ZeroMemory(&UserAllInfo, sizeof(USER_ALL_INFORMATION)); + if ((Level == 1) || (Level == 2) || (Level == 3) || + (Level == 4) || (Level == 22) || (Level == 1008)) + { + ApiStatus = GetUserDacl(UserHandle, &Dacl); + if (ApiStatus != NERR_Success) + goto done; + } + switch (Level) { case 0: @@ -1574,6 +1606,7 @@ SetUserInfo(SAM_HANDLE UserHandle, UserAllInfo.WhichFields |= USER_ALL_ADMINCOMMENT; } + ChangeUserDacl(Dacl, UserInfo1->usri1_flags); UserAllInfo.UserAccountControl = GetAccountControl(UserInfo1->usri1_flags); UserAllInfo.WhichFields |= USER_ALL_USERACCOUNTCONTROL; @@ -1616,6 +1649,7 @@ SetUserInfo(SAM_HANDLE UserHandle, UserAllInfo.WhichFields |= USER_ALL_ADMINCOMMENT; } + ChangeUserDacl(Dacl, UserInfo2->usri2_flags); UserAllInfo.UserAccountControl = GetAccountControl(UserInfo2->usri2_flags); UserAllInfo.WhichFields |= USER_ALL_USERACCOUNTCONTROL; @@ -1718,6 +1752,7 @@ SetUserInfo(SAM_HANDLE UserHandle, UserAllInfo.WhichFields |= USER_ALL_ADMINCOMMENT; } + ChangeUserDacl(Dacl, UserInfo3->usri3_flags); UserAllInfo.UserAccountControl = GetAccountControl(UserInfo3->usri3_flags); UserAllInfo.WhichFields |= USER_ALL_USERACCOUNTCONTROL; @@ -1842,6 +1877,7 @@ SetUserInfo(SAM_HANDLE UserHandle, UserAllInfo.WhichFields |= USER_ALL_ADMINCOMMENT; } + ChangeUserDacl(Dacl, UserInfo4->usri4_flags); UserAllInfo.UserAccountControl = GetAccountControl(UserInfo4->usri4_flags); UserAllInfo.WhichFields |= USER_ALL_USERACCOUNTCONTROL; @@ -1899,8 +1935,8 @@ SetUserInfo(SAM_HANDLE UserHandle, // usri4_max_storage ignored -// UserInfo3->usri4_units_per_week; -// UserInfo3->usri4_logon_hours; +// UserInfo4->usri4_units_per_week; +// UserInfo4->usri4_logon_hours; // usri4_bad_pw_count ignored // usri4_num_logons ignored @@ -1936,7 +1972,104 @@ SetUserInfo(SAM_HANDLE UserHandle, break; // case 21: -// case 22: +// break; + + case 22: + UserInfo22 = (PUSER_INFO_22)UserInfo; + + // usri22_name ignored + +// UserInfo22->usri22_password[ENCRYPTED_PWLEN]; + + // usri22_password_age ignored + +// UserInfo3->usri3_priv; + + if (UserInfo22->usri22_home_dir != NULL) + { + RtlInitUnicodeString(&UserAllInfo.HomeDirectory, + UserInfo22->usri22_home_dir); + UserAllInfo.WhichFields |= USER_ALL_HOMEDIRECTORY; + } + + if (UserInfo22->usri22_comment != NULL) + { + RtlInitUnicodeString(&UserAllInfo.AdminComment, + UserInfo22->usri22_comment); + UserAllInfo.WhichFields |= USER_ALL_ADMINCOMMENT; + } + + ChangeUserDacl(Dacl, UserInfo22->usri22_flags); + UserAllInfo.UserAccountControl = GetAccountControl(UserInfo22->usri22_flags); + UserAllInfo.WhichFields |= USER_ALL_USERACCOUNTCONTROL; + + if (UserInfo22->usri22_script_path != NULL) + { + RtlInitUnicodeString(&UserAllInfo.ScriptPath, + UserInfo22->usri22_script_path); + UserAllInfo.WhichFields |= USER_ALL_SCRIPTPATH; + } + +// UserInfo22->usri22_auth_flags; + + if (UserInfo22->usri22_full_name != NULL) + { + RtlInitUnicodeString(&UserAllInfo.FullName, + UserInfo22->usri22_full_name); + UserAllInfo.WhichFields |= USER_ALL_FULLNAME; + } + + if (UserInfo22->usri22_usr_comment != NULL) + { + RtlInitUnicodeString(&UserAllInfo.UserComment, + UserInfo22->usri22_usr_comment); + UserAllInfo.WhichFields |= USER_ALL_USERCOMMENT; + } + + if (UserInfo22->usri22_parms != NULL) + { + RtlInitUnicodeString(&UserAllInfo.Parameters, + UserInfo22->usri22_parms); + UserAllInfo.WhichFields |= USER_ALL_PARAMETERS; + } + + if (UserInfo22->usri22_workstations != NULL) + { + RtlInitUnicodeString(&UserAllInfo.WorkStations, + UserInfo22->usri22_workstations); + UserAllInfo.WhichFields |= USER_ALL_WORKSTATIONS; + } + + // usri22_last_logon ignored + // usri22_last_logoff ignored + + if (UserInfo22->usri22_acct_expires == TIMEQ_FOREVER) + { + UserAllInfo.AccountExpires.LowPart = 0; + UserAllInfo.AccountExpires.HighPart = 0; + } + else + { + RtlSecondsSince1970ToTime(UserInfo22->usri22_acct_expires, + &UserAllInfo.AccountExpires); + } + UserAllInfo.WhichFields |= USER_ALL_ACCOUNTEXPIRES; + + // usri22_max_storage ignored + +// UserInfo22->usri22_units_per_week; +// UserInfo22->usri22_logon_hours; + + // usri22_bad_pw_count ignored + // usri22_num_logons ignored + // usri22_logon_server ignored + + UserAllInfo.CountryCode = UserInfo22->usri22_country_code; + UserAllInfo.WhichFields |= USER_ALL_COUNTRYCODE; + + UserAllInfo.CodePage = UserInfo22->usri22_code_page; + UserAllInfo.WhichFields |= USER_ALL_CODEPAGE; + break; case 1003: UserInfo1003 = (PUSER_INFO_1003)UserInfo; @@ -1951,6 +2084,7 @@ SetUserInfo(SAM_HANDLE UserHandle, break; // case 1005: +// break; case 1006: UserInfo1006 = (PUSER_INFO_1006)UserInfo; @@ -1976,6 +2110,7 @@ SetUserInfo(SAM_HANDLE UserHandle, case 1008: UserInfo1008 = (PUSER_INFO_1008)UserInfo; + ChangeUserDacl(Dacl, UserInfo1008->usri1008_flags); UserAllInfo.UserAccountControl = GetAccountControl(UserInfo1008->usri1008_flags); UserAllInfo.WhichFields |= USER_ALL_USERACCOUNTCONTROL; break; @@ -1992,6 +2127,7 @@ SetUserInfo(SAM_HANDLE UserHandle, break; // case 1010: +// break; case 1011: UserInfo1011 = (PUSER_INFO_1011)UserInfo; @@ -2064,6 +2200,7 @@ SetUserInfo(SAM_HANDLE UserHandle, break; // case 1020: +// break; case 1024: UserInfo1024 = (PUSER_INFO_1024)UserInfo; @@ -2124,6 +2261,9 @@ SetUserInfo(SAM_HANDLE UserHandle, } done: + if (Dacl != NULL) + HeapFree(GetProcessHeap(), 0, Dacl); + return ApiStatus; } @@ -2934,14 +3074,6 @@ done: // *bufptr = (LPBYTE)Buffer; return ApiStatus; - -#if 0 - *bufptr = NULL; - *entriesread = 0; - *totalentries = 0; - - return ERROR_INVALID_LEVEL; -#endif } From 27558e0b69a2ab5e632f30d61d6606357c15a788 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 1 Mar 2014 12:11:26 +0000 Subject: [PATCH 023/113] [NETAPI32] NetUserSetInfo: Enable info levels 4, 22, 1017 and 1018. svn path=/trunk/; revision=62366 --- reactos/dll/win32/netapi32/user.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/reactos/dll/win32/netapi32/user.c b/reactos/dll/win32/netapi32/user.c index 01d787a1e65..0abfc0d73ab 100644 --- a/reactos/dll/win32/netapi32/user.c +++ b/reactos/dll/win32/netapi32/user.c @@ -3887,9 +3887,9 @@ NetUserSetInfo(LPCWSTR servername, case 1: case 2: case 3: -// case 4: + case 4: // case 21: -// case 22: + case 22: case 1003: // case 1005: case 1006: @@ -3901,8 +3901,8 @@ NetUserSetInfo(LPCWSTR servername, case 1012: case 1013: case 1014: -// case 1017: -// case 1018: + case 1017: + case 1018: // case 1020: case 1024: case 1025: From dae5c99d1293426c6468d67c4695f8c5dac637dc Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 1 Mar 2014 17:12:21 +0000 Subject: [PATCH 024/113] [MSV1_0] LsaApLogonUser: Add checks for account restrictions (account disabled and account locked). svn path=/trunk/; revision=62368 --- reactos/dll/win32/msv1_0/msv1_0.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/reactos/dll/win32/msv1_0/msv1_0.c b/reactos/dll/win32/msv1_0/msv1_0.c index 5581d78a2e8..ec63a04368d 100644 --- a/reactos/dll/win32/msv1_0/msv1_0.c +++ b/reactos/dll/win32/msv1_0/msv1_0.c @@ -1083,7 +1083,33 @@ LsaApLogonUser(IN PLSA_CLIENT_REQUEST ClientRequest, TRACE("UserName: %S\n", UserInfo->All.UserName.Buffer); - /* FIXME: Check restrictions */ + /* Check account restrictions for non-administrator accounts */ + if (RelativeIds.Element[0] != DOMAIN_USER_RID_ADMIN) + { + /* Check if the account has been disabled */ + if (UserInfo->All.UserAccountControl & USER_ACCOUNT_DISABLED) + { + ERR("Account disabled!\n"); + *SubStatus = STATUS_ACCOUNT_DISABLED; + Status = STATUS_ACCOUNT_RESTRICTION; + goto done; + } + + /* Check if the account has been locked */ + if (UserInfo->All.UserAccountControl & USER_ACCOUNT_AUTO_LOCKED) + { + ERR("Account disabled!\n"); + *SubStatus = STATUS_ACCOUNT_LOCKED_OUT; + Status = STATUS_ACCOUNT_RESTRICTION; + goto done; + } + + /* FIXME: more checks */ +// *SubStatus = STATUS_PASSWORD_EXPIRED; +// *SubStatus = STATUS_INVALID_LOGON_HOURS; +// *SubStatus = STATUS_INVALID_WORKSTATION; + + } /* Check the password */ if ((UserInfo->All.UserAccountControl & USER_PASSWORD_NOT_REQUIRED) == 0) From 5012425e7fb1fb2546f0184457ed89c48114c8de Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 1 Mar 2014 20:45:10 +0000 Subject: [PATCH 025/113] [MSGINA] MyLogonUser: Pass the sub status to the caller. svn path=/trunk/; revision=62369 --- reactos/dll/win32/msgina/lsa.c | 25 +++++--------- reactos/dll/win32/msgina/msgina.c | 55 ++++++++++++++++++++----------- reactos/dll/win32/msgina/msgina.h | 7 ++-- reactos/dll/win32/msgina/tui.c | 28 ++++++++++------ 4 files changed, 66 insertions(+), 49 deletions(-) diff --git a/reactos/dll/win32/msgina/lsa.c b/reactos/dll/win32/msgina/lsa.c index 126a55aa5c4..174378f0fcd 100644 --- a/reactos/dll/win32/msgina/lsa.c +++ b/reactos/dll/win32/msgina/lsa.c @@ -7,7 +7,7 @@ #include "msgina.h" -BOOL +NTSTATUS ConnectToLsa( PGINA_CONTEXT pgContext) { @@ -18,7 +18,7 @@ ConnectToLsa( /* We are already connected to the LSA */ if (pgContext->LsaHandle != NULL) - return TRUE; + return STATUS_SUCCESS; /* Connect to the LSA server */ RtlInitAnsiString((PANSI_STRING)&LogonProcessName, @@ -30,7 +30,7 @@ ConnectToLsa( if (!NT_SUCCESS(Status)) { ERR("LsaRegisterLogonProcess failed (Status 0x%08lx)\n", Status); - return FALSE; + return Status; } /* Get the authentication package */ @@ -43,21 +43,21 @@ ConnectToLsa( if (!NT_SUCCESS(Status)) { ERR("LsaLookupAuthenticationPackage failed (Status 0x%08lx)\n", Status); - return FALSE; } - return TRUE; + return Status; } -BOOL +NTSTATUS MyLogonUser( HANDLE LsaHandle, ULONG AuthenticationPackage, LPWSTR lpszUsername, LPWSTR lpszDomain, LPWSTR lpszPassword, - PHANDLE phToken) + PHANDLE phToken, + PNTSTATUS SubStatus) { SID_IDENTIFIER_AUTHORITY LocalAuthority = {SECURITY_LOCAL_SID_AUTHORITY}; SID_IDENTIFIER_AUTHORITY SystemAuthority = {SECURITY_NT_AUTHORITY}; @@ -78,7 +78,6 @@ MyLogonUser( LUID LogonId = {0, 0}; HANDLE TokenHandle = NULL; QUOTA_LIMITS QuotaLimits; - NTSTATUS SubStatus = STATUS_SUCCESS; NTSTATUS Status; *phToken = NULL; @@ -209,7 +208,7 @@ MyLogonUser( &Luid, &TokenHandle, &QuotaLimits, - &SubStatus); + SubStatus); if (!NT_SUCCESS(Status)) { ERR("LsaLogonUser failed (Status 0x%08lx)\n", Status); @@ -259,13 +258,7 @@ done: if (AuthInfo != NULL) RtlFreeHeap(RtlGetProcessHeap(), 0, AuthInfo); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; + return Status; } /* EOF */ diff --git a/reactos/dll/win32/msgina/msgina.c b/reactos/dll/win32/msgina/msgina.c index 6f54e20121f..6480cbef32a 100644 --- a/reactos/dll/win32/msgina/msgina.c +++ b/reactos/dll/win32/msgina/msgina.c @@ -612,20 +612,27 @@ DoAdminUnlock( ULONG Size; ULONG i; NTSTATUS Status; + NTSTATUS SubStatus = STATUS_SUCCESS; TRACE("(%S %S %S)\n", UserName, Domain, Password); - if (!ConnectToLsa(pgContext)) - return FALSE; - - if (!MyLogonUser(pgContext->LsaHandle, - pgContext->AuthenticationPackage, - UserName, - Domain, - Password, - &pgContext->UserToken)) + Status = ConnectToLsa(pgContext); + if (!NT_SUCCESS(Status)) { - WARN("LogonUserW() failed\n"); + WARN("ConnectToLsa() failed\n"); + return FALSE; + } + + Status = MyLogonUser(pgContext->LsaHandle, + pgContext->AuthenticationPackage, + UserName, + Domain, + Password, + &pgContext->UserToken, + &SubStatus); + if (!NT_SUCCESS(Status)) + { + WARN("MyLogonUser() failed\n"); return FALSE; } @@ -693,18 +700,26 @@ DoLoginTasks( DWORD cbStats, cbSize; DWORD dwLength; BOOL bResult; + NTSTATUS SubStatus; + NTSTATUS Status; - if (!ConnectToLsa(pgContext)) - return FALSE; - - if (!MyLogonUser(pgContext->LsaHandle, - pgContext->AuthenticationPackage, - UserName, - Domain, - Password, - &pgContext->UserToken)) + Status = ConnectToLsa(pgContext); + if (!NT_SUCCESS(Status)) { - WARN("LogonUserW() failed\n"); + WARN("ConnectToLsa() failed\n"); + return FALSE; + } + + Status = MyLogonUser(pgContext->LsaHandle, + pgContext->AuthenticationPackage, + UserName, + Domain, + Password, + &pgContext->UserToken, + &SubStatus); + if (!NT_SUCCESS(Status)) + { + WARN("MyLogonUser() failed\n"); goto cleanup; } diff --git a/reactos/dll/win32/msgina/msgina.h b/reactos/dll/win32/msgina/msgina.h index 5507b10422b..a6ba264d0cf 100644 --- a/reactos/dll/win32/msgina/msgina.h +++ b/reactos/dll/win32/msgina/msgina.h @@ -81,18 +81,19 @@ typedef struct _GINA_UI /* lsa.c */ -BOOL +NTSTATUS ConnectToLsa( PGINA_CONTEXT pgContext); -BOOL +NTSTATUS MyLogonUser( HANDLE LsaHandle, ULONG AuthenticationPackage, LPWSTR lpszUsername, LPWSTR lpszDomain, LPWSTR lpszPassword, - PHANDLE phToken); + PHANDLE phToken, + PNTSTATUS SubStatus); /* msgina.c */ diff --git a/reactos/dll/win32/msgina/tui.c b/reactos/dll/win32/msgina/tui.c index fb40c421a2d..aa262232659 100644 --- a/reactos/dll/win32/msgina/tui.c +++ b/reactos/dll/win32/msgina/tui.c @@ -221,6 +221,8 @@ TUILockedSAS( HANDLE hToken; WCHAR UserName[256]; WCHAR Password[256]; + NTSTATUS SubStatus; + NTSTATUS Status; TRACE("TUILockedSAS()\n"); @@ -235,17 +237,23 @@ TUILockedSAS( if (!ReadString(IDS_ASKFORPASSWORD, Password, 256, FALSE)) return WLX_SAS_ACTION_NONE; - if (!ConnectToLsa(pgContext)) - return WLX_SAS_ACTION_NONE; - - if (!MyLogonUser(pgContext->LsaHandle, - pgContext->AuthenticationPackage, - UserName, - NULL, - Password, - &hToken)) + Status = ConnectToLsa(pgContext); + if (!NT_SUCCESS(Status)) { - WARN("LogonUserW() failed\n"); + WARN("ConnectToLsa() failed\n"); + return WLX_SAS_ACTION_NONE; + } + + Status = MyLogonUser(pgContext->LsaHandle, + pgContext->AuthenticationPackage, + UserName, + NULL, + Password, + &hToken, + &SubStatus); + if (!NT_SUCCESS(Status)) + { + WARN("MyLogonUser() failed\n"); return WLX_SAS_ACTION_NONE; } From 447234095775f605505dca229f75d9492f544789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sat, 1 Mar 2014 22:42:38 +0000 Subject: [PATCH 026/113] [FTP] Fix download with ftp.exe, the problem was that we didn't switch download mode to binary when needed, because of idiotic defines used that where pointless here. We have this bug since revision 12776... Patch by Alexander Varnin, see CORE-3682 for details. CORE-3682 #resolve #comment Committed in revision, cheers ;) svn path=/trunk/; revision=62372 --- reactos/base/applications/network/ftp/cmds.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/reactos/base/applications/network/ftp/cmds.c b/reactos/base/applications/network/ftp/cmds.c index 4b9c08df167..dd752ec7ab9 100644 --- a/reactos/base/applications/network/ftp/cmds.c +++ b/reactos/base/applications/network/ftp/cmds.c @@ -85,18 +85,11 @@ void setpeer(int argc, const char *argv[]) } host = hookup(argv[1], portnum); if (host) { -#if defined(unix) && NBBY == 8 int overbose; -#endif connected = 1; if (autologin) (void) login(argv[1]); -#if defined(unix) && NBBY == 8 -/* - * this ifdef is to keep someone form "porting" this to an incompatible - * system and not checking this out. This way they have to think about it. - */ overbose = verbose; if (debug == 0) verbose = -1; @@ -119,7 +112,7 @@ void setpeer(int argc, const char *argv[]) *cp = c; } if (!strncmp(reply_string, "215 UNIX Type: L8", 17)) { - setbinary(); + setbinary(0, NULL); /* allbinary = 1; this violates the RFC */ if (overbose) printf("Using %s mode to transfer files.\n", @@ -130,7 +123,6 @@ void setpeer(int argc, const char *argv[]) "Remember to set tenex mode when transfering binary files from this machine.\n"); } verbose = overbose; -#endif /* unix */ } (void) fflush(stdout); } From fc63b50ede5ecbb8628dabaa7d27ab5906aa349d Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 2 Mar 2014 11:49:18 +0000 Subject: [PATCH 027/113] [NTOSKRNL] * Generate a trace when we hit this issue. svn path=/trunk/; revision=62375 --- reactos/ntoskrnl/mm/ARM3/virtual.c | 1 + 1 file changed, 1 insertion(+) diff --git a/reactos/ntoskrnl/mm/ARM3/virtual.c b/reactos/ntoskrnl/mm/ARM3/virtual.c index 5fd8d048c80..09e0f6810e0 100644 --- a/reactos/ntoskrnl/mm/ARM3/virtual.c +++ b/reactos/ntoskrnl/mm/ARM3/virtual.c @@ -5300,6 +5300,7 @@ MmGetPhysicalAddress(PVOID Address) } DPRINT1("MM:MmGetPhysicalAddressFailed base address was %p\n", Address); + KeRosDumpStackFrames(NULL, 20); PhysicalAddress.QuadPart = 0; return PhysicalAddress; } From acfa62fbeb6f541c8751df1422e204e9f273b93c Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 2 Mar 2014 12:27:42 +0000 Subject: [PATCH 028/113] [NTOSKRNL] * Move the trace call before the debug print. svn path=/trunk/; revision=62376 --- reactos/ntoskrnl/mm/ARM3/virtual.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/mm/ARM3/virtual.c b/reactos/ntoskrnl/mm/ARM3/virtual.c index 09e0f6810e0..4630f52209d 100644 --- a/reactos/ntoskrnl/mm/ARM3/virtual.c +++ b/reactos/ntoskrnl/mm/ARM3/virtual.c @@ -5299,8 +5299,8 @@ MmGetPhysicalAddress(PVOID Address) } } - DPRINT1("MM:MmGetPhysicalAddressFailed base address was %p\n", Address); KeRosDumpStackFrames(NULL, 20); + DPRINT1("MM:MmGetPhysicalAddressFailed base address was %p\n", Address); PhysicalAddress.QuadPart = 0; return PhysicalAddress; } From 3958819ba0f6ba7c649fd7e3d85e23d310629c05 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 2 Mar 2014 13:01:16 +0000 Subject: [PATCH 029/113] [NTOSKRNL] * Print RealFrameCount here. svn path=/trunk/; revision=62377 --- reactos/ntoskrnl/ke/bug.c | 1 + 1 file changed, 1 insertion(+) diff --git a/reactos/ntoskrnl/ke/bug.c b/reactos/ntoskrnl/ke/bug.c index 9782230a0b9..820201f69fc 100644 --- a/reactos/ntoskrnl/ke/bug.c +++ b/reactos/ntoskrnl/ke/bug.c @@ -275,6 +275,7 @@ KeRosDumpStackFrames(IN PULONG_PTR Frame OPTIONAL, { /* Get the current frames (skip the two. One for the dumper, one for the caller) */ RealFrameCount = RtlCaptureStackBackTrace(2, FrameCount, (PVOID*)Frames, NULL); + DPRINT1("RealFrameCount =%lu\n", RealFrameCount); /* Dump them */ KeRosDumpStackFrameArray(Frames, RealFrameCount); From e46cb53319036bc919a8aa41d88190af8ee0bbad Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 2 Mar 2014 17:06:37 +0000 Subject: [PATCH 030/113] [TRANSLATIONS] * Turkish translation update by Erdem Ersoy. CORE-7861 svn path=/trunk/; revision=62380 --- reactos/base/applications/calc/lang/tr-TR.rc | 2 +- .../base/applications/charmap/lang/tr-TR.rc | 4 +- .../games/solitaire/lang/tr-TR.rc | 10 +- .../base/applications/games/solitaire/rsrc.rc | 6 +- .../applications/games/spider/lang/tr-TR.rc | 8 +- .../base/applications/games/spider/rsrc.rc | 6 +- .../applications/games/winmine/lang/tr-TR.rc | 26 +- .../base/applications/games/winmine/rsrc.rc | 6 +- .../base/applications/magnify/lang/tr-TR.rc | 8 +- reactos/base/applications/magnify/magnify.rc | 6 +- .../base/applications/msconfig/lang/tr-TR.rc | 10 +- .../mscutils/devmgmt/lang/tr-TR.rc | 2 +- .../mscutils/devmgmt_new/lang/tr-TR.rc | 2 +- .../mscutils/eventvwr/lang/tr-TR.rc | 2 +- .../mscutils/servman/lang/tr-TR.rc | 6 +- .../base/applications/mspaint/lang/tr-TR.rc | 2 +- .../base/applications/notepad/lang/tr-TR.rc | 50 ++-- reactos/base/applications/notepad/rsrc.rc | 6 +- reactos/base/applications/rapps/lang/tr-TR.rc | 2 +- .../base/applications/regedit/lang/tr-TR.rc | 2 +- reactos/base/applications/winhlp32/lang/Tr.rc | 2 +- reactos/base/applications/wordpad/lang/Tr.rc | 6 +- reactos/boot/freeldr/fdebug/lang/tr-TR.rc | 2 +- reactos/dll/cpl/desk/lang/tr-TR.rc | 4 +- reactos/dll/cpl/input/lang/tr-TR.rc | 6 +- reactos/dll/cpl/intl/lang/tr-TR.rc | 12 +- reactos/dll/cpl/main/lang/tr-TR.rc | 2 +- reactos/dll/win32/crypt32/lang/crypt32_Tr.rc | 22 +- reactos/dll/win32/cryptui/lang/cryptui_Tr.rc | 24 +- reactos/dll/win32/devmgr/devmgr.rc | 3 + reactos/dll/win32/devmgr/lang/tr-TR.rc | 239 ++++++++++++++++++ reactos/dll/win32/hhctrl.ocx/hhctrl.rc | 6 +- reactos/dll/win32/hhctrl.ocx/lang/Tr.rc | 22 +- reactos/dll/win32/iccvid/lang/iccvid_Tr.rc | 6 +- reactos/dll/win32/iccvid/rsrc.rc | 6 +- 35 files changed, 385 insertions(+), 143 deletions(-) create mode 100644 reactos/dll/win32/devmgr/lang/tr-TR.rc diff --git a/reactos/base/applications/calc/lang/tr-TR.rc b/reactos/base/applications/calc/lang/tr-TR.rc index 8ba7251007f..daa77611be1 100644 --- a/reactos/base/applications/calc/lang/tr-TR.rc +++ b/reactos/base/applications/calc/lang/tr-TR.rc @@ -415,7 +415,7 @@ END STRINGTABLE BEGIN - IDS_STRING_LICENSE "Hesap Makinesi, GNU GPL ile yayınlanan özgür bir yazılımdır.\r\n\r\nGNU GPL'nin bir tıpkısını buradan elde edebilirsiniz:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nBir de GNU GPL'nin çevirilerini buradan elde edebilirsiniz:\r\nhttp://www.gnu.org/licenses/translations.html" + IDS_STRING_LICENSE "Hesap Makinesi, GNU GPL ile yayınlanan özgür bir yazılımdır.\r\n\r\nGNU GPL'nin bir sûretini buradan elde edebilirsiniz:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nBir de GNU GPL'nin çevirilerini buradan elde edebilirsiniz:\r\nhttp://www.gnu.org/licenses/translations.html" IDS_MATH_ERROR "Yanlışlık" IDS_QUICKHELP "Hızlı Yardım" END diff --git a/reactos/base/applications/charmap/lang/tr-TR.rc b/reactos/base/applications/charmap/lang/tr-TR.rc index fff29158cba..6a8e3ac344f 100644 --- a/reactos/base/applications/charmap/lang/tr-TR.rc +++ b/reactos/base/applications/charmap/lang/tr-TR.rc @@ -32,7 +32,7 @@ BEGIN PUSHBUTTON "Ara", IDC_BUTTON_SEARCH, 200, 44, 50, 14 EDITTEXT IDC_EDIT_SEARCH, 72, 44, 116, 14, ES_AUTOHSCROLL LTEXT "Ada Göre Ara:", IDC_STATIC, 8, 48, 42, 8 - LTEXT "Evrenlik Düzgü:", IDC_STATIC, 200, 8, 30, 8 + LTEXT "Evrenlik Kod:", IDC_STATIC, 200, 8, 30, 8 EDITTEXT IDC_EDIT_UNICODE, 236, 4, 28, 12, ES_AUTOHSCROLL END @@ -50,7 +50,7 @@ END STRINGTABLE BEGIN - IDS_LICENSE "ÖNEMLİ: Aşağıdaki metin, özgün metnin resmî olmayan çevirisidir. Çeviri metniyle özgün metin arasında ayrım olabilir. Özgün metin, çeviri metninin altındadır.\r\n\r\n***\r\n\r\nBu yazılım özgürdür, yâni bu yazılım Özgür Yazılım Vakfı'nın yayınladığı GNU Umûmî Kamu Ruhsatı'nın 2. sürümü veyâ daha sonraki sürümleri altında yeniden dağıtabilir veyâ değiştirebilirsiniz.\r\n\r\nBu yazılım, kullanışlı olabileceği umuduyla dağıtılmıştır, ancak bilhassa SATILABİLİRLİK ve BELİRLİ BİR AMACA UYGUNLUK açısından olmak üzere bu yazılımın hiçbir güvencesi yoktur. Daha çok bilgi için GNU Umûmî Kamu Ruhsatı'na bakınız.\r\n\r\nBu yazılımla birlikte GNU Umûmî Kamu Ruhsatı'nın bir sûretine de iye olmanız gerekir, eğer yoksa Özgür Yazılım Vakfı A.Ş.'ne (51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ABD) yazınız.\r\n\r\n***\r\n\r\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + IDS_LICENSE "ÖNEMLİ: Aşağıdaki metin, özgün metnin resmî olmayan çevirisidir. Çeviri metniyle özgün metin arasında ayrım olabilir. Özgün metin, çeviri metninin altındadır.\r\n\r\n***\r\n\r\nBu yazılım özgür yazılımdır; bu yazılımı, Özgür Yazılım Vakfı'nın yayımladığı GNU Umûmî Kamu Ruhsatı'nın, 2. sürümünün ya da daha sonraki herhangi bir sürümünün (Orası size bağlı.) koşulları altında yeniden dağıtabilir veyâ değiştirebilirsiniz.\r\n\r\nBu yazılım, kullanışlı olabileceği beklentisiyle dağıtılmıştır ancak bu yazılımın HİÇBİR GÜVENCESİ YOKTUR, SATILABİLİRLİĞİN ve BELİRLİ BİR AMACA UYGUNLUĞUN demek istenilen garantisi bile. Daha çok bilgi için GNU Umûmî Kamu Ruhsatı'na bakınız.\r\n\r\nBu yazılımla birlikte GNU Umûmî Kamu Ruhsatı'nın bir sûretini almış olmalısınız, eğer yoksa Özgür Yazılım Vakfı AŞ'ye (51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ABD) yazınız.\r\n\r\n***\r\n\r\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." IDS_ABOUT "&Hakkında" IDS_TITLE "Karakter Eşlem" END diff --git a/reactos/base/applications/games/solitaire/lang/tr-TR.rc b/reactos/base/applications/games/solitaire/lang/tr-TR.rc index 3cc00e2d696..26eb43921ab 100644 --- a/reactos/base/applications/games/solitaire/lang/tr-TR.rc +++ b/reactos/base/applications/games/solitaire/lang/tr-TR.rc @@ -16,7 +16,7 @@ CAPTION "Seçenekler" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Kâğıtlar", -1, 7, 7, 90, 40 - AUTORADIOBUTTON "T&ekli Çek", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Tekli Çek", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "&Üçlü Çek", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 AUTOCHECKBOX "&Süreyi Göster", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED AUTOCHECKBOX "&Durum Çubuğu", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP @@ -25,7 +25,7 @@ BEGIN END IDD_CARDBACK DIALOGEX 6, 6, 186, 104 -CAPTION "Deste Seç" +CAPTION "Kâğıt Arkalığı Seçme" FONT 8, "MS Shell Dlg" STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT BEGIN @@ -51,9 +51,9 @@ STRINGTABLE BEGIN IDS_SOL_NAME "Solitaire" IDS_SOL_ABOUT "Solitaire, J Brown eliyle yapılmıştır.\n\nCardLib sürümü: 1.0" - IDS_SOL_QUIT "Bu oyundan çıkmak ister misiniz?" + IDS_SOL_QUIT "Bu oyundan çıkılsın mı?" IDS_SOL_WIN "Tebrikler, kazandınız!" - IDS_SOL_DEAL "Tekrar dağıtılsın mı?" + IDS_SOL_DEAL "Yine dağıtılsın mı?" END /* Menus */ @@ -71,7 +71,7 @@ BEGIN END POPUP "&Yardım" BEGIN - MENUITEM "&Yardım Konuları\tF1", IDM_HELP_CONTENTS + MENUITEM "&İçindekiler\tF1", IDM_HELP_CONTENTS MENUITEM "&Hakkında", IDM_HELP_ABOUT END END diff --git a/reactos/base/applications/games/solitaire/rsrc.rc b/reactos/base/applications/games/solitaire/rsrc.rc index 2ed6826c84e..b2c8779d14e 100644 --- a/reactos/base/applications/games/solitaire/rsrc.rc +++ b/reactos/base/applications/games/solitaire/rsrc.rc @@ -78,6 +78,9 @@ IDI_SOLITAIRE ICON "solitaire.ico" #ifdef LANGUAGE_SK_SK #include "lang/sk-SK.rc" #endif +#ifdef LANGUAGE_SQ_AL + #include "lang/sq-AL.rc" +#endif #ifdef LANGUAGE_SV_SE #include "lang/sv-SE.rc" #endif @@ -87,9 +90,6 @@ IDI_SOLITAIRE ICON "solitaire.ico" #ifdef LANGUAGE_TR_TR #include "lang/tr-TR.rc" #endif -#ifdef LANGUAGE_SQ_AL - #include "lang/sq-AL.rc" -#endif #ifdef LANGUAGE_UK_UA #include "lang/uk-UA.rc" #endif diff --git a/reactos/base/applications/games/spider/lang/tr-TR.rc b/reactos/base/applications/games/spider/lang/tr-TR.rc index 2f501624c41..515d791e30a 100644 --- a/reactos/base/applications/games/spider/lang/tr-TR.rc +++ b/reactos/base/applications/games/spider/lang/tr-TR.rc @@ -11,7 +11,7 @@ LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT /* Dialogs */ IDD_CARDBACK DIALOGEX 6, 6, 186, 104 -CAPTION "Deste Seç" +CAPTION "Kâğıt Arkalığı Seçme" FONT 8, "MS Shell Dlg" STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT BEGIN @@ -49,9 +49,9 @@ STRINGTABLE BEGIN IDS_SPI_NAME "Örümcek Solitaire" IDS_SPI_ABOUT "Örümcek Solitaire, Gregor Schneider eliyle yapılmıştır.\n\nCardLib sürümü: 1.0" - IDS_SPI_QUIT "Bu oyundan çıkmak ister misiniz?" + IDS_SPI_QUIT "Bu oyundan çıkılsın mı?" IDS_SPI_WIN "Tebrikler, kazandınız!" - IDS_SPI_DEAL "Tekrar dağıtılsın mı?" + IDS_SPI_DEAL "Yine dağıtılsın mı?" END /* Menus */ @@ -68,7 +68,7 @@ BEGIN END POPUP "&Yardım" BEGIN - MENUITEM "&Yardım Konuları\tF1", IDM_HELP_CONTENTS + MENUITEM "&İçindekiler\tF1", IDM_HELP_CONTENTS MENUITEM "&Hakkında", IDM_HELP_ABOUT END END diff --git a/reactos/base/applications/games/spider/rsrc.rc b/reactos/base/applications/games/spider/rsrc.rc index ffe6ea7a272..b7b08e2c216 100644 --- a/reactos/base/applications/games/spider/rsrc.rc +++ b/reactos/base/applications/games/spider/rsrc.rc @@ -57,15 +57,15 @@ IDI_SPIDER ICON "spider.ico" #ifdef LANGUAGE_SK_SK #include "lang/sk-SK.rc" #endif +#ifdef LANGUAGE_SQ_AL + #include "lang/sq-AL.rc" +#endif #ifdef LANGUAGE_SV_SE #include "lang/sv-SE.rc" #endif #ifdef LANGUAGE_TR_TR #include "lang/tr-TR.rc" #endif -#ifdef LANGUAGE_SQ_AL - #include "lang/sq-AL.rc" -#endif #ifdef LANGUAGE_UK_UA #include "lang/uk-UA.rc" #endif diff --git a/reactos/base/applications/games/winmine/lang/tr-TR.rc b/reactos/base/applications/games/winmine/lang/tr-TR.rc index bea9f4fd2a9..b75af37a7c6 100644 --- a/reactos/base/applications/games/winmine/lang/tr-TR.rc +++ b/reactos/base/applications/games/winmine/lang/tr-TR.rc @@ -5,22 +5,22 @@ LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT STRINGTABLE BEGIN IDS_APPNAME "Mayın Tarlası" - IDS_NOBODY "Hiç kimse" - IDS_ABOUT "Bu oyun, Joshua Thielen eliyle, 2000 yılında yapılmıştır." + IDS_NOBODY "Hiç Kimse" + IDS_ABOUT "Telif Hakkı: 2000 - Joshua Thielen" END MENU_WINEMINE MENU BEGIN - POPUP "&Oyun" + POPUP "&Seçenekler" BEGIN MENUITEM "&Yeni Oyun\tF2", IDM_NEW MENUITEM SEPARATOR - MENUITEM "İ&mleme", IDM_MARKQ + MENUITEM "&Soru İmiyle İmleme", IDM_MARKQ MENUITEM SEPARATOR - MENUITEM "&Başlangıç", IDM_BEGINNER - MENUITEM "&Orta", IDM_ADVANCED - MENUITEM "&İleri", IDM_EXPERT - MENUITEM "&Değişik...", IDM_CUSTOM + MENUITEM "&Acemî", IDM_BEGINNER + MENUITEM "&Gelişmiş", IDM_ADVANCED + MENUITEM "&Usta", IDM_EXPERT + MENUITEM "&Husûsî...", IDM_CUSTOM MENUITEM SEPARATOR MENUITEM "&Çıkış\tAlt+X", IDM_EXIT END @@ -37,9 +37,9 @@ CAPTION "En Kısa Süreler" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "En Kısa Süreler", -1, 10, 10, 140, 45 - LTEXT "Başlangıç", -1, 20, 20, 40, 8 - LTEXT "Orta", -1, 20, 30, 40, 8 - LTEXT "İleri", -1, 20, 40, 40, 8 + LTEXT "Acemî", -1, 20, 20, 40, 8 + LTEXT "Gelişmiş", -1, 20, 30, 40, 8 + LTEXT "Usta", -1, 20, 40, 40, 8 LTEXT "999", IDC_TIME1, 70, 20, 15, 8 LTEXT "999", IDC_TIME2, 70, 30, 15, 8 LTEXT "999", IDC_TIME3, 70, 40, 15, 8 @@ -54,14 +54,14 @@ STYLE DS_MODALFRAME | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_POPUP | DS_SHELL CAPTION "Tebrikler!" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Adınızı Giriniz:", -1, 10, 10, 150, 10 + LTEXT "Adınızı giriniz.", -1, 10, 10, 150, 10 EDITTEXT IDC_EDITNAME, 25, 20, 110, 12 DEFPUSHBUTTON "Tamam", IDOK, 60, 40, 40, 15 END DLG_CUSTOM DIALOGEX 0, 0, 100, 100 STYLE DS_MODALFRAME | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_POPUP | DS_SHELLFONT -CAPTION "Değişik" +CAPTION "Husûsî" FONT 8, "MS Shell Dlg" BEGIN LTEXT "&Yataç Sayısı:", -1, 5, 5, 30, 10 diff --git a/reactos/base/applications/games/winmine/rsrc.rc b/reactos/base/applications/games/winmine/rsrc.rc index 76cbfeb387c..2c8be76accd 100644 --- a/reactos/base/applications/games/winmine/rsrc.rc +++ b/reactos/base/applications/games/winmine/rsrc.rc @@ -111,15 +111,15 @@ MINES BITMAP "rc/mines.bmp" #ifdef LANGUAGE_SL_SI #include "lang/sl-SI.rc" #endif +#ifdef LANGUAGE_SQ_AL + #include "lang/sq-AL.rc" +#endif #ifdef LANGUAGE_SV_SE #include "lang/sv-SE.rc" #endif #ifdef LANGUAGE_TR_TR #include "lang/tr-TR.rc" #endif -#ifdef LANGUAGE_SQ_AL - #include "lang/sq-AL.rc" -#endif #ifdef LANGUAGE_UK_UA #include "lang/uk-UA.rc" #endif diff --git a/reactos/base/applications/magnify/lang/tr-TR.rc b/reactos/base/applications/magnify/lang/tr-TR.rc index 6447beda58e..3bfd90af38f 100644 --- a/reactos/base/applications/magnify/lang/tr-TR.rc +++ b/reactos/base/applications/magnify/lang/tr-TR.rc @@ -10,7 +10,7 @@ LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT IDC_MAGNIFIER MENU BEGIN - POPUP "&Seçke" + POPUP "&Kütük" BEGIN MENUITEM "&Çıkış", IDM_EXIT MENUITEM "&Seçenekler...", IDM_OPTIONS @@ -53,7 +53,7 @@ BEGIN BS_AUTOCHECKBOX | WS_TABSTOP, 18, 54, 114, 10 CONTROL "&Metin Düzenlemesini İzle", IDC_FOLLOWTEXTEDITINGCHECK, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 18, 66, 114, 10 - CONTROL "&Renkleri Ters Çevir", IDC_INVERTCOLORSCHECK, "Button", + CONTROL "&Renkleri Evir", IDC_INVERTCOLORSCHECK, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 18, 102, 114, 10 CONTROL "&Simge Durumunda Başlat", IDC_STARTMINIMIZEDCHECK, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 18, 114, 114, 10 @@ -68,8 +68,8 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Tamam", IDOK, 193, 76, 50, 14 ICON IDI_ICON, IDC_STATIC, 7, 17, 20, 20 - LTEXT "Büyüteç, hafif görme engelli kullanıcıların en az çaba harcamaları için tasarlanmıştır. Görme engelli bir çok kullanıcı, günlük kullanım için bu aracı kullanmaya gereksinim duyacaktır.", IDC_STATIC, 36, 7, 207, 33 - CONTROL "Bunu bir daha gösterme.", IDC_SHOWWARNINGCHECK, "Button", + LTEXT "Büyüteç, yeğni görme bozukluğu olan kullanıcılara en yüksek düzeydeki işlevliliği sağlamak için tasarlanmıştır. Görme bozukluğu olan birçok kullanıcı, günlük kullanım için yüksek işlevlikli bir büyütme aracına gereksinim duyacaktır.", IDC_STATIC, 36, 7, 207, 33 + CONTROL "Bu iletiyi bir daha gösterme.", IDC_SHOWWARNINGCHECK, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 43, 80, 137, 10 END diff --git a/reactos/base/applications/magnify/magnify.rc b/reactos/base/applications/magnify/magnify.rc index 2ab65781b1d..8d59c35104a 100644 --- a/reactos/base/applications/magnify/magnify.rc +++ b/reactos/base/applications/magnify/magnify.rc @@ -60,15 +60,15 @@ IDI_ICON ICON "res/magnify.ico" #ifdef LANGUAGE_SK_SK #include "lang/sk-SK.rc" #endif +#ifdef LANGUAGE_SQ_AL + #include "lang/sq-AL.rc" +#endif #ifdef LANGUAGE_SV_SE #include "lang/sv-SE.rc" #endif #ifdef LANGUAGE_TR_TR #include "lang/tr-TR.rc" #endif -#ifdef LANGUAGE_SQ_AL - #include "lang/sq-AL.rc" -#endif #ifdef LANGUAGE_UK_UA #include "lang/uk-UA.rc" #endif diff --git a/reactos/base/applications/msconfig/lang/tr-TR.rc b/reactos/base/applications/msconfig/lang/tr-TR.rc index 09373fe9444..7d5cd240e18 100644 --- a/reactos/base/applications/msconfig/lang/tr-TR.rc +++ b/reactos/base/applications/msconfig/lang/tr-TR.rc @@ -22,7 +22,7 @@ BEGIN CONTROL "List3", IDC_STARTUP_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 2, 1, 360, 148 PUSHBUTTON "&Hepsini Etkinleştir", IDC_BTN_STARTUP_ACTIVATE, 223, 155, 66, 14 - PUSHBUTTON "H&epsini Devre Dışı Bırak", IDC_BTN_STARTUP_DEACTIVATE, 295, 155, 66, 14 + PUSHBUTTON "H&epsini Edilginleştir", IDC_BTN_STARTUP_DEACTIVATE, 295, 155, 66, 14 END IDD_SYSTEM_PAGE DIALOGEX 0, 0, 362, 175 @@ -35,12 +35,12 @@ BEGIN PUSHBUTTON "B&ir Yukarı Taşı", IDC_BTN_SYSTEM_UP, 290, 5, 66, 14 PUSHBUTTON "Bi&r Aşağı Taşı", IDC_BTN_SYSTEM_DOWN, 290, 25, 66, 14 PUSHBUTTON "E&tkinleştir", IDC_BTN_SYSTEM_ENABLE, 290, 50, 66, 14 - PUSHBUTTON "&Devre Dışı Bırak", IDC_BTN_SYSTEM_DISABLE, 290, 70, 66, 14 + PUSHBUTTON "E&dilginleştir", IDC_BTN_SYSTEM_DISABLE, 290, 70, 66, 14 PUSHBUTTON "&Ara", IDC_BTN_SYSTEM_FIND, 290, 95, 66, 14 - PUSHBUTTON "Ye&ni", IDC_BTN_SYSTEM_NEW, 290, 115, 66, 14 + PUSHBUTTON "&Yeni", IDC_BTN_SYSTEM_NEW, 290, 115, 66, 14 PUSHBUTTON "De&ğiştir", IDC_BTN_SYSTEM_EDIT, 290, 135, 66, 14 PUSHBUTTON "&Hepsini Etkinleştir", IDC_BTN_SYSTEM_ACTIVATE, 123, 155, 66, 14 - PUSHBUTTON "H&epsini Devre Dışı Bırak", IDC_BTN_SYSTEM_DEACTIVATE, 195, 155, 66, 14 + PUSHBUTTON "H&epsini Edilginleştir", IDC_BTN_SYSTEM_DEACTIVATE, 195, 155, 66, 14 END IDD_TOOLS_PAGE DIALOGEX 0, 0, 362, 175 @@ -60,7 +60,7 @@ BEGIN CONTROL "List1", IDC_SERVICES_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 2, 1, 360, 148 PUSHBUTTON "&Hepsini Etkinleştir", IDC_BTN_SERVICES_ACTIVATE, 223, 155, 66, 14 - PUSHBUTTON "H&epsini Devre Dışı Bırak", IDC_BTN_SERVICES_DEACTIVATE, 295, 155, 66, 14 + PUSHBUTTON "H&epsini Edilginleştir", IDC_BTN_SERVICES_DEACTIVATE, 295, 155, 66, 14 END IDD_GENERAL_PAGE DIALOGEX 0, 0, 362, 175 diff --git a/reactos/base/applications/mscutils/devmgmt/lang/tr-TR.rc b/reactos/base/applications/mscutils/devmgmt/lang/tr-TR.rc index 23d3c64a80c..33f09cc9783 100644 --- a/reactos/base/applications/mscutils/devmgmt/lang/tr-TR.rc +++ b/reactos/base/applications/mscutils/devmgmt/lang/tr-TR.rc @@ -55,7 +55,7 @@ END STRINGTABLE BEGIN - IDS_LICENSE "ÖNEMLİ: Aşağıdaki metin, özgün metnin resmî olmayan çevirisidir. Çeviri metniyle özgün metin arasında ayrım olabilir. Özgün metin, çeviri metninin altındadır.\r\n\r\n***\r\n\r\nBu yazılım özgürdür, yâni bu yazılımı Özgür Yazılım Vakfı'nın yayınladığı GNU Umûmî Kamu Ruhsatı'nın 2. sürümü veyâ daha sonraki sürümleri altında yeniden dağıtabilir veyâ değiştirebilirsiniz.\r\n\r\nBu yazılım, kullanışlı olabileceği beklentisiyle dağıtılmıştır ancak bilhassa SATILABİLİRLİK ve BELİRLİ BİR AMACA UYGUNLUK açısından olmak üzere bu yazılımın HİÇBİR GÜVENCESİ YOKTUR. Daha çok bilgi için GNU Umûmî Kamu Ruhsatı'na bakınız.\r\n\r\nBu yazılımla birlikte GNU Umûmî Kamu Ruhsatı'nın bir sûretine de iye olmanız gerekir, eğer yoksa Özgür Yazılım Vakfı A.Ş.'ne (51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ABD) yazınız.\r\n\r\n***\r\n\r\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + IDS_LICENSE "ÖNEMLİ: Aşağıdaki metin, özgün metnin resmî olmayan çevirisidir. Çeviri metniyle özgün metin arasında ayrım olabilir. Özgün metin, çeviri metninin altındadır.\r\n\r\n***\r\n\r\nBu yazılım özgür yazılımdır; bu yazılımı, Özgür Yazılım Vakfı'nın yayımladığı GNU Umûmî Kamu Ruhsatı'nın, 2. sürümünün ya da daha sonraki herhangi bir sürümünün (Orası size bağlı.) koşulları altında yeniden dağıtabilir veyâ değiştirebilirsiniz.\r\n\r\nBu yazılım, kullanışlı olabileceği beklentisiyle dağıtılmıştır ancak bu yazılımın HİÇBİR GÜVENCESİ YOKTUR, SATILABİLİRLİĞİN ve BELİRLİ BİR AMACA UYGUNLUĞUN demek istenilen garantisi bile. Daha çok bilgi için GNU Umûmî Kamu Ruhsatı'na bakınız.\r\n\r\nBu yazılımla birlikte GNU Umûmî Kamu Ruhsatı'nın bir sûretini almış olmalısınız, eğer yoksa Özgür Yazılım Vakfı AŞ'ye (51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ABD) yazınız.\r\n\r\n***\r\n\r\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." END STRINGTABLE diff --git a/reactos/base/applications/mscutils/devmgmt_new/lang/tr-TR.rc b/reactos/base/applications/mscutils/devmgmt_new/lang/tr-TR.rc index d693fa20529..b56b11ce701 100644 --- a/reactos/base/applications/mscutils/devmgmt_new/lang/tr-TR.rc +++ b/reactos/base/applications/mscutils/devmgmt_new/lang/tr-TR.rc @@ -48,7 +48,7 @@ END STRINGTABLE BEGIN - IDS_LICENSE "ÖNEMLİ: Aşağıdaki metin, özgün metnin resmî olmayan çevirisidir. Çeviri metniyle özgün metin arasında ayrım olabilir. Özgün metin, çeviri metninin altındadır.\r\n\r\n***\r\n\r\nBu yazılım özgürdür, yâni bu yazılımı Özgür Yazılım Vakfı'nın yayınladığı GNU Umûmî Kamu Ruhsatı'nın 2. sürümü veyâ daha sonraki sürümleri altında yeniden dağıtabilir veyâ değiştirebilirsiniz.\r\n\r\nBu yazılım, kullanışlı olabileceği beklentisiyle dağıtılmıştır ancak bilhassa SATILABİLİRLİK ve BELİRLİ BİR AMACA UYGUNLUK açısından olmak üzere bu yazılımın HİÇBİR GÜVENCESİ YOKTUR. Daha çok bilgi için GNU Umûmî Kamu Ruhsatı'na bakınız.\r\n\r\nBu yazılımla birlikte GNU Umûmî Kamu Ruhsatı'nın bir sûretine de iye olmanız gerekir, eğer yoksa Özgür Yazılım Vakfı A.Ş.'ne (51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ABD) yazınız.\r\n\r\n***\r\n\r\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + IDS_LICENSE "ÖNEMLİ: Aşağıdaki metin, özgün metnin resmî olmayan çevirisidir. Çeviri metniyle özgün metin arasında ayrım olabilir. Özgün metin, çeviri metninin altındadır.\r\n\r\n***\r\n\r\nBu yazılım özgür yazılımdır; bu yazılımı, Özgür Yazılım Vakfı'nın yayımladığı GNU Umûmî Kamu Ruhsatı'nın, 2. sürümünün ya da daha sonraki herhangi bir sürümünün (Orası size bağlı.) koşulları altında yeniden dağıtabilir veyâ değiştirebilirsiniz.\r\n\r\nBu yazılım, kullanışlı olabileceği beklentisiyle dağıtılmıştır ancak bu yazılımın HİÇBİR GÜVENCESİ YOKTUR, SATILABİLİRLİĞİN ve BELİRLİ BİR AMACA UYGUNLUĞUN demek istenilen garantisi bile. Daha çok bilgi için GNU Umûmî Kamu Ruhsatı'na bakınız.\r\n\r\nBu yazılımla birlikte GNU Umûmî Kamu Ruhsatı'nın bir sûretini almış olmalısınız, eğer yoksa Özgür Yazılım Vakfı AŞ'ye (51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ABD) yazınız.\r\n\r\n***\r\n\r\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." END STRINGTABLE diff --git a/reactos/base/applications/mscutils/eventvwr/lang/tr-TR.rc b/reactos/base/applications/mscutils/eventvwr/lang/tr-TR.rc index be61b7c5014..39fbbdad68d 100644 --- a/reactos/base/applications/mscutils/eventvwr/lang/tr-TR.rc +++ b/reactos/base/applications/mscutils/eventvwr/lang/tr-TR.rc @@ -19,7 +19,7 @@ BEGIN MENUITEM "&Seçenekler", ID_OPTIONS POPUP "&Yardım" BEGIN - MENUITEM "&Yardım Konuları", IDM_HELP + MENUITEM "&Yardım", IDM_HELP MENUITEM SEPARATOR MENUITEM "&Hakkında", IDM_ABOUT END diff --git a/reactos/base/applications/mscutils/servman/lang/tr-TR.rc b/reactos/base/applications/mscutils/servman/lang/tr-TR.rc index ccff2c9b591..59c53842235 100644 --- a/reactos/base/applications/mscutils/servman/lang/tr-TR.rc +++ b/reactos/base/applications/mscutils/servman/lang/tr-TR.rc @@ -39,7 +39,7 @@ BEGIN END POPUP "&Yardım" BEGIN - MENUITEM "&Yardım Konuları", ID_HELP + MENUITEM "&Yardım", ID_HELP MENUITEM "&Hakkında", ID_ABOUT END END @@ -203,7 +203,7 @@ BEGIN IDS_SERVICES_STOPPED "Durdu" IDS_SERVICES_AUTO "Kendiliğinden" IDS_SERVICES_MAN "Elle" - IDS_SERVICES_DIS "Devre Dışı" + IDS_SERVICES_DIS "Edilgin" END STRINGTABLE @@ -211,7 +211,7 @@ BEGIN IDS_NUM_SERVICES "Hizmet Sayısı: %d" IDS_STOP_DEPENDS "%s durduğunda, bu hizmetler de durur:" IDS_NO_DEPENDS "" - IDS_LICENSE "ÖNEMLİ: Aşağıdaki metin, özgün metnin resmî olmayan çevirisidir. Çeviri metniyle özgün metin arasında ayrım olabilir. Özgün metin, çeviri metninin altındadır.\r\n\r\n***\r\n\r\nBu yazılım özgürdür, yâni bu yazılımı Özgür Yazılım Vakfı'nın yayınladığı GNU Umûmî Kamu Ruhsatı'nın 2. sürümü veyâ daha sonraki sürümleri altında yeniden dağıtabilir veyâ değiştirebilirsiniz.\r\n\r\nBu yazılım, kullanışlı olabileceği beklentisiyle dağıtılmıştır ancak bilhassa SATILABİLİRLİK ve BELİRLİ BİR AMACA UYGUNLUK açısından olmak üzere bu yazılımın HİÇBİR GÜVENCESİ YOKTUR. Daha çok bilgi için GNU Umûmî Kamu Ruhsatı'na bakınız.\r\n\r\nBu yazılımla birlikte GNU Umûmî Kamu Ruhsatı'nın bir sûretine de iye olmanız gerekir, eğer yoksa Özgür Yazılım Vakfı A.Ş.'ne (51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ABD) yazınız.\r\n\r\n***\r\n\r\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + IDS_LICENSE "ÖNEMLİ: Aşağıdaki metin, özgün metnin resmî olmayan çevirisidir. Çeviri metniyle özgün metin arasında ayrım olabilir. Özgün metin, çeviri metninin altındadır.\r\n\r\n***\r\n\r\nBu yazılım özgür yazılımdır; bu yazılımı, Özgür Yazılım Vakfı'nın yayımladığı GNU Umûmî Kamu Ruhsatı'nın, 2. sürümünün ya da daha sonraki herhangi bir sürümünün (Orası size bağlı.) koşulları altında yeniden dağıtabilir veyâ değiştirebilirsiniz.\r\n\r\nBu yazılım, kullanışlı olabileceği beklentisiyle dağıtılmıştır ancak bu yazılımın HİÇBİR GÜVENCESİ YOKTUR, SATILABİLİRLİĞİN ve BELİRLİ BİR AMACA UYGUNLUĞUN demek istenilen garantisi bile. Daha çok bilgi için GNU Umûmî Kamu Ruhsatı'na bakınız.\r\n\r\nBu yazılımla birlikte GNU Umûmî Kamu Ruhsatı'nın bir sûretini almış olmalısınız, eğer yoksa Özgür Yazılım Vakfı AŞ'ye (51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ABD) yazınız.\r\n\r\n***\r\n\r\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." END STRINGTABLE diff --git a/reactos/base/applications/mspaint/lang/tr-TR.rc b/reactos/base/applications/mspaint/lang/tr-TR.rc index ad68b8a3ec0..16fdaeb6aab 100644 --- a/reactos/base/applications/mspaint/lang/tr-TR.rc +++ b/reactos/base/applications/mspaint/lang/tr-TR.rc @@ -186,7 +186,7 @@ BEGIN IDS_PROGRAMNAME "Görüntü Düzenleyicisi" IDS_WINDOWTITLE "%s - Görüntü Düzenleyicisi" IDS_INFOTITLE "Görüntü Düzenleyicisi" - IDS_INFOTEXT "Görüntü Düzenleyicisi, GNU Kısıtlı Umûmî Kamu Ruhsatı'nın (LGPL). sürümüyle ruhsatlıdır. (bkz: www.gnu.org)" + IDS_INFOTEXT "Görüntü Düzenleyicisi, GNU Kısıtlı Umûmî Kamu Ruhsatı'yla (LGPL'yle) ruhsatlıdır. (bkz: www.gnu.org)" IDS_SAVEPROMPTTEXT "%s için yapılan değişiklikler kaydedilsin mi?" IDS_DEFAULTFILENAME "Adsız.bmp" IDS_MINIATURETITLE "Küçüğü" diff --git a/reactos/base/applications/notepad/lang/tr-TR.rc b/reactos/base/applications/notepad/lang/tr-TR.rc index 38671e3a802..479194a757d 100644 --- a/reactos/base/applications/notepad/lang/tr-TR.rc +++ b/reactos/base/applications/notepad/lang/tr-TR.rc @@ -50,12 +50,12 @@ BEGIN MENUITEM "G&it...\tCtrl+G", CMD_GOTO MENUITEM SEPARATOR MENUITEM "&Tümünü Seç\tCtrl+A", CMD_SELECT_ALL - MENUITEM "&Şimdiki Zamanı Koy\tF5", CMD_TIME_DATE + MENUITEM "&Şimdiki Zamânı Koy\tF5", CMD_TIME_DATE END POPUP "&Biçim" BEGIN - MENUITEM "&Yataç Kaydır", CMD_WRAP - MENUITEM "Y&azı Türü...", CMD_FONT + MENUITEM "&Uzun Yataçları Kaydır", CMD_WRAP + MENUITEM "&Yazı Türü...", CMD_FONT END POPUP "&Görünüm" BEGIN @@ -63,9 +63,9 @@ BEGIN END POPUP "&Yardım" BEGIN - MENUITEM "&Yardım Konuları", CMD_HELP_CONTENTS - MENUITEM "Y&ardımda Ara", CMD_HELP_SEARCH - MENUITEM "Ya&rdım İçin Yardım", CMD_HELP_ON_HELP + MENUITEM "&İçindekiler", CMD_HELP_CONTENTS + MENUITEM "&Ara", CMD_HELP_SEARCH + MENUITEM "&Yardım İçin Yardım", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&Bilgi", CMD_ABOUT MENUITEM "&Hakkında", CMD_ABOUT_WINE @@ -78,22 +78,22 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU FONT 8, "MS Shell Dlg" CAPTION "Sayfa Yapısı" BEGIN - LTEXT "Üst Bilgi:", 0x140, 10, 07, 40, 15 + LTEXT "&Üst Bilgi:", 0x140, 10, 07, 40, 15 EDITTEXT 0x141, 60, 05, 110, 12, WS_BORDER | WS_TABSTOP - LTEXT "Alt Bilgi:", 0x142, 10, 24, 40, 15 + LTEXT "&Alt Bilgi:", 0x142, 10, 24, 40, 15 EDITTEXT 0x143, 60, 22, 110, 12, WS_BORDER | WS_TABSTOP GROUPBOX "Kıyı Payı:", 0x144, 10, 43, 160, 45 - LTEXT "Sol:", 0x145, 20, 55, 30, 10, WS_CHILD + LTEXT "&Sol:", 0x145, 20, 55, 30, 10, WS_CHILD EDITTEXT /*STRING_PAGESETUP_LEFTVALUE,*/ 0x147, 50, 55, 35, 11, WS_CHILD | WS_BORDER | WS_TABSTOP - LTEXT "Üst:", 0x148, 20, 73, 30, 10, WS_CHILD + LTEXT "Üs&t:", 0x148, 20, 73, 30, 10, WS_CHILD EDITTEXT /*STRING_PAGESETUP_TOPVALUE,*/ 0x14A, 50, 73, 35, 11, WS_CHILD | WS_BORDER | WS_TABSTOP - LTEXT "Sağ:", 0x14B, 100, 55, 30, 10, WS_CHILD + LTEXT "Sa&ğ:", 0x14B, 100, 55, 30, 10, WS_CHILD EDITTEXT /*STRING_PAGESETUP_RIGHTVALUE,*/ 0x14D, 130, 55, 35, 11, WS_CHILD | WS_BORDER | WS_TABSTOP - LTEXT "Alt:", 0x14E, 100, 73, 30, 10, WS_CHILD + LTEXT "A<:", 0x14E, 100, 73, 30, 10, WS_CHILD EDITTEXT /*STRING_PAGESETUP_BOTTOMVALUE,*/ 0x150, 130, 73, 35, 11, WS_CHILD | WS_BORDER | WS_TABSTOP DEFPUSHBUTTON "Tamam", IDOK, 180, 3, 40, 15, WS_TABSTOP PUSHBUTTON "İptal", IDCANCEL, 180, 21, 40, 15, WS_TABSTOP - PUSHBUTTON "Yardım", IDHELP, 180, 39, 40, 15, WS_TABSTOP + PUSHBUTTON "&Yardım", IDHELP, 180, 39, 40, 15, WS_TABSTOP END /* Dialog 'Encoding' */ @@ -125,16 +125,16 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "Metin Düzenleyicisi Hakkında" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "Metin Düzenleyicisi - Sürüm: 1.0\r\nTelif Hakları: 1997,98 Marcel Baur (mbaur@g26.ethz.ch)\r\n 2000 Mike McCormack (Mike_McCormack@looksmart.com.au)\r\n 2002 Sylvain Petreolle (spetreolle@yahoo.fr)\r\n 2002 Andriy Palamarchuk\r\n", -1, "Static", SS_LEFTNOWORDWRAP | WS_GROUP, 46, 7, 232, 39 + CONTROL "Metin Düzenleyicisi - Sürüm: 1.0\r\nTelif Hakları:\r\n1997,98 - Marcel Baur (mbaur@g26.ethz.ch)\r\n2000 - Mike McCormack (Mike_McCormack@looksmart.com.au)\r\n2002 - Sylvain Petreolle (spetreolle@yahoo.fr)\r\n2002 - Andriy Palamarchuk\r\n", -1, "Static", SS_LEFTNOWORDWRAP | WS_GROUP, 46, 7, 232, 39 CONTROL " ", -1, "Static", 0x50000000, 8, 48, 272, 11 - DEFPUSHBUTTON "Tamam", IDOK, 114, 149, 44, 15, WS_GROUP + DEFPUSHBUTTON "Kapat", IDOK, 114, 149, 44, 15, WS_GROUP ICON IDI_NPICON, -1, 12, 9, 20, 30 EDITTEXT IDC_LICENSE, 8, 64, 272, 81, ES_MULTILINE | ES_READONLY | WS_VSCROLL END STRINGTABLE BEGIN - STRING_LICENSE "ÖNEMLİ: Aşağıdaki metin, özgün metnin resmî olmayan çevirisidir. Çeviri metniyle özgün metin arasında ayrım olabilir. Özgün metin, çeviri metninin altındadır.\r\n\r\n***\r\n\r\nBu yazılım özgürdür, yâni bu yazılımı Özgür Yazılım Vakfı'nın yayınladığı GNU Umûmî Kamu Ruhsatı'nın 2. sürümü veyâ daha sonraki sürümleri altında yeniden dağıtabilir veyâ değiştirebilirsiniz.\r\n\r\nBu yazılım, kullanışlı olabileceği beklentisiyle dağıtılmıştır ancak bilhassa SATILABİLİRLİK ve BELİRLİ BİR AMACA UYGUNLUK açısından olmak üzere bu yazılımın HİÇBİR GÜVENCESİ YOKTUR. Daha çok bilgi için GNU Umûmî Kamu Ruhsatı'na bakınız.\r\n\r\nBu yazılımla birlikte GNU Umûmî Kamu Ruhsatı'nın bir sûretine de iye olmanız gerekir, eğer yoksa Özgür Yazılım Vakfı A.Ş.'ne (51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ABD) yazınız.\r\n\r\n***\r\n\r\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + STRING_LICENSE "ÖNEMLİ: Aşağıdaki metin, özgün metnin resmî olmayan çevirisidir. Çeviri metniyle özgün metin arasında ayrım olabilir. Özgün metin, çeviri metninin altındadır.\r\n\r\n***\r\n\r\nBu yazılım özgür yazılımdır; bu yazılımı, Özgür Yazılım Vakfı'nın yayımladığı GNU Umûmî Kamu Ruhsatı'nın, 2. sürümünün ya da daha sonraki herhangi bir sürümünün (Orası size bağlı.) koşulları altında yeniden dağıtabilir veyâ değiştirebilirsiniz.\r\n\r\nBu yazılım, kullanışlı olabileceği beklentisiyle dağıtılmıştır ancak bu yazılımın HİÇBİR GÜVENCESİ YOKTUR, SATILABİLİRLİĞİN ve BELİRLİ BİR AMACA UYGUNLUĞUN demek istenilen garantisi bile. Daha çok bilgi için GNU Umûmî Kamu Ruhsatı'na bakınız.\r\n\r\nBu yazılımla birlikte GNU Umûmî Kamu Ruhsatı'nın bir sûretini almış olmalısınız, eğer yoksa Özgür Yazılım Vakfı AŞ'ye (51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ABD) yazınız.\r\n\r\n***\r\n\r\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." END STRINGTABLE @@ -152,18 +152,18 @@ BEGIN STRING_UNTITLED "Adsız" STRING_ALL_FILES "Tüm Kütükler (*.*)" STRING_TEXT_FILES_TXT "Metin Belgeleri (*.txt)" - STRING_TOOLARGE "%s kütüğü Metin Düzenleyicisi için çok büyük. Bu kütüğü düzenlemek için başka bir düzenleyici kullanınız." - STRING_NOTEXT "Hiçbir şey yazmadınız. Birşeyler yazıp yeniden deneyiniz." + STRING_TOOLARGE "%s kütüğü Metin Düzenleyicisi için çok büyük. Başka bir düzenleyici kullanınız." + STRING_NOTEXT "Hiçbir metin girmediniz. Birşeyler yazıp yeniden deneyiniz." STRING_DOESNOTEXIST "%s kütüğü yok. Yeni bir kütük oluşturmak ister misiniz?" - STRING_NOTSAVED "%s kütüğündeki metin değiştirilmiş. Değişiklikleri kaydetmek istiyor musunuz?" - STRING_NOTFOUND "%s kütüğü bulunamadı." - STRING_OUT_OF_MEMORY "Bu işlemi bitirmek için gereken bellek yetersiz. Kullanılabilen belleği arttırmak için bir veyâ daha çok uygulamadan çıkıp bu işlemi yeniden deneyiniz." - STRING_CANNOTFIND "%s kütüğü bulunamadı." + STRING_NOTSAVED "%s kütüğü değiştirilmiş. Değişiklikleri kaydetmek ister misiniz?" + STRING_NOTFOUND "%s bulunamadı." + STRING_OUT_OF_MEMORY "Bu işi bitirmek için bellek yetersiz. Kullanılabilen belleği arttırmak için bir ya da daha çok uygulama kapatınız." + STRING_CANNOTFIND "%s bulunamadı." STRING_ANSI "ANSI" - STRING_UNICODE "Evrenlik Düzgü" - STRING_UNICODE_BE "Evrenlik Düzgü (Büyük Sonlu)" + STRING_UNICODE "Evrenlik Kod" + STRING_UNICODE_BE "Evrenlik Kod (Büyük Sonlu)" STRING_UTF8 "UTF-8" - STRING_CRLF "Pencereler (CR + LF)" + STRING_CRLF "Windows (CR + LF)" STRING_LF "UNIX (LF)" STRING_CR "Mac (CR)" STRING_LINE_COLUMN "%d. Yataç, %d. Dikeç" diff --git a/reactos/base/applications/notepad/rsrc.rc b/reactos/base/applications/notepad/rsrc.rc index 0355409bc85..2c1b5b4278f 100644 --- a/reactos/base/applications/notepad/rsrc.rc +++ b/reactos/base/applications/notepad/rsrc.rc @@ -115,6 +115,9 @@ IDI_NPICON ICON "res/notepad.ico" #ifdef LANGUAGE_SL_SI #include "lang/sl-SI.rc" #endif +#ifdef LANGUAGE_SQ_AL + #include "lang/sq-AL.rc" +#endif #ifdef LANGUAGE_SV_SE #include "lang/sv-SE.rc" #endif @@ -124,9 +127,6 @@ IDI_NPICON ICON "res/notepad.ico" #ifdef LANGUAGE_TR_TR #include "lang/tr-TR.rc" #endif -#ifdef LANGUAGE_SQ_AL - #include "lang/sq-AL.rc" -#endif #ifdef LANGUAGE_ZH_CN #include "lang/zh-CN.rc" #endif diff --git a/reactos/base/applications/rapps/lang/tr-TR.rc b/reactos/base/applications/rapps/lang/tr-TR.rc index 97623391c34..71eb177d30b 100644 --- a/reactos/base/applications/rapps/lang/tr-TR.rc +++ b/reactos/base/applications/rapps/lang/tr-TR.rc @@ -24,7 +24,7 @@ BEGIN END POPUP "Y&ardım" BEGIN - MENUITEM "&Yardım Konuları", ID_HELP, GRAYED + MENUITEM "&Yardım", ID_HELP, GRAYED MENUITEM "&Hakkında", ID_ABOUT END END diff --git a/reactos/base/applications/regedit/lang/tr-TR.rc b/reactos/base/applications/regedit/lang/tr-TR.rc index 78f492c1f9c..6d480365bf0 100644 --- a/reactos/base/applications/regedit/lang/tr-TR.rc +++ b/reactos/base/applications/regedit/lang/tr-TR.rc @@ -357,7 +357,7 @@ BEGIN IDS_FLT_REGFILES_FLT "*.reg" IDS_FLT_HIVFILES "Yığın Dosyaları (*.*)" IDS_FLT_HIVFILES_FLT "*.*" - IDS_FLT_REGEDIT4 "Pencereler 9x ve Pencereler NT 4.0 Türündeki Değer Kütükleri (*.reg)" + IDS_FLT_REGEDIT4 "Windows 9x ve Windows NT 4.0 Türündeki Değer Kütükleri (*.reg)" IDS_FLT_REGEDIT4_FLT "*.reg" IDS_FLT_ALLFILES "Tüm Kütükler (*.*)" IDS_FLT_ALLFILES_FLT "*.*" diff --git a/reactos/base/applications/winhlp32/lang/Tr.rc b/reactos/base/applications/winhlp32/lang/Tr.rc index 32c2ba0d228..90aa19ebad2 100644 --- a/reactos/base/applications/winhlp32/lang/Tr.rc +++ b/reactos/base/applications/winhlp32/lang/Tr.rc @@ -57,7 +57,7 @@ MAIN_MENU MENU MENUITEM "&Dizge Renklerini Kullan", MNID_OPTS_SYSTEM_COLORS } POPUP "&Yardım" { - MENUITEM "&Yardım Konuları", MNID_HELP_HELPON + MENUITEM "&Yardım İçin Yardım", MNID_HELP_HELPON MENUITEM "H&er Zaman Üstte", MNID_HELP_HELPTOP MENUITEM SEPARATOR MENUITEM "&Hakkında", MNID_HELP_ABOUT diff --git a/reactos/base/applications/wordpad/lang/Tr.rc b/reactos/base/applications/wordpad/lang/Tr.rc index a627d381587..82915da531c 100644 --- a/reactos/base/applications/wordpad/lang/Tr.rc +++ b/reactos/base/applications/wordpad/lang/Tr.rc @@ -83,7 +83,7 @@ BEGIN MENUITEM "&Öğe İmi", ID_BULLET MENUITEM "&Paragraf...", ID_PARAFORMAT MENUITEM "&Sekme Durakları...", ID_TABSTOPS - POPUP "&Arkaplan" + POPUP "&Arka Plan" BEGIN MENUITEM "&Dizge Rengi\tCtrl+1", ID_BACK_1 MENUITEM "&Sarımtırak\tCtrl+2", ID_BACK_2 @@ -207,11 +207,11 @@ STRINGTABLE BEGIN STRING_ALL_FILES, "Tüm Kütükler (*.*)" STRING_TEXT_FILES_TXT, "Metin Belgeleri (*.txt)" - STRING_TEXT_FILES_UNICODE_TXT, "Evrenlik Düzgülü Metin Belgeleri (*.txt)" + STRING_TEXT_FILES_UNICODE_TXT, "Evrenlik Kodlu Metin Belgeleri (*.txt)" STRING_RICHTEXT_FILES_RTF, "Gelişmiş Metin Belgeleri (*.rtf)" STRING_NEWFILE_RICHTEXT, "Gelişmiş Metin Belgesi" STRING_NEWFILE_TXT, "Metin Belgesi" - STRING_NEWFILE_TXT_UNICODE, "Evrenlik Düzgülü Metin Belgesi" + STRING_NEWFILE_TXT_UNICODE, "Evrenlik Kodlu Metin Belgesi" STRING_PRINTER_FILES_PRN, "Yazıcı Kütükleri (*.PRN)" END diff --git a/reactos/boot/freeldr/fdebug/lang/tr-TR.rc b/reactos/boot/freeldr/fdebug/lang/tr-TR.rc index b2bfed1e108..7153091a68a 100644 --- a/reactos/boot/freeldr/fdebug/lang/tr-TR.rc +++ b/reactos/boot/freeldr/fdebug/lang/tr-TR.rc @@ -81,5 +81,5 @@ END STRINGTABLE BEGIN - IDS_LICENSE "ÖNEMLİ: Aşağıdaki metin, özgün metnin resmî olmayan çevirisidir. Çeviri metniyle özgün metin arasında ayrım olabilir. Özgün metin, çeviri metninin altındadır.\r\n\r\n***\r\n\r\nBu yazılım özgürdür, yâni bu yazılımı Özgür Yazılım Vakfı'nın yayınladığı GNU Umûmî Kamu Ruhsatı'nın 2. sürümü veyâ daha sonraki sürümleri altında yeniden dağıtabilir veyâ değiştirebilirsiniz.\r\n\r\nBu yazılım, kullanışlı olabileceği beklentisiyle dağıtılmıştır ancak bilhassa SATILABİLİRLİK ve BELİRLİ BİR AMACA UYGUNLUK açısından olmak üzere bu yazılımın HİÇBİR GÜVENCESİ YOKTUR. Daha çok bilgi için GNU Umûmî Kamu Ruhsatı'na bakınız.\r\n\r\nBu yazılımla birlikte GNU Umûmî Kamu Ruhsatı'nın bir sûretine de iye olmanız gerekir, eğer yoksa Özgür Yazılım Vakfı A.Ş.'ne (51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ABD) yazınız.\r\n\r\n***\r\n\r\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + IDS_LICENSE "ÖNEMLİ: Aşağıdaki metin, özgün metnin resmî olmayan çevirisidir. Çeviri metniyle özgün metin arasında ayrım olabilir. Özgün metin, çeviri metninin altındadır.\r\n\r\n***\r\n\r\nBu yazılım özgür yazılımdır; bu yazılımı, Özgür Yazılım Vakfı'nın yayımladığı GNU Umûmî Kamu Ruhsatı'nın, 2. sürümünün ya da daha sonraki herhangi bir sürümünün (Orası size bağlı.) koşulları altında yeniden dağıtabilir veyâ değiştirebilirsiniz.\r\n\r\nBu yazılım, kullanışlı olabileceği beklentisiyle dağıtılmıştır ancak bu yazılımın HİÇBİR GÜVENCESİ YOKTUR, SATILABİLİRLİĞİN ve BELİRLİ BİR AMACA UYGUNLUĞUN demek istenilen garantisi bile. Daha çok bilgi için GNU Umûmî Kamu Ruhsatı'na bakınız.\r\n\r\nBu yazılımla birlikte GNU Umûmî Kamu Ruhsatı'nın bir sûretini almış olmalısınız, eğer yoksa Özgür Yazılım Vakfı AŞ'ye (51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ABD) yazınız.\r\n\r\n***\r\n\r\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." END diff --git a/reactos/dll/cpl/desk/lang/tr-TR.rc b/reactos/dll/cpl/desk/lang/tr-TR.rc index 96c6d900492..d235f51c71f 100644 --- a/reactos/dll/cpl/desk/lang/tr-TR.rc +++ b/reactos/dll/cpl/desk/lang/tr-TR.rc @@ -4,7 +4,7 @@ LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT IDD_BACKGROUND DIALOGEX 0, 0, 246, 204 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Arkagörünüm" +CAPTION "Arka Plan" FONT 8, "MS Shell Dlg" BEGIN CONTROL "", IDC_BACKGROUND_PREVIEW, "Static", SS_OWNERDRAW, 70, 10, 105, 80, 0 @@ -245,7 +245,7 @@ BEGIN IDS_ELEMENT_14 "Edilgin Seçke Öğeleri" IDS_ELEMENT_15 "İleti" IDS_ELEMENT_16 "Kaydırma Çubukları Denetimleri" - IDS_ELEMENT_17 "Uygulama Arkagörünümü" + IDS_ELEMENT_17 "Uygulama Arka Planı" IDS_ELEMENT_18 "Küçük Başlık Çubuğu" IDS_ELEMENT_19 "Simge Aralığı (Yatay)" IDS_ELEMENT_20 "Simge Aralığı (Dikey)" diff --git a/reactos/dll/cpl/input/lang/tr-TR.rc b/reactos/dll/cpl/input/lang/tr-TR.rc index 4bb6bb6e37d..55c4375481d 100644 --- a/reactos/dll/cpl/input/lang/tr-TR.rc +++ b/reactos/dll/cpl/input/lang/tr-TR.rc @@ -136,7 +136,7 @@ BEGIN IDS_CANADIAN_FRENCH_LEGACY_LAYOUT "Kanada Fransızcası (Eski)" IDS_CANADIAN_MULTILINGUAL_STD_LAYOUT "Kanada Çok Dilli Ölçün" IDS_CANTONESE_PHONETIC_LAYOUT "Kanton Lehçesi Tam Seslik" - IDS_CHINESE_SIMPLIFIED_MSPINYINIME30_LAYOUT "Çince (Bayağılaştırılmış) - Mikroyazılım Pinyin IME 3.0" + IDS_CHINESE_SIMPLIFIED_MSPINYINIME30_LAYOUT "Çince (Bayağılaştırılmış) - Microsoft Pinyin IME 3.0" IDS_CHINESE_SIMPLIFIED_NEIMA_LAYOUT "Çince (Bayağılaştırılmış) - NeiMa" IDS_CHINESE_SIMPLIFIED_QUANPIN_LAYOUT "Çince (Bayağılaştırılmış) - KuanPin" IDS_CHINESE_SIMPLIFIED_SHUANGPIN_LAYOUT "Çince (Bayağılaştırılmış) - ŞuangPin" @@ -144,14 +144,14 @@ BEGIN IDS_CHINESE_SIMPLIFIED_ZHENGMA_LAYOUT "Çince (Bayağılaştırılmış) - ZengMa" IDS_CHINESE_TRADITIONAL_ALPHANUMERIC_LAYOUT "Çince (Geleneklik) - Hârflik ve Sayılık" IDS_CHINESE_TRADITIONAL_ARRAY_LAYOUT "Çince (Geleneklik) - Düzen" - IDS_CHINESE_TRADITIONAL_BIG5CODE_LAYOUT "Çince (Geleneklik) - Big5 Düzgüsü" + IDS_CHINESE_TRADITIONAL_BIG5CODE_LAYOUT "Çince (Geleneklik) - Big5 Kodu" IDS_CHINESE_TRADITIONAL_CHANGJIE_LAYOUT "Çince (Geleneklik) - ÇangJi" IDS_CHINESE_TRADITIONAL_DAYI_LAYOUT "Çince (Geleneklik) - DaYi" IDS_CHINESE_TRADITIONAL_NEWCHANGJIE_LAYOUT "Çince (Geleneklik) - Yeni ÇangJi" IDS_CHINESE_TRADITIONAL_NEWPHONETIC_LAYOUT "Çince (Geleneklik) - Yeni Tam Seslik" IDS_CHINESE_TRADITIONAL_PHONETIC_LAYOUT "Çince (Geleneklik) - Tam Seslik" IDS_CHINESE_TRADITIONAL_QUICK_LAYOUT "Çince (Geleneklik) - Çabuk" - IDS_CHINESE_TRADITIONAL_UNICODE_LAYOUT "Çince (Geleneklik) - Evrenlik Düzgülük" + IDS_CHINESE_TRADITIONAL_UNICODE_LAYOUT "Çince (Geleneklik) - Evrenlik Kodluk" IDS_CHINESE_TRADITIONAL_USKEYBOARD_LAYOUT "Çince (Geleneklik) - ABD Düğme Takımı" IDS_CROATIAN_LAYOUT "Hırvatça" IDS_CZECH_LAYOUT "Çekçe" diff --git a/reactos/dll/cpl/intl/lang/tr-TR.rc b/reactos/dll/cpl/intl/lang/tr-TR.rc index 22e3b256998..26b34ee69c5 100644 --- a/reactos/dll/cpl/intl/lang/tr-TR.rc +++ b/reactos/dll/cpl/intl/lang/tr-TR.rc @@ -47,11 +47,11 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Gelişmiş" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Evrenlik Düzgülü Olmayan Çizeylemler İçin Dil", -1, 5, 5, 234, 90 + GROUPBOX "Evrenlik Kodlu Olmayan Çizeylemler İçin Dil", -1, 5, 5, 234, 90 COMBOBOX IDC_LANGUAGE_COMBO, 14, 75, 217, 160, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT "Bu dizge ayârı, Evrenlik Düzgülü olmayan çizeylemlerin seçkelerinin ve iletişim kutularının kendi dillerinde görüntülenmesini etkinleştirir. Bu ayar, Evrenlik Düzgülü çizeylemleri etkilemez ve bu ayar, bu bilgisayardaki tüm kullanıcıları etkiler.", -1, 14, 18, 223, 33 - LTEXT "Kullanmak istediğiniz Evrenlik Düzgülü olmayan çizeylemlerin dil sürümlerini karşılaştırmak için bir dil seçiniz:", -1, 14, 55, 223, 18 - GROUPBOX "Düzgü Sayfası Dönüştürme Çizelgesi", -1, 5, 101, 234, 88 + LTEXT "Bu dizge ayârı, Evrenlik Kodlu olmayan çizeylemlerin seçkelerinin ve iletişim kutularının kendi dillerinde görüntülenmesini etkinleştirir. Bu ayar, Evrenlik Kodlu çizeylemleri etkilemez ve bu ayar, bu bilgisayardaki tüm kullanıcıları etkiler.", -1, 14, 18, 223, 33 + LTEXT "Kullanmak istediğiniz Evrenlik Kodlu olmayan çizeylemlerin dil sürümlerini karşılaştırmak için bir dil seçiniz:", -1, 14, 55, 223, 18 + GROUPBOX "Kod Sayfası Dönüştürme Çizelgesi", -1, 5, 101, 234, 88 CONTROL "", IDC_CONV_TABLES, "SysListView32", LVS_REPORT | LVS_SORTASCENDING | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP, 14, 114, 217, 70 GROUPBOX "Öntanımlı Kullanıcı Hesâbı Ayarları", -1, 5, 193, 234, 30 CHECKBOX "Bu Kullanıcının Tüm Ayarlarını Öntanımlı Olarak Ayarla", IDC_APPLY_CUR_USER_DEF_PROFILE, 12, 200, 220, 22, BS_MULTILINE @@ -200,8 +200,8 @@ BEGIN IDS_ERROR_SYMBOL_SEPARATE "Girilen kısa târih ayıracı yanlış simge(ler) içeriyor." IDS_ERROR_SYMBOL_FORMAT_SHORT "Girilen kısa târih biçimi yanlış simge(ler) içeriyor." IDS_ERROR_SYMBOL_FORMAT_LONG "Girilen uzun târih biçimi yanlış simge(ler) içeriyor." - IDS_ERROR_OEM_CODE_PAGE "OEM düzgü sayfasının okunmasında sorun var." - IDS_ERROR_ANSI_CODE_PAGE "ANSI düzgü sayfasının okunmasında sorun var." + IDS_ERROR_OEM_CODE_PAGE "OEM kod sayfasının okunmasında sorun var." + IDS_ERROR_ANSI_CODE_PAGE "ANSI kod sayfasının okunmasında sorun var." IDS_ERROR_INT_KEY_REG "HKCU\\Control Panel\\International dizininin açılmasında sorun var." IDS_ERROR_DEF_INT_KEY_REG "HKU\\.DEFAULT\\Control Panel\\International dizininin açılmasında sorun var." IDS_ERROR_NLS_KEY_REG "HKU\\.DEFAULT\\Control Panel\\International dizininin açılmasında sorun var." diff --git a/reactos/dll/cpl/main/lang/tr-TR.rc b/reactos/dll/cpl/main/lang/tr-TR.rc index 0a67db6fdc8..6eb7b9a4b72 100644 --- a/reactos/dll/cpl/main/lang/tr-TR.rc +++ b/reactos/dll/cpl/main/lang/tr-TR.rc @@ -66,7 +66,7 @@ BEGIN GROUPBOX "Tıklama Kilidi", -1, 5, 150, 236, 70 CHECKBOX "&Tıklama Kilidi'ni Aç", IDC_CHECK_CLICK_LOCK, 10, 160, 70, 20 PUSHBUTTON "&Ayarlar...", IDC_BUTTON_CLICK_LOCK, 172, 161, 60, 14 - LTEXT "Fâre düğmesine basılı tutmadan sürüklemeyi ve seçmeyi etkinleştirir. Kilitlemek için kısaca fâre düğmesine basınız. Bırakmak için fâre düğmesine tekrar basınız.", -1, 10, 180, 224, 30 + LTEXT "Fâre düğmesine basılı tutmadan sürüklemeyi ve seçmeyi etkinleştirir. Kilitlemek için kısaca fâre düğmesine basınız. Bırakmak için fâre düğmesine yine basınız.", -1, 10, 180, 224, 30 END IDD_PAGE_POINTER DIALOGEX 0, 0, 246, 228 diff --git a/reactos/dll/win32/crypt32/lang/crypt32_Tr.rc b/reactos/dll/win32/crypt32/lang/crypt32_Tr.rc index b69b3826c4a..dc2d15ab2f6 100644 --- a/reactos/dll/win32/crypt32/lang/crypt32_Tr.rc +++ b/reactos/dll/win32/crypt32/lang/crypt32_Tr.rc @@ -33,7 +33,7 @@ STRINGTABLE IDS_KEY_USAGE "Anahtar Kullanımı" IDS_CERT_POLICIES "Onay Belgesi İlkeleri" IDS_SUBJECT_KEY_IDENTIFIER "Konu Anahtarı Tanımlayıcısı" - IDS_CRL_REASON_CODE "CRL Neden Düzgüsü" + IDS_CRL_REASON_CODE "CRL Neden Kodu" IDS_CRL_DIST_POINTS "CRL Dağıtım Noktaları" IDS_ENHANCED_KEY_USAGE "Gelişmiş Anahtar Kullanımı" IDS_AUTHORITY_INFO_ACCESS "Yetkili Bilgi Erişimi" @@ -82,7 +82,7 @@ STRINGTABLE IDS_CROSS_CA_VERSION "Çapraz CA Sürümü" IDS_SERIALIZED_SIG_SERIAL_NUMBER "Dizilendirilmiş İmzâ Dizi Numarası" IDS_PRINCIPAL_NAME "Asıl Adı" - IDS_WINDOWS_PRODUCT_UPDATE "Pencereler Ürünü Şimdikileştirmesi" + IDS_WINDOWS_PRODUCT_UPDATE "Windows Ürünü Şimdikileştirmesi" IDS_ENROLLMENT_NAME_VALUE_PAIR "Kaydedilmiş Ad Değeri Çifti" IDS_OS_VERSION "İşletim Dizgesi Sürümü" IDS_ENROLLMENT_CSP "Kayıt CSP'si" @@ -109,7 +109,7 @@ STRINGTABLE IDS_PKCS_7_SIGNED_ENVELOPED "PKCS 7 İmzâlı Zarflı" IDS_PKCS_7_DIGESTED "PKCS 7 Özetlenmiş" IDS_PKCS_7_ENCRYPTED "PKCS 7 Şifreli" - IDS_PREVIOUS_CA_CERT_HASH "Bir Önceki CA Onay Belgesi Düzgüsü" + IDS_PREVIOUS_CA_CERT_HASH "Bir Önceki CA Onay Belgesi Kodu" IDS_CRL_VIRTUAL_BASE "Farazî Taban CRL Numarası" IDS_CRL_NEXT_PUBLISH "Bir Sonraki CRL Yayımlaması" IDS_CA_EXCHANGE "CA Şifreleme Onay Belgesi" @@ -129,24 +129,24 @@ STRINGTABLE IDS_REVOKE_REQUEST "İsteği İptal Et" IDS_QUERY_PENDING "Sorgu Beklemede" IDS_SORTED_CTL "Onay Belgesi Güven Dizelgesi" - IDS_ARCHIVED_KEY_CERT_HASH "Belgeliklenmiş Anahtar Onaylama Düzgüsü" + IDS_ARCHIVED_KEY_CERT_HASH "Belgeliklenmiş Anahtar Onaylama Kodu" IDS_PRIVATE_KEY_USAGE_PERIOD "Husûsî Anahtar Kullanım Dönemi" IDS_CLIENT_INFORMATION "İstemci Bilgisi" IDS_SERVER_AUTHENTICATION "Sunucu Yetkilendirmesi" IDS_CLIENT_AUTHENTICATION "İstemci Yetkilendirmesi" - IDS_CODE_SIGNING "Düzgü İmzâlama" + IDS_CODE_SIGNING "Kod İmzâlama" IDS_SECURE_EMAIL "Güvenli E-Posta" IDS_TIME_STAMPING "Zaman Damgalama" - IDS_MICROSOFT_TRUST_LIST_SIGNING "Mikroyazılım Güven Dizelgesi İmzâlaması" - IDS_MICROSOFT_TIME_STAMPING "Mikroyazılım Zaman Damgalaması" + IDS_MICROSOFT_TRUST_LIST_SIGNING "Microsoft Güven Dizelgesi İmzâlaması" + IDS_MICROSOFT_TIME_STAMPING "Microsoft Zaman Damgalaması" IDS_IPSEC_END_SYSTEM "IP Güvenlik Uç Dizgesi" IDS_IPSEC_TUNNEL "IP Güvenlik Tünel Sonu" IDS_IPSEC_USER "IP Güvenlik Kullanıcısı" IDS_EFS "Şifreleyici Kütük Dizgesi" - IDS_WHQL_CRYPTO "Pencereler Donanım Sürücüsü Doğrulaması" - IDS_NT5_CRYPTO "Pencereler Dizge Bileşeni Doğrulaması" - IDS_OEM_WHQL_CRYPTO "OEM Pencereler Dizge Bileşeni Doğrulaması" - IDS_EMBEDDED_NT_CRYPTO "Gömülü Pencereler Dizge Bileşeni Doğrulaması" + IDS_WHQL_CRYPTO "Windows Donanım Sürücüsü Doğrulaması" + IDS_NT5_CRYPTO "Windows Dizge Bileşeni Doğrulaması" + IDS_OEM_WHQL_CRYPTO "OEM Windows Dizge Bileşeni Doğrulaması" + IDS_EMBEDDED_NT_CRYPTO "Gömülü Windows Dizge Bileşeni Doğrulaması" IDS_KEY_PACK_LICENSES "Anahtar Paketi Rusatları" IDS_LICENSE_SERVER "Ruhsat Sunucusu Doğrulaması" IDS_SMART_CARD_LOGON "Akıllı Kart ile Oturum Açma" diff --git a/reactos/dll/win32/cryptui/lang/cryptui_Tr.rc b/reactos/dll/win32/cryptui/lang/cryptui_Tr.rc index 37f1245ebf7..9ec86034f09 100644 --- a/reactos/dll/win32/cryptui/lang/cryptui_Tr.rc +++ b/reactos/dll/win32/cryptui/lang/cryptui_Tr.rc @@ -51,16 +51,16 @@ STRINGTABLE IDS_FIELDS_CRITICAL_EXTENSIONS "Yalnızca Önemli Eklentiler" IDS_FIELDS_PROPERTIES "Yalnızca Husûsiyetler" IDS_FIELD_VERSION "Sürüm" - IDS_FIELD_SERIAL_NUMBER "Dizi numarası" + IDS_FIELD_SERIAL_NUMBER "Dizi Numarası" IDS_FIELD_ISSUER "Dağıtıcı" - IDS_FIELD_VALID_FROM "Şuradan geçerlidir" - IDS_FIELD_VALID_TO "Şuraya geçerlidir" + IDS_FIELD_VALID_FROM "Şuradan Geçerlidir" + IDS_FIELD_VALID_TO "Şuraya Geçerlidir" IDS_FIELD_SUBJECT "Konu" - IDS_FIELD_PUBLIC_KEY "Açık anahtar" + IDS_FIELD_PUBLIC_KEY "Açık Anahtar" IDS_FIELD_PUBLIC_KEY_FORMAT "%1 (%2!d! bit)" - IDS_PROP_HASH "SHA1 düzgüsü" + IDS_PROP_HASH "SHA1 Kodu" IDS_PROP_ENHKEY_USAGE "Gelişmiş anahtar kullanımı (husûsiyet)" - IDS_PROP_FRIENDLY_NAME "Kolay adı" + IDS_PROP_FRIENDLY_NAME "Kolay Adı" IDS_PROP_DESCRIPTION "Tanımı" IDS_CERTIFICATE_PROPERTIES "Onay Belgesi Husûsiyetleri" IDS_CERTIFICATE_PURPOSE_ERROR "1.2.3.4 biçiminde bir OID giriniz." @@ -77,7 +77,7 @@ STRINGTABLE IDS_IMPORT_FILTER_PFX "Şahsî Bilgi Değiştirmesi (*.pfx; *.p12)" IDS_IMPORT_FILTER_CRL "Onay Belgesi İptal Dizelgesi (*.crl)" IDS_IMPORT_FILTER_CTL "Onay Belgesi Güven Dizelgesi (*.stl)" - IDS_IMPORT_FILTER_SERIALIZED_STORE "Mikroyazılım Dizilendirilmiş Onay Belgesi Deposu (*.sst)" + IDS_IMPORT_FILTER_SERIALIZED_STORE "Microsoft Dizilendirilmiş Onay Belgesi Deposu (*.sst)" IDS_IMPORT_FILTER_CMS "CMS/PKCS #7 İletileri (*.spc; *.p7b)" IDS_IMPORT_FILTER_ALL "Tüm Kütükler (*.*)" IDS_IMPORT_EMPTY_FILE "Bir kütük seçiniz." @@ -140,10 +140,10 @@ Yazılımı yayımlamadan sonraki değişikliklerden korur." IDS_PURPOSE_CTL_USAGE_SIGNING "Onay belgesi güven dizelgesini sayılık olarak imzâlamanızı sağlar." IDS_PURPOSE_EFS "Diskteki verilerin şifrelenmesini sağlar." IDS_PURPOSE_EFS_RECOVERY "Kütük Kurtarma" - IDS_PURPOSE_WHQL "Pencereler Donanım Sürücüsü Doğrulaması" - IDS_PURPOSE_NT5 "Pencereler Dizge Bileşeni Doğrulaması" - IDS_PURPOSE_OEM_WHQL "OEM Pencereler Dizge Bileşeni Doğrulaması" - IDS_PURPOSE_EMBEDDED_NT "Gömülü Pencereler Dizge Bileşeni Doğrulaması" + IDS_PURPOSE_WHQL "Windows Donanım Sürücüsü Doğrulaması" + IDS_PURPOSE_NT5 "Windows Dizge Bileşeni Doğrulaması" + IDS_PURPOSE_OEM_WHQL "OEM Windows Dizge Bileşeni Doğrulaması" + IDS_PURPOSE_EMBEDDED_NT "Gömülü Windows Dizge Bileşeni Doğrulaması" IDS_PURPOSE_ROOT_LIST_SIGNER "Kök Dizelgesi İmzâlayıcısı" IDS_PURPOSE_QUALIFIED_SUBORDINATION "Nitelikli Bağlılık" IDS_PURPOSE_KEY_RECOVERY "Anahtar Kurtarma" @@ -312,7 +312,7 @@ BEGIN -1, 31,53,265,10 LTEXT "Şahsî Bilgi Değiştirmesi/PKCS #12 (.pfx, .p12)", -1, 31,68,265,10 - LTEXT "Mikroyazılım Dizilendirilmiş Onay Belgesi Deposu (.sst)", + LTEXT "Microsoft Dizilendirilmiş Onay Belgesi Deposu (.sst)", -1, 31,83,265,10 END diff --git a/reactos/dll/win32/devmgr/devmgr.rc b/reactos/dll/win32/devmgr/devmgr.rc index 33c5e7d7dd7..6270626e401 100644 --- a/reactos/dll/win32/devmgr/devmgr.rc +++ b/reactos/dll/win32/devmgr/devmgr.rc @@ -71,6 +71,9 @@ IDI_DEVMGR ICON "resources/devmgr.ico" #ifdef LANGUAGE_SQ_AL #include "lang/sq-AL.rc" #endif +#ifdef LANGUAGE_TR_TR + #include "lang/tr-TR.rc" +#endif #ifdef LANGUAGE_UK_UA #include "lang/uk-UA.rc" #endif diff --git a/reactos/dll/win32/devmgr/lang/tr-TR.rc b/reactos/dll/win32/devmgr/lang/tr-TR.rc new file mode 100644 index 00000000000..9a2716d83a8 --- /dev/null +++ b/reactos/dll/win32/devmgr/lang/tr-TR.rc @@ -0,0 +1,239 @@ +/* TRANSLATOR: 2014 - Erdem Ersoy (eersoy93) (erdemersoy@live.com) */ + +LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT + +STRINGTABLE +BEGIN + IDS_NAME "Ad" + IDS_TYPE "Tür" + IDS_MANUFACTURER "Üretici: %1" + IDS_LOCATION "Konum: %1" + IDS_STATUS "Aygıt Durumu: %1" + IDS_UNKNOWN "Bilinmiyor" + IDS_LOCATIONSTR "Konum %1!u! (%2)" + IDS_DEVCODE " (Kod %1!u!)" + IDS_DEVCODE2 " (Kod %2!u!)" + IDS_ENABLEDEVICE "Bu Aygıtı Kullan (Etkinleştir)" + IDS_DISABLEDEVICE "Bu Aygıtı Kullanma (Edilginleştir)" + IDS_UNKNOWNDEVICE "Bilinmeyen Aygıt" + IDS_NODRIVERLOADED "Bu aygıt için hiçbir sürücü kurulmadı." + IDS_DEVONPARENT "%1 Üzerinde" + IDS_TROUBLESHOOTDEV "&Sorun Giderme..." + IDS_ENABLEDEV "&Sürücüyü Etkinleştir" + IDS_REINSTALLDRV "&Sürücüyü Yeniden Kur" + IDS_PROPERTIES "&Husûsiyetler" + IDS_UPDATEDRV "&Sürücüyü Şimdikileştir..." + IDS_REBOOT "&Bilgisayarı Yeniden Başlat..." + IDS_NOTAVAILABLE "Yok" + IDS_NOTDIGITALLYSIGNED "Sayılık olarak imzâlanmamış." + IDS_NODRIVERS "Bu aygıt için gerekli olan veyâ yüklenen sürücü kütükleri yok." + IDS_RESOURCE_COLUMN "Kaynak Türü" + IDS_SETTING_COLUMN "Ayar" + IDS_RESOURCE_MEMORY_RANGE "Bellek Erimi" + IDS_RESOURCE_INTERRUPT "IRQ" + IDS_RESOURCE_DMA "DMA" + IDS_RESOURCE_PORT "E/A Erimi" +END + +/* error messages, source: http://www.z123.org/techsupport/medm.htm */ +STRINGTABLE +BEGIN + IDS_DEV_NO_PROBLEM "Bu aygıt düzgün çalışıyor." + IDS_DEV_NOT_CONFIGURED "Bu aygıt doğru yapılandırılmamış." + IDS_DEV_DEVLOADER_FAILED "Bilgisayar, iki tür veri yolu bildirdiğinden dolayı ReactOS bu aygıtın sürücüsünü yükleyemedi." + IDS_DEV_DEVLOADER_FAILED2 "Bu aygıtın %1 aygıt yükleyicisi/yükleyicileri aygıtın sürücüsünü yükleyemedi." + IDS_DEV_OUT_OF_MEMORY "Bu aygıtın sürücüsü kötü olabilir veyâ dizgeniz bellekte veyâ başka kaynaklarda yavaş çalışıyor olabilir." + IDS_DEV_ENTRY_IS_WRONG_TYPE "Bu aygıtın sürücülerinin kötü veyâ değer defterinizin bozuk olabilmesinden dolayı bu aygıt düzgün bir şekilde çalışmıyor." + IDS_DEV_LACKED_ARBITRATOR "Bu aygıtın sürücüsü, ReactOS'un nasıl yöneteceğini bilmediği bir kaynağa gereksinim duyuyor." + IDS_DEV_BOOT_CONFIG_CONFLICT "Bu aygıtın gereksinim duyduğu kaynakları başka bir aygıt kullanıyor." + IDS_DEV_FAILED_FILTER "Bu aygıtın sürücüleri yeniden kurulmaya gereksinim duyuyor." + IDS_DEV_DEVLOADER_NOT_FOUND "ReactOS'un bu aygıtın sürücülerini yükleyen %1 kütüğünü yükleyemesinden dolayı bu aygıt düzgün çalışmıyor." + IDS_DEV_DEVLOADER_NOT_FOUND2 "Bu aygıtın sürücülerini yükleyen %1 kütüğünün kötü olmasından dolayı bu aygıt düzgün çalışmıyor." + IDS_DEV_DEVLOADER_NOT_FOUND3 "Aygıt başarısızlığı: Bu aygıtın sürücüsünü değiştirmeyi deneyiniz. Eğer olmuyorsa donanımınızın belgelerine bakınız." + IDS_DEV_INVALID_DATA "Bilgisayarınızın BIOS'u bu aygıtın kaynaklarının yanlış olduğunu bildirdiğinden dolayı bu aygıt düzgün çalışmıyor." + IDS_DEV_INVALID_DATA2 "Bu aygıtın BIOS'u bu aygıtın kaynaklarının yanlış olduğunu bildirdiğinden dolayı bu aygıt düzgün çalışmıyor." + IDS_DEV_FAILED_START "Bu aygıt ya yok, ya düzgün çalışmıyor, ya da bu aygıtın kurulu tüm sürücüleri yok." + IDS_DEV_LIAR "ReactOS, bu aygıtı başlatırken yanıt vermeyi durdurdu, bu yüzden bu aygıt bir daha başlatılmayacak." + IDS_DEV_NORMAL_CONFLICT "Bu aygıt, kullanmak için hiç boş %1 kaynaklarını bulamıyor." + IDS_DEV_NOT_VERIFIED "Bu aygıt ya yok, ya düzgün çalışmıyor, ya da bu aygıtın kurulu tüm sürücüleri yok." + IDS_DEV_NEED_RESTART "Bu aygıt bilgisayarınızı yeniden başlatana kadar düzgün çalışamaz." + IDS_DEV_REENUMERATION "Bu aygıt, kaynak çakışmasına neden oldu." + IDS_DEV_PARTIAL_LOG_CONF "ReactOS, bu aygıtın kullandığı tüm kaynakları tanılayamadı." + IDS_DEV_UNKNOWN_RESOURCE "%1 sürücü bilgi kütüğü, bu alt aygıtın, bu üst aygıtın iye olmadığı ya da tanımadığı kaynağı kullandığını gösteriyor." + IDS_DEV_REINSTALL "Bu aygıtın sürücüleri yeniden başlatılmaya gereksinim duyuyor." + IDS_DEV_REGISTRY "Değer defteriniz bozuk olabilir." + IDS_DEV_WILL_BE_REMOVED "ReactOS bu aygıtı kaldırıyor." + IDS_DEV_DISABLED "Bu aygıt başlatılmamış." + IDS_DEV_DISABLED2 "Bu aygıt edilgin." + IDS_DEV_DEVLOADER_NOT_READY "Bu aygıtın yükleyicileri gerekli sürücüleri yükleyemiyor." + IDS_DEV_DEVLOADER_NOT_READY2 "Bu görüntü bağdaştırıcısı düzgün çalışıyor." + IDS_DEV_DEVLOADER_NOT_READY3 "Bu aygıtın yükleyicileri gerekli sürücüleri yükleyemiyor." + IDS_DEV_DEVICE_NOT_THERE "Bu aygıt ya yok, ya düzgün çalışmıyor, ya da bu aygıtın kurulu tüm sürücüleri yok." + IDS_DEV_MOVED "ReactOS, bu aygıtı kurma işleminde." + IDS_DEV_TOO_EARLY "ReactOS, bu aygıtı kurma işleminde." + IDS_DEV_NO_VALID_LOG_CONF "ReactOS, bu aygıtın kaynaklarını belirleyemez." + IDS_DEV_FAILED_INSTALL "Bu aygıtın sürücüleri kurulu değil." + IDS_DEV_HARDWARE_DISABLED "Bu aygıtın BIOS'u aygıta hiç kaynak vermediğinden dolayı bu aygıt edilgin." + IDS_DEV_CANT_SHARE_IRQ "Bu aygıt, başka bir aygıtın kullandığı paylaşılamayan Kesme İsteği (IRQ) kaynağı kullanıyor.\nÇakışan ayârı değiştirmeli ya da çakışmaya neden olan gerçek kip sürücüsünü kaldırmalısınız." + IDS_DEV_FAILED_ADD "%1 şeyinin düzgün çalışmamasından dolayı bu aygıt düzgün çalışmıyor." + IDS_DEV_DISABLED_SERVICE "ReactOS, kurulum kütüklerinin üzerinde bulunduğu, sürücüye ya da ağ konumuna erişememesinden dolayı bu aygıtın sürücülerini kuramıyor." + IDS_DEV_TRANSLATION_FAILED "Bu aygıt sürücüsüne yanıt vermiyor." + IDS_DEV_NO_SOFTCONFIG "ReactOS, bu aygıtın ayarlarını belirleyemiyor. Bu aygıtla gelen belgelere bakınız ve yapılandırmayı ayarlamak için ""Kaynaklar"" sekmesini kullanınız." + IDS_DEV_BIOS_TABLE "Bilgisayarınızın dizge bellenimi, bu aygıtı, düzgün olarak, yapılandırmak ve kullanmak için yeterli bilgi içermiyor.\nBu aygıtı kullanmak için, bellenim veyâ BIOS güncellemesi elde etmek için bilgisayarınızın üreticisiyle iletişime geçiniz." + IDS_DEV_IRQ_TRANSLATION_FAILED "Bu aygıt, bir PCI kesmesi istemektedir ancak bir ISA kesmesi için yapılandırılmıştır (ya da tersi).\nBu aygıtın kesmesini yapılandırmak için bilgisayarın dizge kurulum çizeylemini kullanınız." + IDS_DEV_FAILED_DRIVER_ENTRY "ReactOS, bu donanımın aygıt sürücüsünü başlatamıyor." + IDS_DEV_DRIVER_FAILED_PRIOR_UNLOAD "ReactOS, bellekte hâlâ aygıt sürücüsünün bir önceki tıpkısı olduğundan dolayı bu donanımın aygıt sürücüsünü yükleyemiyor." + IDS_DEV_DRIVER_FAILED_LOAD "ReactOS, bu donanımın aygıt sürücüsünü yükleyemiyor. Sürücü eksik ya da bozulmuş olabilir." + IDS_DEV_DRIVER_SERVICE_KEY_INVALID "ReactOS, bu donanımın, değer defterinde hizmet dizini bilgisinin eksik ya da yanlış kaydedildiğinden dolayı bu donanıma erişemiyor." + IDS_DEV_LEGACY_SERVICE_NO_DEVICES "ReactOS, bu donanımın aygıt sürücüsünü başarılı bir şekilde yükledi ancak donanım aygıtını bulamıyor." + IDS_DEV_DUPLICATE_DEVICE "ReactOS, dizgede önceden bir tıpkı aygıt çalışıyor olmasından dolayı bu donanımın aygıt sürücüsünü yükleyemiyor." + IDS_DEV_FAILED_POST_START "ReactOS, bu aygıtı, sorunlar bildirdiğinden dolayı durdurdu." + IDS_DEV_HALTED "Bir uygulama ya da bir hizmet, bu donanım aygıtını kapattı." + IDS_DEV_PHANTOM "Şu an bu donanım aygıtı bilgisayara bağlı değil." + IDS_DEV_SYSTEM_SHUTDOWN "ReactOS, işletim dizgesinin kapatma işleminde olmasından dolayı bu donanım aygıtının erişimini elde edemiyor." + IDS_DEV_HELD_FOR_EJECT "ReactOS, bu donanım aygıtının, güvenli kaldırılmaya anıklandığından ancak bilgisayardan kaldırılmadığından dolayı onu kullanamıyor." + IDS_DEV_DRIVER_BLOCKED "Bu aygıtın yazılımı, ReactOS'la sorunları olduğu bilindiğinden dolayı başlatmaktan engellendi. Yeni bir donanım için donanımın satıcısıyla iletişime geçiniz." + IDS_DEV_REGISTRY_TOO_LARGE "ReactOS, dizge yığınının çok büyük olmasından dolayı yeni donanım aygıtlarını başlatamıyor. (Değer Defteri Büyüklük Sınırı'nı aşar.)" + IDS_DEV_SETPROPERTIES_FAILED "ReactOS, bu aygıtın ayarlarını değiştiremez." +END + +STRINGTABLE +BEGIN + IDS_PROP_DEVICEID "Aygıt Örneği Kimliği" + IDS_PROP_HARDWAREIDS "Donanım Kimlikleri" + IDS_PROP_COMPATIBLEIDS "Uyumlu Kimlikler" + IDS_PROP_MATCHINGDEVICEID "Eşleşen Aygıt Kimliği" + IDS_PROP_SERVICE "Hizmet" + IDS_PROP_ENUMERATOR "Numaralandırıcı" + IDS_PROP_CAPABILITIES "Yetenekler" + IDS_PROP_DEVNODEFLAGS "Aygıt Bileşeni İmleri" + IDS_PROP_CONFIGFLAGS "Yapılandırma İmleri" + IDS_PROP_CSCONFIGFLAGS "CSConfig İmleri" + IDS_PROP_EJECTIONRELATIONS "Çıkarma İlişkileri" + IDS_PROP_REMOVALRELATIONS "Kaldırma İlişkileri" + IDS_PROP_BUSRELATIONS "Veri Yolu İlişkileri" + IDS_PROP_DEVUPPERFILTERS "Üst Aygıt Süzgeçleri" + IDS_PROP_DEVLOWERFILTERS "Alt Aygıt Süzgeçleri" + IDS_PROP_CLASSUPPERFILTERS "Üst Sınıf Süzgeçleri" + IDS_PROP_CLASSLOWERFILTERS "Alt Sınıf Süzgeçleri" + IDS_PROP_CLASSINSTALLER "Sınıf Yükleyicileri" + IDS_PROP_CLASSCOINSTALLER "Sınıf Yükleme Yardımcıları" + IDS_PROP_DEVICECOINSTALLER "Aygıt Yükleme Yardımcıları" + IDS_PROP_FIRMWAREREVISION "Bellenim Düzeltmesi" + IDS_PROP_CURRENTPOWERSTATE "Şimdiki Güç Durumu" + IDS_PROP_POWERCAPABILITIES "Güç Yetenekleri" + IDS_PROP_POWERSTATEMAPPINGS "Güç Durumu Eşlemeleri" +END + +IDD_HARDWARE DIALOGEX 0, 0, 300, 400 +STYLE DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CAPTION | DS_SHELLFONT +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "&Aygıtlar:", IDC_DEVICES, 7, 6, 196, 10 + CONTROL "", IDC_LV_DEVICES, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | + LVS_SHAREIMAGELISTS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 7, 16, 196, 50 + GROUPBOX "Aygıt Husûsiyetleri", IDC_PROPERTIESGROUP, 7, 76, 196, 105 + LTEXT "", IDC_MANUFACTURER, 14, 88, 183, 10, SS_ENDELLIPSIS + LTEXT "", IDC_LOCATION, 14, 100, 183, 10, SS_ENDELLIPSIS + LTEXT "", IDC_STATUS, 14, 112, 183, 30 + PUSHBUTTON "&Sorun Giderme...", IDC_TROUBLESHOOT, 80, 140, 60, 14, BS_PUSHBUTTON | WS_CHILD | WS_DISABLED | WS_TABSTOP + PUSHBUTTON "&Husûsiyetler", IDC_PROPERTIES, 146, 140, 50, 14 +END + +IDD_DEVICEGENERAL DIALOGEX 0, 0, 252, 218 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Umûmî" +FONT 8, "MS Shell Dlg" +BEGIN + ICON "", IDC_DEVICON, 7, 7, 20, 20 + LTEXT "", IDC_DEVNAME, 37, 9, 174, 16, SS_NOPREFIX + LTEXT "Aygıt Türü:", -1, 37, 39, 60, 8, SS_NOPREFIX + EDITTEXT IDC_DEVTYPE, 100, 39, 146, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY + LTEXT "Üretici:", -1, 37, 53, 60, 8, SS_NOPREFIX + EDITTEXT IDC_DEVMANUFACTURER, 100, 53, 145, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY + LTEXT "Konum:", -1, 37, 67, 60, 8, SS_NOPREFIX + EDITTEXT IDC_DEVLOCATION, 100, 67, 145, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY + GROUPBOX "Aygıt Durumu", IDC_DEVSTATUSGROUP, 7, 83, 238, 100 + EDITTEXT IDC_DEVSTATUS, 14, 96, 224, 61, NOT WS_TABSTOP | ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL + PUSHBUTTON "&Sorun Giderme...", IDC_DEVPROBLEM, 148, 163, 90, 15 + LTEXT "&Aygıt Kullanımı:", IDC_DEVUSAGELABEL, 7, 188, 222, 8, WS_DISABLED + COMBOBOX IDC_DEVUSAGE, 7, 198, 239, 40, CBS_DROPDOWNLIST | WS_VSCROLL | WS_DISABLED +END + +IDD_DEVICEDRIVER DIALOGEX 0, 0, 252, 218 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Sürücü" +FONT 8, "MS Shell Dlg" +BEGIN + ICON "", IDC_DEVICON, 7, 7, 20, 20 + LTEXT "", IDC_DEVNAME, 37, 9, 174, 16, SS_NOPREFIX + LTEXT "Sürücü Sağlayıcısı:", -1, 37, 39, 60, 8, SS_NOPREFIX + EDITTEXT IDC_DRVPROVIDER, 100, 39, 146, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY + LTEXT "Sürücü Zamânı:", -1, 37, 53, 60, 8, SS_NOPREFIX + EDITTEXT IDC_DRVDATE, 100, 53, 145, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY + LTEXT "Sürücü Sürümü:", -1, 37, 67, 60, 8, SS_NOPREFIX + EDITTEXT IDC_DRVVERSION, 100, 67, 145, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY + LTEXT "Sürücü İmzâlayıcısı:", -1, 37, 81, 60, 8, SS_NOPREFIX + EDITTEXT IDC_DIGITALSIGNER, 100, 81, 145, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY + PUSHBUTTON "&Sürücü Ayrıntıları...", IDC_DRIVERDETAILS, 7, 106, 75, 15 + LTEXT "Sürücü kütükleri hakkında ayrıntıları görmek için.", -1, 91, 110, 154, 17, SS_NOPREFIX + PUSHBUTTON "S&ürücüyü Şimdikileştir...", IDC_UPDATEDRIVER, 7, 126, 75, 15 + LTEXT "Bu aygıtın sürücüsünü şimdikileştir.", -1, 91, 130, 154, 17, SS_NOPREFIX +END + +IDD_DRIVERDETAILS DIALOGEX 0, 0, 224, 230 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_DLGFRAME +CAPTION "Sürücü Kütüğü Ayrıntıları" +FONT 8, "MS Shell Dlg" +BEGIN + ICON "", IDC_DEVICON, 7, 7, 20, 20 + LTEXT "", IDC_DEVNAME, 37, 9, 174, 16, SS_NOPREFIX + LTEXT "&Sürücü Kütükleri:", -1, 7, 36, 204, 8 + CONTROL "", IDC_DRIVERFILES, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | + LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_SORTASCENDING | + LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 7, 46, 209, 80 + LTEXT "Sağlayıcı:", -1, 14, 134, 50, 8 + EDITTEXT IDC_FILEPROVIDER, 66, 134, 155, 8, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY + LTEXT "Kütük Sürümü:", -1, 14, 150, 50, 8 + EDITTEXT IDC_FILEVERSION, 66, 150, 155, 8, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY + LTEXT "Telif Hakkı:", -1, 14, 166, 50, 8 + EDITTEXT IDC_FILECOPYRIGHT, 66, 166, 155, 8, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY + LTEXT "Sayılık İmzâlayıcı:", -1, 14, 182, 50, 8 + EDITTEXT IDC_DIGITALSIGNER, 66, 182, 155, 8, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY + DEFPUSHBUTTON "Tamam", IDOK, 167, 208, 50, 14 +END + +IDD_DEVICEDETAILS DIALOGEX 0, 0, 252, 218 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Ayrıntılar" +FONT 8, "MS Shell Dlg" +BEGIN + ICON "", IDC_DEVICON, 7, 7, 20, 20 + LTEXT "", IDC_DEVNAME, 37, 9, 174, 16, SS_NOPREFIX + COMBOBOX IDC_DETAILSPROPNAME, 7, 36, 238, 165, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "", IDC_DETAILSPROPVALUE, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | + LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | + LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 7, 58, 238, 155 +END + +IDD_DEVICERESOURCES DIALOGEX 0, 0, 252, 218 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Kaynaklar" +FONT 8, "MS Shell Dlg" +BEGIN + ICON "", IDC_DEVICON, 7, 7, 20, 20 + LTEXT "", IDC_DEVNAME, 37, 9, 174, 16, SS_NOPREFIX + LTEXT "Kaynak Ayarları:", -1, 7, 36, 204, 8 + CONTROL "", IDC_DRIVERRESOURCES, "SysListView32", LVS_REPORT | + LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_SORTASCENDING | + LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 7, 46, 209, 80 +END + +IDD_DEVICEPOWER DIALOGEX 0, 0, 252, 218 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Güç" +FONT 8, "MS Shell Dlg" +BEGIN + ICON "", IDC_DEVICON, 7, 7, 20, 20 + LTEXT "", IDC_DEVNAME, 37, 9, 174, 16, SS_NOPREFIX +END diff --git a/reactos/dll/win32/hhctrl.ocx/hhctrl.rc b/reactos/dll/win32/hhctrl.ocx/hhctrl.rc index 9fae00ebef4..26cd74ad344 100644 --- a/reactos/dll/win32/hhctrl.ocx/hhctrl.rc +++ b/reactos/dll/win32/hhctrl.ocx/hhctrl.rc @@ -57,9 +57,6 @@ #ifdef LANGUAGE_SV_SE #include "lang/Sv.rc" #endif -#ifdef LANGUAGE_TR_TR - #include "lang/Tr.rc" -#endif /* UTF-8 */ #ifdef LANGUAGE_DE_DE @@ -98,6 +95,9 @@ #ifdef LANGAUGE_SQ_AL #include "lang/Sq.rc" #endif +#ifdef LANGUAGE_TR_TR + #include "lang/Tr.rc" +#endif #ifdef LANGUAGE_UK_UA #include "lang/Uk.rc" #endif diff --git a/reactos/dll/win32/hhctrl.ocx/lang/Tr.rc b/reactos/dll/win32/hhctrl.ocx/lang/Tr.rc index 748899908f7..4c4a6daccfb 100644 --- a/reactos/dll/win32/hhctrl.ocx/lang/Tr.rc +++ b/reactos/dll/win32/hhctrl.ocx/lang/Tr.rc @@ -2,7 +2,7 @@ * HTML Help resources * Turkish Language Support * - * Copyright 2006 Fatih Ac + * Copyrights: 2006 - Fatih Aşıcı (fasici@linux-sevenler.org), 2014 - Erdem Ersoy (eersoy93) (erdemersoy@live.com) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,24 +23,24 @@ LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT STRINGTABLE BEGIN - IDS_CONTENTS "&erik" - IDS_INDEX "Di&zin" + IDS_CONTENTS "&İçindekiler" + IDS_INDEX "&Dizin" IDS_SEARCH "&Ara" - IDS_FAVORITES "&Sk Kullanlanlar" + IDS_FAVORITES "&Yer İmleri" END STRINGTABLE BEGIN - IDTB_EXPAND "Gster" + IDTB_EXPAND "Göster" IDTB_CONTRACT "Gizle" IDTB_STOP "Dur" IDTB_REFRESH "Yenile" IDTB_BACK "Geri" IDTB_HOME "Ev" - IDTB_SYNC "Eitle" - IDTB_PRINT "Yazdr" - IDTB_OPTIONS "Seenekler" - IDTB_FORWARD "leri" + IDTB_SYNC "Eşitle" + IDTB_PRINT "Yazdır" + IDTB_OPTIONS "Seçenekler" + IDTB_FORWARD "İleri" IDTB_NOTES "IDTB_NOTES" IDTB_BROWSE_FWD "IDTB_BROWSE_FWD" IDTB_BROWSE_BACK "IDT_BROWSE_BACK" @@ -51,8 +51,8 @@ BEGIN IDTB_FAVORITES "IDTB_FAVORITES" IDTB_JUMP1 "Jump1" IDTB_JUMP2 "Jump2" - IDTB_CUSTOMIZE "zelletir" - IDTB_ZOOM "Yaklatr" + IDTB_CUSTOMIZE "Husûsileştir" + IDTB_ZOOM "Yakınlaştır" IDTB_TOC_NEXT "IDTB_TOC_NEXT" IDTB_TOC_PREV "IDTB_TOC_PREV" END diff --git a/reactos/dll/win32/iccvid/lang/iccvid_Tr.rc b/reactos/dll/win32/iccvid/lang/iccvid_Tr.rc index eec2b7ec5fd..f24b5b6717a 100644 --- a/reactos/dll/win32/iccvid/lang/iccvid_Tr.rc +++ b/reactos/dll/win32/iccvid/lang/iccvid_Tr.rc @@ -1,5 +1,5 @@ /* - * Copyright 2006 Fatih Ac + * Copyrights: 2006 - Fatih Aşıcı, 2014 - Erdem Ersoy (eersoy93) (erdemersoy@live.com) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,6 +22,6 @@ LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT STRINGTABLE { - IDS_NAME "Cinepak Vidyo zc" - IDS_DESCRIPTION "Cinepak Vidyo zc" + IDS_NAME "Cinepak Vidyo Kodeki" + IDS_DESCRIPTION "Cinepak Vidyo Kodeki" } diff --git a/reactos/dll/win32/iccvid/rsrc.rc b/reactos/dll/win32/iccvid/rsrc.rc index 245b593d1d3..25e514008a4 100644 --- a/reactos/dll/win32/iccvid/rsrc.rc +++ b/reactos/dll/win32/iccvid/rsrc.rc @@ -46,9 +46,6 @@ #ifdef LANGUAGE_SV_SE #include "lang/iccvid_Sv.rc" #endif -#ifdef LANGUAGE_TR_TR - #include "lang/iccvid_Tr.rc" -#endif /* UTF-8 */ #ifdef LANGUAGE_DE_DE @@ -84,6 +81,9 @@ #ifdef LANGUAGE_SQ_AL #include "lang/iccvid_Sq.rc" #endif +#ifdef LANGUAGE_TR_TR + #include "lang/iccvid_Tr.rc" +#endif #ifdef LANGUAGE_UK_UA #include "lang/iccvid_Uk.rc" #endif From 62dc9b0d32443e40594a1a237220ffc16f387960 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 2 Mar 2014 19:36:50 +0000 Subject: [PATCH 031/113] [PSEH3] - Switch the registration asm functions from a complete custom calling convention to regparm(2), so that it can be used in "returns_twice" based algorithm (required by CLANG, which doesn't support "asm goto" construct) - Add support for saving all non-volatiles in the registration frame (also required by CLANG, since without asm goto, we cannot give the compiler the required hints to save these registers itself) svn path=/trunk/; revision=62383 --- reactos/include/reactos/libs/pseh/pseh3.h | 15 ++++- reactos/lib/pseh/i386/pseh3.c | 2 + reactos/lib/pseh/i386/pseh3_asmdef.h | 3 + reactos/lib/pseh/i386/pseh3_i386.S | 70 ++++++++++++++++------- 4 files changed, 66 insertions(+), 24 deletions(-) diff --git a/reactos/include/reactos/libs/pseh/pseh3.h b/reactos/include/reactos/libs/pseh/pseh3.h index d1168893894..0b75e7df732 100644 --- a/reactos/include/reactos/libs/pseh/pseh3.h +++ b/reactos/include/reactos/libs/pseh/pseh3.h @@ -12,6 +12,11 @@ #include "excpt.h" +/* CLANG must safe non-volatiles, because it uses a return-twice algorithm */ +#if defined(__clang__) && !defined(_SEH3$_FRAME_ALL_NONVOLATILES) +#define _SEH3$_FRAME_ALL_NONVOLATILES 1 +#endif + typedef struct _SEH3$_SCOPE_TABLE { void *Target; @@ -42,7 +47,11 @@ typedef struct _SEH3$_REGISTRATION_FRAME /* Registers that we need to save */ unsigned long Esp; unsigned long Ebp; - +#ifdef _SEH3$_FRAME_ALL_NONVOLATILES + unsigned long Ebx; + unsigned long Esi; + unsigned long Edi; +#endif } SEH3$_REGISTRATION_FRAME ,*PSEH3$_REGISTRATION_FRAME; /* Prevent gcc from inlining functions that use SEH. */ @@ -95,7 +104,7 @@ void * __cdecl __attribute__((error("Can only be used inside an exception filter /* This is an asm wrapper around _SEH3$_RegisterFrame */ #define _SEH3$_RegisterFrame(_TrylevelFrame, _DataTable, _Target) \ - asm goto ("leal %0, %%ecx\n" \ + asm goto ("leal %0, %%edx\n" \ "call __SEH3$_RegisterFrame\n" \ : \ : "m" (*(_TrylevelFrame)), "a" (_DataTable) \ @@ -104,7 +113,7 @@ void * __cdecl __attribute__((error("Can only be used inside an exception filter /* This is an asm wrapper around _SEH3$_EnterTryLevel */ #define _SEH3$_RegisterTryLevel(_TrylevelFrame, _DataTable, _Target) \ - asm goto ("leal %0, %%ecx\n" \ + asm goto ("leal %0, %%edx\n" \ "call __SEH3$_RegisterTryLevel\n" \ : \ : "m" (*(_TrylevelFrame)), "a" (_DataTable) \ diff --git a/reactos/lib/pseh/i386/pseh3.c b/reactos/lib/pseh/i386/pseh3.c index 13e5df1d601..1d37ca0a981 100644 --- a/reactos/lib/pseh/i386/pseh3.c +++ b/reactos/lib/pseh/i386/pseh3.c @@ -34,6 +34,8 @@ #include #include +/* We need the full structure with all non-volatile */ +#define _SEH3$_FRAME_ALL_NONVOLATILES 1 #include "pseh3.h" #include "pseh3_asmdef.h" diff --git a/reactos/lib/pseh/i386/pseh3_asmdef.h b/reactos/lib/pseh/i386/pseh3_asmdef.h index 6fd821ce837..f8d847eb323 100644 --- a/reactos/lib/pseh/i386/pseh3_asmdef.h +++ b/reactos/lib/pseh/i386/pseh3_asmdef.h @@ -7,6 +7,9 @@ #define SEH3_REGISTRATION_FRAME_ExceptionPointers 16 #define SEH3_REGISTRATION_FRAME_Esp 20 #define SEH3_REGISTRATION_FRAME_Ebp 24 +#define SEH3_REGISTRATION_FRAME_Ebx 28 +#define SEH3_REGISTRATION_FRAME_Esi 32 +#define SEH3_REGISTRATION_FRAME_Edi 36 #define SEH3_SCOPE_TABLE_Target 0 #define SEH3_SCOPE_TABLE_Filter 4 diff --git a/reactos/lib/pseh/i386/pseh3_i386.S b/reactos/lib/pseh/i386/pseh3_i386.S index eca7182158c..e647312ee74 100644 --- a/reactos/lib/pseh/i386/pseh3_i386.S +++ b/reactos/lib/pseh/i386/pseh3_i386.S @@ -11,62 +11,90 @@ .text - .extern __SEH3$_except_handler /* * void - * _SEH3$_RegisterFrame( - * PSEH_REGISTRATION_FRAME RegistrationRecord, - * PSEH_DATA_TABLE DataTable); + * __attribute__((regparm(2))) + * __attribute__((returns_twice)) + * _SEH3$_RegisterFrame[WithNonVolatiles]( + * PSEH_DATA_TABLE DataTable, + * PSEH_REGISTRATION_FRAME RegistrationRecord); */ +.global __SEH3$_RegisterFrameWithNonVolatiles +__SEH3$_RegisterFrameWithNonVolatiles: + + /* Save non-volatiles in the registration frame */ + mov [edx + SEH3_REGISTRATION_FRAME_Ebx], ebx + mov [edx + SEH3_REGISTRATION_FRAME_Esi], esi + mov [edx + SEH3_REGISTRATION_FRAME_Edi], edi + .global __SEH3$_RegisterFrame __SEH3$_RegisterFrame: /* Save the address of the static data table */ - mov [ecx + SEH3_REGISTRATION_FRAME_ScopeTable], eax + mov [edx + SEH3_REGISTRATION_FRAME_ScopeTable], eax /* Set the handler address */ - mov dword ptr [ecx + SEH3_REGISTRATION_FRAME_Handler], offset __SEH3$_except_handler + mov dword ptr [edx + SEH3_REGISTRATION_FRAME_Handler], offset __SEH3$_except_handler /* Set this as the end of the internal chain */ - mov dword ptr [ecx + SEH3_REGISTRATION_FRAME_EndOfChain], ecx + mov dword ptr [edx + SEH3_REGISTRATION_FRAME_EndOfChain], edx /* Register the frame in the TEB */ mov eax, dword ptr fs:[0] - mov [ecx + SEH3_REGISTRATION_FRAME_Next], eax - mov dword ptr fs:[0], ecx + mov [edx + SEH3_REGISTRATION_FRAME_Next], eax + mov dword ptr fs:[0], edx - /* Save the registers */ - mov [ecx + SEH3_REGISTRATION_FRAME_Esp], esp - mov [ecx + SEH3_REGISTRATION_FRAME_Ebp], ebp + /* Save the stack registers */ + mov [edx + SEH3_REGISTRATION_FRAME_Esp], esp + mov [edx + SEH3_REGISTRATION_FRAME_Ebp], ebp + /* Set eax to 0 to indicate 1st return */ + xor eax, eax ret +/* + * void + * __attribute__((regparm(2))) + * __attribute__((returns_twice)) + * _SEH3$_RegisterTryLevel[WithNonVolatiles]( + * PSEH_DATA_TABLE DataTable, + * PSEH_REGISTRATION_FRAME RegistrationRecord); + */ +.global __SEH3$_RegisterTryLevelWithNonVolatiles +__SEH3$_RegisterTryLevelWithNonVolatiles: + + /* Save non-volatiles in the registration frame */ + mov [edx + SEH3_REGISTRATION_FRAME_Ebx], ebx + mov [edx + SEH3_REGISTRATION_FRAME_Esi], esi + mov [edx + SEH3_REGISTRATION_FRAME_Edi], edi + .global __SEH3$_RegisterTryLevel __SEH3$_RegisterTryLevel: /* Save the address of the static data table */ - mov [ecx + SEH3_REGISTRATION_FRAME_ScopeTable], eax + mov [edx + SEH3_REGISTRATION_FRAME_ScopeTable], eax /* Set the handler address to NULL as identification */ - and dword ptr [ecx + SEH3_REGISTRATION_FRAME_Handler], 0 + and dword ptr [edx + SEH3_REGISTRATION_FRAME_Handler], 0 /* Get the current registered frame */ mov eax, dword ptr fs:[0] /* Get the current end of the chain and set this as Next */ - mov edx, [eax + SEH3_REGISTRATION_FRAME_EndOfChain] - mov [ecx + SEH3_REGISTRATION_FRAME_Next], edx + mov ecx, [eax + SEH3_REGISTRATION_FRAME_EndOfChain] + mov [edx + SEH3_REGISTRATION_FRAME_Next], ecx /* Set this as the end of the internal chain */ - mov dword ptr [eax + SEH3_REGISTRATION_FRAME_EndOfChain], ecx + mov dword ptr [eax + SEH3_REGISTRATION_FRAME_EndOfChain], edx - /* Save the registers */ - mov [ecx + SEH3_REGISTRATION_FRAME_Esp], esp - mov [ecx + SEH3_REGISTRATION_FRAME_Ebp], ebp + /* Save the stack registers */ + mov [edx + SEH3_REGISTRATION_FRAME_Esp], esp + mov [edx + SEH3_REGISTRATION_FRAME_Ebp], ebp + /* Set eax to 0 to indicate 1st return */ + xor eax, eax ret - From fd28183355c1ce6d723d572255b48d8927868e5a Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 2 Mar 2014 19:49:33 +0000 Subject: [PATCH 032/113] [SERVICES] RSetServiceStatus: Protect the service type from changes by the caller. svn path=/trunk/; revision=62384 --- reactos/base/system/services/rpcserver.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/reactos/base/system/services/rpcserver.c b/reactos/base/system/services/rpcserver.c index ba53003c67e..fbe4bb5c0bc 100644 --- a/reactos/base/system/services/rpcserver.c +++ b/reactos/base/system/services/rpcserver.c @@ -1617,12 +1617,13 @@ DWORD RSetServiceStatus( { PSERVICE lpService; DWORD dwPreviousState; + DWORD dwPreviousType; LPCWSTR lpErrorStrings[2]; WCHAR szErrorBuffer[32]; DPRINT("RSetServiceStatus() called\n"); DPRINT("hServiceStatus = %lu\n", hServiceStatus); - DPRINT("dwServiceType = %lu\n", lpServiceStatus->dwServiceType); + DPRINT("dwServiceType = 0x%lx\n", lpServiceStatus->dwServiceType); DPRINT("dwCurrentState = %lu\n", lpServiceStatus->dwCurrentState); DPRINT("dwControlsAccepted = %lu\n", lpServiceStatus->dwControlsAccepted); DPRINT("dwWin32ExitCode = %lu\n", lpServiceStatus->dwWin32ExitCode); @@ -1666,10 +1667,17 @@ DWORD RSetServiceStatus( /* Save the current service state */ dwPreviousState = lpService->Status.dwCurrentState; + /* Save the current service type */ + dwPreviousType = lpService->Status.dwServiceType; + + /* Update the service status */ RtlCopyMemory(&lpService->Status, lpServiceStatus, sizeof(SERVICE_STATUS)); + /* Restore the previous service type */ + lpService->Status.dwServiceType = dwPreviousType; + /* Unlock the service database */ ScmUnlockDatabase(); @@ -1755,7 +1763,7 @@ DWORD RChangeServiceConfigW( LPWSTR lpImagePathW = NULL; DPRINT("RChangeServiceConfigW() called\n"); - DPRINT("dwServiceType = %lu\n", dwServiceType); + DPRINT("dwServiceType = 0x%lx\n", dwServiceType); DPRINT("dwStartType = %lu\n", dwStartType); DPRINT("dwErrorControl = %lu\n", dwErrorControl); DPRINT("lpBinaryPathName = %S\n", lpBinaryPathName); @@ -1999,7 +2007,7 @@ DWORD RCreateServiceW( DPRINT("lpServiceName = %S\n", lpServiceName); DPRINT("lpDisplayName = %S\n", lpDisplayName); DPRINT("dwDesiredAccess = %lx\n", dwDesiredAccess); - DPRINT("dwServiceType = %lu\n", dwServiceType); + DPRINT("dwServiceType = 0x%lx\n", dwServiceType); DPRINT("dwStartType = %lu\n", dwStartType); DPRINT("dwErrorControl = %lu\n", dwErrorControl); DPRINT("lpBinaryPathName = %S\n", lpBinaryPathName); From eaf929fbe9ad7318344054ad8a1349c39e2b95fa Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 2 Mar 2014 19:53:15 +0000 Subject: [PATCH 033/113] [CMAKE] Add simple clang support to configure.cmp (use "configure clang", which will use ninja as the generator and clang as the compiler) svn path=/trunk/; revision=62385 --- reactos/configure.cmd | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/reactos/configure.cmd b/reactos/configure.cmd index bca5d02fe71..77caee58e1b 100755 --- a/reactos/configure.cmd +++ b/reactos/configure.cmd @@ -37,6 +37,9 @@ if defined ROS_ARCH ( set CMAKE_GENERATOR="Eclipse CDT4 - MinGW Makefiles" ) else if /I "%1" == "Makefiles" ( set CMAKE_GENERATOR="MinGW Makefiles" + ) else if /I "%1" == "clang" ( + set BUILD_ENVIRONMENT=Clang + set CMAKE_GENERATOR="Ninja" ) else ( set CMAKE_GENERATOR="Ninja" ) @@ -151,6 +154,8 @@ if EXIST CMakeCache.txt ( if "%BUILD_ENVIRONMENT%" == "MinGW" ( cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE=0 -DCMAKE_TOOLCHAIN_FILE=toolchain-gcc.cmake -DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" "%REACTOS_SOURCE_DIR%" +) else if "%BUILD_ENVIRONMENT%" == "Clang" ( + cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE=0 -DCMAKE_TOOLCHAIN_FILE=toolchain-clang.cmake -DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" "%REACTOS_SOURCE_DIR%" ) else ( cmake -G %CMAKE_GENERATOR% -DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake -DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" "%REACTOS_SOURCE_DIR%" ) From 6d213f365818fb8d2cda493db8d6690faf4da238 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 2 Mar 2014 20:08:07 +0000 Subject: [PATCH 034/113] [CMAKE] * Remove some unsupported flags from the Clang build options. svn path=/trunk/; revision=62386 --- reactos/cmake/gcc.cmake | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/reactos/cmake/gcc.cmake b/reactos/cmake/gcc.cmake index ed2f656f3cb..d8ea5436aa8 100644 --- a/reactos/cmake/gcc.cmake +++ b/reactos/cmake/gcc.cmake @@ -40,13 +40,19 @@ set(REACTOS_SOURCE_DIR_NATIVE ${REACTOS_SOURCE_DIR}) if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") string(REPLACE "/" "\\" REACTOS_SOURCE_DIR_NATIVE ${REACTOS_SOURCE_DIR}) endif() -add_compile_flags("-fdebug-prefix-map=\"${REACTOS_SOURCE_DIR_NATIVE}\"=ReactOS") + +if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang") + add_compile_flags("-fdebug-prefix-map=\"${REACTOS_SOURCE_DIR_NATIVE}\"=ReactOS") +endif() # Debugging if(SEPARATE_DBG) add_compile_flags("-gdwarf-2 -g2") else() - add_compile_flags("-gdwarf-2 -gstrict-dwarf -femit-struct-debug-detailed=none -feliminate-unused-debug-symbols") + add_compile_flags("-gdwarf-2 -gstrict-dwarf") + if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang") + add_compile_flags("-femit-struct-debug-detailed=none -feliminate-unused-debug-symbols") + endif() endif() # For some reason, cmake sets -fPIC, and we don't want it @@ -63,8 +69,14 @@ endif() # Warnings, errors add_compile_flags("-Werror -Wall -Wpointer-arith") -add_compile_flags("-Wno-char-subscripts -Wno-multichar -Wno-unused-value -Wno-maybe-uninitialized") -add_compile_flags("-Wno-error=unused-but-set-variable -Wno-error=narrowing") +add_compile_flags("-Wno-char-subscripts -Wno-multichar -Wno-unused-value") + +if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang") + add_compile_flags("-Wno-maybe-uninitialized") + add_compile_flags("-Wno-error=unused-but-set-variable") +endif() + +add_compile_flags("-Wno-error=narrowing") add_compile_flags("-Wtype-limits -Wno-error=type-limits") if(ARCH STREQUAL "amd64") @@ -96,7 +108,10 @@ if(LTCG) endif() if(ARCH STREQUAL "i386") - add_compile_flags("-mpreferred-stack-boundary=3 -fno-set-stack-executable -fno-optimize-sibling-calls -fno-omit-frame-pointer") + add_compile_flags("-fno-optimize-sibling-calls -fno-omit-frame-pointer") + if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang") + add_compile_flags("-mpreferred-stack-boundary=3 -fno-set-stack-executable") + endif() # FIXME: this doesn't work. CMAKE_BUILD_TYPE is always "Debug" if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") add_compile_flags("-momit-leaf-frame-pointer") @@ -174,9 +189,13 @@ endif() set(CMAKE_EXE_LINKER_FLAGS "-nostdlib -Wl,--enable-auto-image-base,--disable-auto-import,--disable-stdcall-fixup") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT} -Wl,--disable-stdcall-fixup") -SET(CMAKE_C_COMPILE_OBJECT "${CCACHE} -Wa,--compress-debug-sections -o -c ") +if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang") + set(_compress_debug_sections_flag "-Wa,--compress-debug-sections") +endif() + +SET(CMAKE_C_COMPILE_OBJECT "${CCACHE} ${_compress_debug_sections_flag} -o -c ") SET(CMAKE_CXX_COMPILE_OBJECT "${CCACHE} -o -c ") -set(CMAKE_ASM_COMPILE_OBJECT " -Wa,--compress-debug-sections -x assembler-with-cpp -o -I${REACTOS_SOURCE_DIR}/include/asm -I${REACTOS_BINARY_DIR}/include/asm -D__ASM__ -c ") +set(CMAKE_ASM_COMPILE_OBJECT " ${_compress_debug_sections_flag} -x assembler-with-cpp -o -I${REACTOS_SOURCE_DIR}/include/asm -I${REACTOS_BINARY_DIR}/include/asm -D__ASM__ -c ") set(CMAKE_RC_COMPILE_OBJECT " -O coff -DRC_INVOKED -D__WIN32__=1 -D__FLAT__=1 ${I18N_DEFS} ") set(CMAKE_DEPFILE_FLAGS_RC "--preprocessor \"${MINGW_TOOLCHAIN_PREFIX}gcc${MINGW_TOOLCHAIN_SUFFIX} -E -xc-header -MMD -MF -MT \" ") From dd0002fc056a1e7f24c31f730e2e7f036f06ccb0 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 2 Mar 2014 20:27:39 +0000 Subject: [PATCH 035/113] [CMAKE] * Use the GCC compatible dialect in Clang builds. svn path=/trunk/; revision=62387 --- reactos/cmake/gcc.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/reactos/cmake/gcc.cmake b/reactos/cmake/gcc.cmake index d8ea5436aa8..9cee3340626 100644 --- a/reactos/cmake/gcc.cmake +++ b/reactos/cmake/gcc.cmake @@ -31,6 +31,10 @@ if(GCC_VERSION VERSION_GREATER 4.7) add_compile_flags("-mstackrealign") endif() +if(CMAKE_C_COMPILER_ID STREQUAL "Clang") + add_compile_flags_language("-std=gnu89" "C") +endif() + add_compile_flags_language("-fno-rtti -fno-exceptions" "CXX") #bug From 2675d2c14561a3324935d76968658a44a3ae5a42 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 2 Mar 2014 20:41:36 +0000 Subject: [PATCH 036/113] [CMAKE] * Disable the MS extensions warning in Clang build. svn path=/trunk/; revision=62388 --- reactos/cmake/gcc.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/reactos/cmake/gcc.cmake b/reactos/cmake/gcc.cmake index 9cee3340626..5f2c99d6470 100644 --- a/reactos/cmake/gcc.cmake +++ b/reactos/cmake/gcc.cmake @@ -33,6 +33,7 @@ endif() if(CMAKE_C_COMPILER_ID STREQUAL "Clang") add_compile_flags_language("-std=gnu89" "C") + add_compile_flags("-Wno-microsoft") endif() add_compile_flags_language("-fno-rtti -fno-exceptions" "CXX") From 3800bc28b336430c54efa1b77965b2a384fafb3a Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 2 Mar 2014 20:42:26 +0000 Subject: [PATCH 037/113] [CRT/INTRIN_X86] * In Clang these are built-ins. svn path=/trunk/; revision=62389 --- reactos/include/crt/mingw32/intrin_x86.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/reactos/include/crt/mingw32/intrin_x86.h b/reactos/include/crt/mingw32/intrin_x86.h index d129b1ac700..c7a71455442 100644 --- a/reactos/include/crt/mingw32/intrin_x86.h +++ b/reactos/include/crt/mingw32/intrin_x86.h @@ -186,10 +186,12 @@ __INTRIN_INLINE short _InterlockedCompareExchange16(volatile short * const Desti return __sync_val_compare_and_swap(Destination, Comperand, Exchange); } +#ifndef __clang__ __INTRIN_INLINE long _InterlockedCompareExchange(volatile long * const Destination, const long Exchange, const long Comperand) { return __sync_val_compare_and_swap(Destination, Comperand, Exchange); } +#endif __INTRIN_INLINE void * _InterlockedCompareExchangePointer(void * volatile * const Destination, void * const Exchange, void * const Comperand) { @@ -224,10 +226,12 @@ __INTRIN_INLINE long _InterlockedExchangeAdd16(volatile short * const Addend, co return __sync_fetch_and_add(Addend, Value); } +#ifndef __clang__ __INTRIN_INLINE long _InterlockedExchangeAdd(volatile long * const Addend, const long Value) { return __sync_fetch_and_add(Addend, Value); } +#endif #if defined(_M_AMD64) __INTRIN_INLINE long long _InterlockedExchangeAdd64(volatile long long * const Addend, const long long Value) @@ -302,6 +306,7 @@ __INTRIN_INLINE long long _InterlockedXor64(volatile long long * const value, co } #endif +#ifndef __clang__ __INTRIN_INLINE long _InterlockedDecrement(volatile long * const lpAddend) { return __sync_sub_and_fetch(lpAddend, 1); @@ -311,6 +316,7 @@ __INTRIN_INLINE long _InterlockedIncrement(volatile long * const lpAddend) { return __sync_add_and_fetch(lpAddend, 1); } +#endif __INTRIN_INLINE short _InterlockedDecrement16(volatile short * const lpAddend) { From 96b7e0dd7ba32ecc5069d57b7b11aa1d2b4b05c9 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 2 Mar 2014 20:43:19 +0000 Subject: [PATCH 038/113] [NDK] * Fix a Clang warning. svn path=/trunk/; revision=62390 --- reactos/include/ndk/vffuncs.h | 1 - 1 file changed, 1 deletion(-) diff --git a/reactos/include/ndk/vffuncs.h b/reactos/include/ndk/vffuncs.h index 1ee2056d1b9..cd97645ecef 100644 --- a/reactos/include/ndk/vffuncs.h +++ b/reactos/include/ndk/vffuncs.h @@ -38,7 +38,6 @@ VfIsVerificationEnabled( ); VOID -NTAPI VfFailDeviceNode( _In_ PDEVICE_OBJECT PhysicalDeviceObject, _In_ ULONG BugCheckMajorCode, From 4916e626c0b3b1f09a65edea8706b3a5389b556c Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 2 Mar 2014 20:47:34 +0000 Subject: [PATCH 039/113] [CMAKE] * Disable PCH in Clang builds. We'll inspect this later. svn path=/trunk/; revision=62391 --- reactos/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/CMakeLists.txt b/reactos/CMakeLists.txt index 68143311105..f590ed83578 100644 --- a/reactos/CMakeLists.txt +++ b/reactos/CMakeLists.txt @@ -134,7 +134,7 @@ else() add_definitions(-D_WINKD_=1) endif() - if((NOT DEFINED PCH) AND (CMAKE_VERSION STREQUAL "2.8.12.1-ReactOS")) + if((NOT DEFINED PCH) AND (CMAKE_VERSION STREQUAL "2.8.12.1-ReactOS") AND (NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")) set(PCH 1) else() set(PCH 0) From cb992793ac31ff8f68c0a4f8e7d02423369c5587 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 2 Mar 2014 20:51:42 +0000 Subject: [PATCH 040/113] [CMAKE] * Add a Clang toolchain file. Only Windows build is tested ATM. svn path=/trunk/; revision=62392 --- reactos/toolchain-clang.cmake | 64 +++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 reactos/toolchain-clang.cmake diff --git a/reactos/toolchain-clang.cmake b/reactos/toolchain-clang.cmake new file mode 100644 index 00000000000..930dafcacfa --- /dev/null +++ b/reactos/toolchain-clang.cmake @@ -0,0 +1,64 @@ + +if(NOT ARCH) + set(ARCH i386) +endif() + +# Choose the right MinGW toolchain prefix +if (NOT DEFINED MINGW_TOOLCHAIN_PREFIX) + if(ARCH STREQUAL "i386") + + if(CMAKE_HOST_WIN32) + set(MINGW_TOOLCHAIN_PREFIX "" CACHE STRING "MinGW Toolchain Prefix") + else() + if(NOT $ENV{_ROSBE_VERSION} VERSION_LESS 2.1) + set(MINGW_TOOLCHAIN_PREFIX "i686-w64-mingw32-" CACHE STRING "MinGW-W64 Toolchain Prefix") + else() + set(MINGW_TOOLCHAIN_PREFIX "mingw32-" CACHE STRING "MinGW Toolchain Prefix") + endif() + endif() + + elseif(ARCH STREQUAL "amd64") + set(MINGW_TOOLCHAIN_PREFIX "x86_64-w64-mingw32-" CACHE STRING "MinGW Toolchain Prefix") + elseif(ARCH STREQUAL "arm") + set(MINGW_TOOLCHAIN_PREFIX "arm-mingw32ce-" CACHE STRING "MinGW Toolchain Prefix") + endif() +endif() + +if (NOT DEFINED MINGW_TOOLCHAIN_SUFFIX) + set(MINGW_TOOLCHAIN_SUFFIX "" CACHE STRING "MinGW Toolchain Suffix") +endif() + +if(ENABLE_CCACHE) + set(CCACHE "ccache" CACHE STRING "ccache") +else() + set(CCACHE "" CACHE STRING "ccache") +endif() + +# The name of the target operating system +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_SYSTEM_PROCESSOR i686) + +# Which tools to use +set(CMAKE_C_COMPILER clang) +set(CMAKE_CXX_COMPILER clang++) +set(CMAKE_ASM_COMPILER ${MINGW_TOOLCHAIN_PREFIX}gcc${MINGW_TOOLCHAIN_SUFFIX}) +set(CMAKE_ASM_COMPILER_ID "GNU") +set(CMAKE_MC_COMPILER ${MINGW_TOOLCHAIN_PREFIX}windmc) +set(CMAKE_RC_COMPILER ${MINGW_TOOLCHAIN_PREFIX}windres) +set(CMAKE_DLLTOOL ${MINGW_TOOLCHAIN_PREFIX}dlltool) + +if(NOT LTCG) + set(CMAKE_C_CREATE_STATIC_LIBRARY " crT ") +else() + set(CMAKE_C_CREATE_STATIC_LIBRARY " cr ") +endif() +set(CMAKE_CXX_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY}) +set(CMAKE_ASM_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY}) + +# Don't link with anything by default unless we say so +set(CMAKE_C_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C Libraries") + +#MARK_AS_ADVANCED(CLEAR CMAKE_CXX_STANDARD_LIBRARIES) +set(CMAKE_CXX_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C++ Libraries") + +set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nostdlib -Wl,--enable-auto-image-base,--disable-auto-import") From 9e835893d0f080676893add47f0dcc0e2f8c323b Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 2 Mar 2014 20:54:04 +0000 Subject: [PATCH 041/113] [PSEH3] - Switch parameters in _SEH3$_RegisterFrame and _SEH3$_RegisterTryLevel (just for consistency) - rename _SEH3$_RegisterTryLevel macro to _SEH3$_RegisterTryLevel_ - Add TryLevel and HandlerType fields to the scope table, since we'll need these later - Start factoring out some Clang specific macros svn path=/trunk/; revision=62393 --- reactos/include/reactos/libs/pseh/pseh3.h | 126 +++++++++++++++------- reactos/lib/pseh/i386/pseh3_i386.S | 52 ++++----- 2 files changed, 115 insertions(+), 63 deletions(-) diff --git a/reactos/include/reactos/libs/pseh/pseh3.h b/reactos/include/reactos/libs/pseh/pseh3.h index 0b75e7df732..28a06410fdf 100644 --- a/reactos/include/reactos/libs/pseh/pseh3.h +++ b/reactos/include/reactos/libs/pseh/pseh3.h @@ -21,6 +21,8 @@ typedef struct _SEH3$_SCOPE_TABLE { void *Target; void *Filter; + unsigned char TryLevel; + unsigned char HandlerType; } SEH3$_SCOPE_TABLE, *PSEH3$_SCOPE_TABLE; typedef struct _SEH3$_EXCEPTION_POINTERS @@ -57,6 +59,7 @@ typedef struct _SEH3$_REGISTRATION_FRAME /* Prevent gcc from inlining functions that use SEH. */ static inline __attribute__((always_inline)) __attribute__((returns_twice)) void _SEH3$_PreventInlining() {} +/* Unregister the root frame */ extern inline __attribute__((always_inline,gnu_inline)) void _SEH3$_UnregisterFrame(volatile SEH3$_REGISTRATION_FRAME *RegistrationFrame) { @@ -64,6 +67,7 @@ void _SEH3$_UnregisterFrame(volatile SEH3$_REGISTRATION_FRAME *RegistrationFrame : : [NewHead] "ir" (RegistrationFrame->Next) : "memory"); } +/* Unregister a trylevel frame */ extern inline __attribute__((always_inline,gnu_inline)) void _SEH3$_UnregisterTryLevel( volatile SEH3$_REGISTRATION_FRAME *TrylevelFrame) @@ -84,41 +88,80 @@ int __cdecl __attribute__((error ("Can only be used inside a __finally block.")) unsigned long __cdecl __attribute__((error("Can only be used inside an exception filter or __except block."))) _exception_code(void); void * __cdecl __attribute__((error("Can only be used inside an exception filter."))) _exception_info(void); -/* Define the registers that get clobbered, when reaching the __except block. - We specify ebp on optimized builds without frame pointer, since it will be - used by GCC as a general purpose register then. */ -#if defined(__OPTIMIZE__) && defined(_ALLOW_OMIT_FRAME_POINTER) -#define _SEH3$_CLOBBER_ON_EXCEPTION "ebp", "ebx", "ecx", "edx", "esi", "edi", "flags", "memory" -#else -#define _SEH3$_CLOBBER_ON_EXCEPTION "ebx", "ecx", "edx", "esi", "edi", "flags", "memory" -#endif - /* This attribute allows automatic cleanup of the registered frames */ #define _SEH3$_AUTO_CLEANUP __attribute__((cleanup(_SEH3$_AutoCleanup))) -#define _SEH3$_ASM_GOTO(_Asm, _Label, ...) asm goto (_Asm : : : "memory", ## __VA_ARGS__ : _Label) +/* CLANG specific definitions! */ +#ifdef __clang__ + +/* CLANG doesn't have asm goto! */ +#define _SEH3$_ASM_GOTO(_Label, ...) + +int +__attribute__((regparm(2))) +__attribute__((returns_twice)) +_SEH3$_RegisterFrameWithNonVolatiles( + volatile SEH3$_REGISTRATION_FRAME* RegistrationFrame, + const SEH3$_SCOPE_TABLE* ScopeTable); + +#define _SEH3$_RegisterFrame_(_TrylevelFrame, _DataTable) \ + do { \ + int result = _SEH3$_RegisterFrameWithNonVolatiles(_TrylevelFrame, _DataTable); \ + if (__builtin_expect(result != 0, 0)) \ + { \ + if (result == 1) goto _SEH3$_l_FilterOrFinally; \ + if (result == 2) goto _SEH3$_l_HandlerTarget; \ + goto _SEH3$_l_BeforeFilterOrFinally; \ + } \ + } while(0) + +int +__attribute__((regparm(2))) +__attribute__((returns_twice)) +_SEH3$_RegisterTryLevelWithNonVolatiles( + volatile SEH3$_REGISTRATION_FRAME* RegistrationFrame, + const SEH3$_SCOPE_TABLE* ScopeTable); + +#define _SEH3$_RegisterTryLevel_(_TrylevelFrame, _DataTable) \ + do { \ + int result = _SEH3$_RegisterTryLevelWithNonVolatiles(_TrylevelFrame, _DataTable); \ + if (__builtin_expect(result != 0, 0)) \ + { \ + if (result == 1) goto _SEH3$_l_FilterOrFinally; \ + if (result == 2) goto _SEH3$_l_HandlerTarget; \ + goto _SEH3$_l_BeforeFilterOrFinally; \ + } \ + } while(0) + +#else /* !__clang__ */ + +#define _SEH3$_ASM_GOTO(_Label, ...) asm goto ("#\n" : : : "memory", ## __VA_ARGS__ : _Label) + +/* This is an asm wrapper around _SEH3$_RegisterFrame */ +#define _SEH3$_RegisterFrame_(_TrylevelFrame, _DataTable) \ + asm goto ("leal %1, %%edx\n" \ + "call __SEH3$_RegisterFrame\n" \ + : \ + : "a" (_TrylevelFrame), "m" (*(_DataTable)) \ + : "ecx", "edx", "memory" \ + : _SEH3$_l_HandlerTarget) + +/* This is an asm wrapper around _SEH3$_RegisterTryLevel */ +#define _SEH3$_RegisterTryLevel_(_TrylevelFrame, _DataTable) \ + asm goto ("leal %1, %%edx\n" \ + "call __SEH3$_RegisterTryLevel\n" \ + : \ + : "a" (_TrylevelFrame), "m" (*(_DataTable)) \ + : "ecx", "edx", "memory" \ + : _SEH3$_l_HandlerTarget) + +#endif /* __clang__ */ + #define _SEH3$_DECLARE_EXCEPT_INTRINSICS() \ inline __attribute__((always_inline, gnu_inline)) \ unsigned long _exception_code() { return _SEH3$_TrylevelFrame.ExceptionPointers->ExceptionRecord->ExceptionCode; } -/* This is an asm wrapper around _SEH3$_RegisterFrame */ -#define _SEH3$_RegisterFrame(_TrylevelFrame, _DataTable, _Target) \ - asm goto ("leal %0, %%edx\n" \ - "call __SEH3$_RegisterFrame\n" \ - : \ - : "m" (*(_TrylevelFrame)), "a" (_DataTable) \ - : "ecx", "edx", "memory" \ - : _Target) - -/* This is an asm wrapper around _SEH3$_EnterTryLevel */ -#define _SEH3$_RegisterTryLevel(_TrylevelFrame, _DataTable, _Target) \ - asm goto ("leal %0, %%edx\n" \ - "call __SEH3$_RegisterTryLevel\n" \ - : \ - : "m" (*(_TrylevelFrame)), "a" (_DataTable) \ - : "ecx", "edx", "memory" \ - : _Target) /* On GCC the filter function is a nested function with __fastcall calling convention. The eax register contains a base address the function uses @@ -176,13 +219,22 @@ void * __cdecl __attribute__((error("Can only be used inside an exception filter _SEH3$_FinallyFunction(1); \ } +/* Define the registers that get clobbered, when reaching the __except block. + We specify ebp on optimized builds without frame pointer, since it will be + used by GCC as a general purpose register then. */ +#if defined(__OPTIMIZE__) && defined(_ALLOW_OMIT_FRAME_POINTER) +#define _SEH3$_CLOBBER_ON_EXCEPTION "ebp", "ebx", "ecx", "edx", "esi", "edi", "flags", "memory" +#else +#define _SEH3$_CLOBBER_ON_EXCEPTION "ebx", "ecx", "edx", "esi", "edi", "flags", "memory" +#endif + /* This construct scares GCC so much, that it will stop moving code around into places that are never executed. */ #define _SEH3$_SCARE_GCC() \ void *plabel; \ - _SEH3$_ASM_GOTO("#\n", _SEH3$_l_BeforeTry); \ - _SEH3$_ASM_GOTO("#\n", _SEH3$_l_HandlerTarget); \ - _SEH3$_ASM_GOTO("#\n", _SEH3$_l_OnException); \ + _SEH3$_ASM_GOTO(_SEH3$_l_BeforeTry); \ + _SEH3$_ASM_GOTO(_SEH3$_l_HandlerTarget); \ + _SEH3$_ASM_GOTO(_SEH3$_l_OnException); \ asm volatile ("#" : "=a"(plabel) : "p"(&&_SEH3$_l_BeforeTry), "p"(&&_SEH3$_l_HandlerTarget), "p"(&&_SEH3$_l_OnException) \ : _SEH3$_CLOBBER_ON_EXCEPTION ); \ goto _SEH3$_l_OnException; @@ -226,7 +278,7 @@ void * __cdecl __attribute__((error("Can only be used inside an exception filter goto _SEH3$_l_EndTry; \ \ _SEH3$_l_BeforeTry: (void)0; \ - _SEH3$_ASM_GOTO("#\n", _SEH3$_l_OnException); \ + _SEH3$_ASM_GOTO(_SEH3$_l_OnException); \ \ /* Forward declaration of the filter function */ \ _SEH3$_DECLARE_FILTER_FUNC(_SEH3$_FilterFunction); \ @@ -235,8 +287,8 @@ void * __cdecl __attribute__((error("Can only be used inside an exception filter static const SEH3$_SCOPE_TABLE _SEH3$_ScopeTable = { &&_SEH3$_l_HandlerTarget, _SEH3$_FILTER(&_SEH3$_FilterFunction, (__VA_ARGS__)) }; \ \ /* Register the registration record. */ \ - if (_SEH3$_TryLevel == 1) _SEH3$_RegisterFrame(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable, _SEH3$_l_HandlerTarget); \ - else _SEH3$_RegisterTryLevel(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable, _SEH3$_l_HandlerTarget); \ + if (_SEH3$_TryLevel == 1) _SEH3$_RegisterFrame_(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable); \ + else _SEH3$_RegisterTryLevel_(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable); \ \ /* Emit the filter function */ \ _SEH3$_DEFINE_FILTER_FUNC(_SEH3$_FilterFunction, (__VA_ARGS__)) \ @@ -268,7 +320,7 @@ void * __cdecl __attribute__((error("Can only be used inside an exception filter goto _SEH3$_l_EndTry; \ \ _SEH3$_l_BeforeTry: (void)0; \ - _SEH3$_ASM_GOTO("#\n", _SEH3$_l_OnException); \ + _SEH3$_ASM_GOTO(_SEH3$_l_OnException); \ \ /* Forward declaration of the finally function */ \ _SEH3$_DECLARE_FILTER_FUNC(_SEH3$_FinallyFunction); \ @@ -277,8 +329,8 @@ void * __cdecl __attribute__((error("Can only be used inside an exception filter static const SEH3$_SCOPE_TABLE _SEH3$_ScopeTable = { 0, &_SEH3$_FinallyFunction }; \ \ /* Register the registration record. */ \ - if (_SEH3$_TryLevel == 1) _SEH3$_RegisterFrame(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable, _SEH3$_l_HandlerTarget); \ - else _SEH3$_RegisterTryLevel(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable, _SEH3$_l_HandlerTarget); \ + if (_SEH3$_TryLevel == 1) _SEH3$_RegisterFrame_(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable); \ + else _SEH3$_RegisterTryLevel_(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable); \ \ goto _SEH3$_l_DoTry; \ \ @@ -300,7 +352,7 @@ void * __cdecl __attribute__((error("Can only be used inside an exception filter _SEH3$_SCARE_GCC() \ \ _SEH3$_l_EndTry:(void)0; \ - _SEH3$_ASM_GOTO("#\n", _SEH3$_l_OnException); \ + _SEH3$_ASM_GOTO(_SEH3$_l_OnException); \ \ /* Implementation of the auto cleanup function */ \ _SEH3$_DEFINE_CLEANUP_FUNC(_SEH3$_AutoCleanup); \ diff --git a/reactos/lib/pseh/i386/pseh3_i386.S b/reactos/lib/pseh/i386/pseh3_i386.S index e647312ee74..bd37a74642f 100644 --- a/reactos/lib/pseh/i386/pseh3_i386.S +++ b/reactos/lib/pseh/i386/pseh3_i386.S @@ -18,37 +18,37 @@ * __attribute__((regparm(2))) * __attribute__((returns_twice)) * _SEH3$_RegisterFrame[WithNonVolatiles]( - * PSEH_DATA_TABLE DataTable, - * PSEH_REGISTRATION_FRAME RegistrationRecord); + * PSEH3$_REGISTRATION_FRAME RegistrationFrame, + * PSEH3$_SCOPE_TABLE ScopeTable); */ .global __SEH3$_RegisterFrameWithNonVolatiles __SEH3$_RegisterFrameWithNonVolatiles: /* Save non-volatiles in the registration frame */ - mov [edx + SEH3_REGISTRATION_FRAME_Ebx], ebx - mov [edx + SEH3_REGISTRATION_FRAME_Esi], esi - mov [edx + SEH3_REGISTRATION_FRAME_Edi], edi + mov [eax + SEH3_REGISTRATION_FRAME_Ebx], ebx + mov [eax + SEH3_REGISTRATION_FRAME_Esi], esi + mov [eax + SEH3_REGISTRATION_FRAME_Edi], edi .global __SEH3$_RegisterFrame __SEH3$_RegisterFrame: /* Save the address of the static data table */ - mov [edx + SEH3_REGISTRATION_FRAME_ScopeTable], eax + mov [eax + SEH3_REGISTRATION_FRAME_ScopeTable], edx /* Set the handler address */ - mov dword ptr [edx + SEH3_REGISTRATION_FRAME_Handler], offset __SEH3$_except_handler + mov dword ptr [eax + SEH3_REGISTRATION_FRAME_Handler], offset __SEH3$_except_handler /* Set this as the end of the internal chain */ - mov dword ptr [edx + SEH3_REGISTRATION_FRAME_EndOfChain], edx + mov dword ptr [eax + SEH3_REGISTRATION_FRAME_EndOfChain], eax /* Register the frame in the TEB */ - mov eax, dword ptr fs:[0] - mov [edx + SEH3_REGISTRATION_FRAME_Next], eax - mov dword ptr fs:[0], edx + mov edx, dword ptr fs:[0] + mov [eax + SEH3_REGISTRATION_FRAME_Next], edx + mov dword ptr fs:[0], eax /* Save the stack registers */ - mov [edx + SEH3_REGISTRATION_FRAME_Esp], esp - mov [edx + SEH3_REGISTRATION_FRAME_Ebp], ebp + mov [eax + SEH3_REGISTRATION_FRAME_Esp], esp + mov [eax + SEH3_REGISTRATION_FRAME_Ebp], ebp /* Set eax to 0 to indicate 1st return */ xor eax, eax @@ -60,39 +60,39 @@ __SEH3$_RegisterFrame: * __attribute__((regparm(2))) * __attribute__((returns_twice)) * _SEH3$_RegisterTryLevel[WithNonVolatiles]( - * PSEH_DATA_TABLE DataTable, - * PSEH_REGISTRATION_FRAME RegistrationRecord); + * PSEH3$_REGISTRATION_FRAME RegistrationFrame, + * PSEH3$_SCOPE_TABLE ScopeTable); */ .global __SEH3$_RegisterTryLevelWithNonVolatiles __SEH3$_RegisterTryLevelWithNonVolatiles: /* Save non-volatiles in the registration frame */ - mov [edx + SEH3_REGISTRATION_FRAME_Ebx], ebx - mov [edx + SEH3_REGISTRATION_FRAME_Esi], esi - mov [edx + SEH3_REGISTRATION_FRAME_Edi], edi + mov [eax + SEH3_REGISTRATION_FRAME_Ebx], ebx + mov [eax + SEH3_REGISTRATION_FRAME_Esi], esi + mov [eax + SEH3_REGISTRATION_FRAME_Edi], edi .global __SEH3$_RegisterTryLevel __SEH3$_RegisterTryLevel: /* Save the address of the static data table */ - mov [edx + SEH3_REGISTRATION_FRAME_ScopeTable], eax + mov [eax + SEH3_REGISTRATION_FRAME_ScopeTable], edx /* Set the handler address to NULL as identification */ - and dword ptr [edx + SEH3_REGISTRATION_FRAME_Handler], 0 + and dword ptr [eax + SEH3_REGISTRATION_FRAME_Handler], 0 /* Get the current registered frame */ - mov eax, dword ptr fs:[0] + mov edx, dword ptr fs:[0] /* Get the current end of the chain and set this as Next */ - mov ecx, [eax + SEH3_REGISTRATION_FRAME_EndOfChain] - mov [edx + SEH3_REGISTRATION_FRAME_Next], ecx + mov ecx, [edx + SEH3_REGISTRATION_FRAME_EndOfChain] + mov [eax + SEH3_REGISTRATION_FRAME_Next], ecx /* Set this as the end of the internal chain */ - mov dword ptr [eax + SEH3_REGISTRATION_FRAME_EndOfChain], edx + mov dword ptr [edx + SEH3_REGISTRATION_FRAME_EndOfChain], eax /* Save the stack registers */ - mov [edx + SEH3_REGISTRATION_FRAME_Esp], esp - mov [edx + SEH3_REGISTRATION_FRAME_Ebp], ebp + mov [eax + SEH3_REGISTRATION_FRAME_Esp], esp + mov [eax + SEH3_REGISTRATION_FRAME_Ebp], ebp /* Set eax to 0 to indicate 1st return */ xor eax, eax From d4a5969c226b3cc07bbce22d09925e72f27a1f55 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 2 Mar 2014 20:57:57 +0000 Subject: [PATCH 042/113] [CMAKE] * Remove some unsupported warning from the Clang build. svn path=/trunk/; revision=62394 --- reactos/lib/3rdparty/cardlib/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/lib/3rdparty/cardlib/CMakeLists.txt b/reactos/lib/3rdparty/cardlib/CMakeLists.txt index 87cbb500bd4..8369f57d970 100644 --- a/reactos/lib/3rdparty/cardlib/CMakeLists.txt +++ b/reactos/lib/3rdparty/cardlib/CMakeLists.txt @@ -19,6 +19,6 @@ add_library(cardlib ${SOURCE}) add_dependencies(cardlib psdk) add_pch(cardlib cardlib.h SOURCE) -if(NOT MSVC) +if(NOT MSVC AND (NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")) add_target_compile_flags(cardlib "-Wno-unused-but-set-variable") endif() From 0dd2f479dc87434ca481d19ef32861a8d74c4f10 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 2 Mar 2014 21:04:20 +0000 Subject: [PATCH 043/113] [SHELL32] * Remove what seems to be a useless source file. This variable is defined and used in shell32_main.cpp. svn path=/trunk/; revision=62395 --- reactos/dll/win32/shell32/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reactos/dll/win32/shell32/CMakeLists.txt b/reactos/dll/win32/shell32/CMakeLists.txt index f84298872e7..f7fb726678d 100644 --- a/reactos/dll/win32/shell32/CMakeLists.txt +++ b/reactos/dll/win32/shell32/CMakeLists.txt @@ -16,7 +16,7 @@ include_directories( spec2def(shell32.dll shell32.spec ADD_IMPORTLIB) list(APPEND SOURCE - authors.cpp + #authors.cpp autocomplete.cpp brsfolder.cpp changenotify.cpp @@ -54,6 +54,7 @@ list(APPEND SOURCE folders/fonts.cpp folders/cpanel.cpp folders/recyclebin.cpp + droptargets/CexeDropHandler.cpp shlexec.cpp shlfileop.cpp shlfolder.cpp From 257374c12b195ae1aaaf2e59df1bc5b392810cb8 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 2 Mar 2014 21:18:32 +0000 Subject: [PATCH 044/113] [PSDK] * Don't warn about ignored attributes in Clang build. svn path=/trunk/; revision=62396 --- reactos/include/psdk/strsafe.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/reactos/include/psdk/strsafe.h b/reactos/include/psdk/strsafe.h index f3f7eac7f21..0a891601520 100644 --- a/reactos/include/psdk/strsafe.h +++ b/reactos/include/psdk/strsafe.h @@ -12,6 +12,11 @@ #include #include +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wignored-attributes" +#endif + #ifndef _SIZE_T_DEFINED #define _SIZE_T_DEFINED #undef size_t @@ -2059,4 +2064,9 @@ STRSAFE_INLINE_API StringGetsExWorkerW(STRSAFE_LPWSTR pszDest,size_t cchDest,siz #undef _getws #define _getws _getws_instead_use_StringCbGetsW_or_StringCchGetsW; #endif + +#ifdef __clang__ +#pragma clang diagnostic pop #endif + +#endif /* _STRSAFE_H_INCLUDED_ */ From 4d03b99484d435856e14c166b387564ad9317eac Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 2 Mar 2014 21:23:04 +0000 Subject: [PATCH 045/113] [PSDK][SHELL32] * Fix ShellMessageBox{A,W} calling convention. Spotted by Clang. svn path=/trunk/; revision=62397 --- reactos/dll/win32/shell32/shellord.cpp | 4 ++-- reactos/include/psdk/shellapi.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/reactos/dll/win32/shell32/shellord.cpp b/reactos/dll/win32/shell32/shellord.cpp index 629e1f832cd..6d19541fb11 100644 --- a/reactos/dll/win32/shell32/shellord.cpp +++ b/reactos/dll/win32/shell32/shellord.cpp @@ -309,7 +309,7 @@ BOOL WINAPI RegisterShellHook( * ordinal. If you change the implementation here please update the code in * shlwapi as well. */ -EXTERN_C int WINAPI ShellMessageBoxW( +EXTERN_C int ShellMessageBoxW( HINSTANCE hInstance, HWND hWnd, LPCWSTR lpText, @@ -367,7 +367,7 @@ EXTERN_C int WINAPI ShellMessageBoxW( * NOTES * Exported by ordinal */ -EXTERN_C int WINAPI ShellMessageBoxA( +EXTERN_C int ShellMessageBoxA( HINSTANCE hInstance, HWND hWnd, LPCSTR lpText, diff --git a/reactos/include/psdk/shellapi.h b/reactos/include/psdk/shellapi.h index b4c2c13d73e..a116c918b95 100644 --- a/reactos/include/psdk/shellapi.h +++ b/reactos/include/psdk/shellapi.h @@ -476,7 +476,6 @@ ShellAboutW( _In_opt_ HICON hIcon); int -WINAPI ShellMessageBoxA( _In_opt_ HINSTANCE hAppInst, _In_opt_ HWND hWnd, @@ -486,7 +485,6 @@ ShellMessageBoxA( ...); int -WINAPI ShellMessageBoxW( _In_opt_ HINSTANCE hAppInst, _In_opt_ HWND hWnd, From a82fcfc024832c72b9d5fc11c2d9b85193ebab07 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 2 Mar 2014 21:35:18 +0000 Subject: [PATCH 046/113] [SHELL32] * Remove accidentally added line (you'll get this Drag and Drop fun later ;) ). svn path=/trunk/; revision=62398 --- reactos/dll/win32/shell32/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/reactos/dll/win32/shell32/CMakeLists.txt b/reactos/dll/win32/shell32/CMakeLists.txt index f7fb726678d..f0c920e3409 100644 --- a/reactos/dll/win32/shell32/CMakeLists.txt +++ b/reactos/dll/win32/shell32/CMakeLists.txt @@ -54,7 +54,6 @@ list(APPEND SOURCE folders/fonts.cpp folders/cpanel.cpp folders/recyclebin.cpp - droptargets/CexeDropHandler.cpp shlexec.cpp shlfileop.cpp shlfolder.cpp From cdcdc82cda33bb67fad7cd4890d07bdfb5661f1e Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 2 Mar 2014 21:40:58 +0000 Subject: [PATCH 047/113] [LIB/ATL] * Who came up with this _declspec thing ? Was it you Arch ? svn path=/trunk/; revision=62399 --- reactos/lib/atl/atlwin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/lib/atl/atlwin.h b/reactos/lib/atl/atlwin.h index cc925758585..7e4f10462f9 100644 --- a/reactos/lib/atl/atlwin.h +++ b/reactos/lib/atl/atlwin.h @@ -360,7 +360,7 @@ public: } }; -_declspec(selectany) RECT CWindow::rcDefault = { CW_USEDEFAULT, CW_USEDEFAULT, 0, 0 }; +__declspec(selectany) RECT CWindow::rcDefault = { CW_USEDEFAULT, CW_USEDEFAULT, 0, 0 }; template class CWindowImplBaseT : public TBase, public CMessageMap From 665aba875f83f946e4bce96369c0778754cf9ce7 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 2 Mar 2014 21:42:19 +0000 Subject: [PATCH 048/113] [PSDK] * Fix a FIXME.. Actually, the LLVM/Clang folks did this ;) svn path=/trunk/; revision=62400 --- reactos/include/psdk/guiddef.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/reactos/include/psdk/guiddef.h b/reactos/include/psdk/guiddef.h index 5b7f7267872..be843cc085f 100644 --- a/reactos/include/psdk/guiddef.h +++ b/reactos/include/psdk/guiddef.h @@ -32,13 +32,8 @@ typedef struct _GUID #endif #ifndef DECLSPEC_SELECTANY -#ifdef __clang__ -/* FIXME: http://llvm.org/bugs/show_bug.cgi?id=13778 */ -#define DECLSPEC_SELECTANY __attribute__((weak)) -#else #define DECLSPEC_SELECTANY __declspec(selectany) #endif -#endif #ifndef EXTERN_C #ifdef __cplusplus From 2948ed43c56c76ce78a5609c469ba9871351d1fb Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 2 Mar 2014 21:45:44 +0000 Subject: [PATCH 049/113] [SHELL32] * Comment out some unused variables. * Remove some unused default debug channel declarations. svn path=/trunk/; revision=62401 --- reactos/dll/win32/shell32/CMenuDeskBar.cpp | 3 --- reactos/dll/win32/shell32/folders.cpp | 2 -- reactos/dll/win32/shell32/shellpath.cpp | 12 ++++++++---- reactos/dll/win32/shell32/shpolicy.cpp | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/reactos/dll/win32/shell32/CMenuDeskBar.cpp b/reactos/dll/win32/shell32/CMenuDeskBar.cpp index 140b663794a..485553b4e8f 100644 --- a/reactos/dll/win32/shell32/CMenuDeskBar.cpp +++ b/reactos/dll/win32/shell32/CMenuDeskBar.cpp @@ -1,7 +1,5 @@ #include "precomp.h" -WINE_DEFAULT_DEBUG_CHANNEL(shell); - HRESULT STDMETHODCALLTYPE CMenuDeskBar::Popup( POINTL *ppt, RECTL *prcExclude, @@ -137,4 +135,3 @@ HRESULT STDMETHODCALLTYPE CMenuDeskBar::TranslateAcceleratorIO(THIS_ LPMSG lpMsg { return S_OK; } - diff --git a/reactos/dll/win32/shell32/folders.cpp b/reactos/dll/win32/shell32/folders.cpp index 14501642d0d..9df6d6d4744 100644 --- a/reactos/dll/win32/shell32/folders.cpp +++ b/reactos/dll/win32/shell32/folders.cpp @@ -19,8 +19,6 @@ #include "precomp.h" -WINE_DEFAULT_DEBUG_CHANNEL(shell); - WCHAR swShell32Name[MAX_PATH]; DWORD NumIconOverlayHandlers = 0; diff --git a/reactos/dll/win32/shell32/shellpath.cpp b/reactos/dll/win32/shell32/shellpath.cpp index 8511feffda9..de7e7e72ef7 100644 --- a/reactos/dll/win32/shell32/shellpath.cpp +++ b/reactos/dll/win32/shell32/shellpath.cpp @@ -564,16 +564,20 @@ static const WCHAR DefaultW[] = {'.','D','e','f','a','u','l','t','\0'}; static const WCHAR AllUsersProfileW[] = {'%','A','L','L','U','S','E','R','S','P','R','O','F','I','L','E','%','\0'}; static const WCHAR UserProfileW[] = {'%','U','S','E','R','P','R','O','F','I','L','E','%','\0'}; static const WCHAR SystemDriveW[] = {'%','S','y','s','t','e','m','D','r','i','v','e','%','\0'}; +static const WCHAR szSHFolders[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','E','x','p','l','o','r','e','r','\\','S','h','e','l','l',' ','F','o','l','d','e','r','s','\0'}; +static const WCHAR szSHUserFolders[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','E','x','p','l','o','r','e','r','\\','U','s','e','r',' ','S','h','e','l','l',' ','F','o','l','d','e','r','s','\0'}; + +#if 0 static const WCHAR ProfileListW[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s',' ','N','T','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','P','r','o','f','i','l','e','L','i','s','t',0}; static const WCHAR ProfilesDirectoryW[] = {'P','r','o','f','i','l','e','s','D','i','r','e','c','t','o','r','y',0}; static const WCHAR AllUsersProfileValueW[] = {'A','l','l','U','s','e','r','s','P','r','o','f','i','l','e','\0'}; -static const WCHAR szSHFolders[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','E','x','p','l','o','r','e','r','\\','S','h','e','l','l',' ','F','o','l','d','e','r','s','\0'}; -static const WCHAR szSHUserFolders[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','E','x','p','l','o','r','e','r','\\','U','s','e','r',' ','S','h','e','l','l',' ','F','o','l','d','e','r','s','\0'}; +static const WCHAR szDefaultProfileDirW[] = {'p','r','o','f','i','l','e','s','\0'}; +static const WCHAR AllUsersW[] = {'A','l','l',' ','U','s','e','r','s','\0'}; +#endif + /* This defaults to L"Documents and Settings" on Windows 2000/XP, but we're * acting more Windows 9x-like for now. */ -static const WCHAR szDefaultProfileDirW[] = {'p','r','o','f','i','l','e','s','\0'}; -static const WCHAR AllUsersW[] = {'A','l','l',' ','U','s','e','r','s','\0'}; typedef enum _CSIDL_Type { CSIDL_Type_User, diff --git a/reactos/dll/win32/shell32/shpolicy.cpp b/reactos/dll/win32/shell32/shpolicy.cpp index c9f0ef3668e..69d92968da1 100644 --- a/reactos/dll/win32/shell32/shpolicy.cpp +++ b/reactos/dll/win32/shell32/shpolicy.cpp @@ -67,7 +67,7 @@ static const char strNoChangeStartMenu[] = {"NoChangeStartMenu"}; static const char strNoWindowsUpdate[] = {"NoWindowsUpdate"}; static const char strNoSetActiveDesktop[] = {"NoSetActiveDesktop"}; static const char strNoForgetSoftwareUpdate[] = {"NoForgetSoftwareUpdate"}; -static const char strNoMSAppLogo[] = {"NoMSAppLogo5ChannelNotify"}; +//static const char strNoMSAppLogo[] = {"NoMSAppLogo5ChannelNotify"}; static const char strForceCopyACLW[] = {"ForceCopyACLWithFile"}; static const char strNoResolveTrk[] = {"NoResolveTrack"}; static const char strNoResolveSearch[] = {"NoResolveSearch"}; From a12d2d5e6cd6d664235d65e539c8d5c97da0ee58 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 2 Mar 2014 22:04:15 +0000 Subject: [PATCH 050/113] [PSEH3] Start factoring out compiler support for nested functions (neither CLANG not C++ support it, so we will add some other crazy hacks later ;-)) svn path=/trunk/; revision=62402 --- reactos/include/reactos/libs/pseh/pseh3.h | 64 +++++++++++++++-------- reactos/lib/pseh/i386/pseh3.c | 5 +- 2 files changed, 45 insertions(+), 24 deletions(-) diff --git a/reactos/include/reactos/libs/pseh/pseh3.h b/reactos/include/reactos/libs/pseh/pseh3.h index 28a06410fdf..16a179089a8 100644 --- a/reactos/include/reactos/libs/pseh/pseh3.h +++ b/reactos/include/reactos/libs/pseh/pseh3.h @@ -89,7 +89,7 @@ unsigned long __cdecl __attribute__((error("Can only be used inside an exception void * __cdecl __attribute__((error("Can only be used inside an exception filter."))) _exception_info(void); /* This attribute allows automatic cleanup of the registered frames */ -#define _SEH3$_AUTO_CLEANUP __attribute__((cleanup(_SEH3$_AutoCleanup))) +#define _SEH3$_AUTO_CLEANUP __attribute__((cleanup(_SEH3$_Unregister))) /* CLANG specific definitions! */ #ifdef __clang__ @@ -133,6 +133,8 @@ _SEH3$_RegisterTryLevelWithNonVolatiles( } \ } while(0) +#define _SEH3$_SCARE_GCC() + #else /* !__clang__ */ #define _SEH3$_ASM_GOTO(_Label, ...) asm goto ("#\n" : : : "memory", ## __VA_ARGS__ : _Label) @@ -155,14 +157,49 @@ _SEH3$_RegisterTryLevelWithNonVolatiles( : "ecx", "edx", "memory" \ : _SEH3$_l_HandlerTarget) +/* Define the registers that get clobbered, when reaching the __except block. + We specify ebp on optimized builds without frame pointer, since it will be + used by GCC as a general purpose register then. */ +#if defined(__OPTIMIZE__) && defined(_ALLOW_OMIT_FRAME_POINTER) +#define _SEH3$_CLOBBER_ON_EXCEPTION "ebp", "ebx", "ecx", "edx", "esi", "edi", "flags", "memory" +#else +#define _SEH3$_CLOBBER_ON_EXCEPTION "ebx", "ecx", "edx", "esi", "edi", "flags", "memory" +#endif + +/* This construct scares GCC so much, that it will stop moving code + around into places that are never executed. */ +#define _SEH3$_SCARE_GCC() \ + void *plabel; \ + _SEH3$_ASM_GOTO(_SEH3$_l_BeforeTry); \ + _SEH3$_ASM_GOTO(_SEH3$_l_HandlerTarget); \ + _SEH3$_ASM_GOTO(_SEH3$_l_OnException); \ + asm volatile ("#" : "=a"(plabel) : "p"(&&_SEH3$_l_BeforeTry), "p"(&&_SEH3$_l_HandlerTarget), "p"(&&_SEH3$_l_OnException) \ + : _SEH3$_CLOBBER_ON_EXCEPTION ); \ + goto _SEH3$_l_OnException; + #endif /* __clang__ */ +/* Neither CLANG nor C++ support nested functions */ +#if defined(__cplusplus) || defined(__clang__) + +/* Use the global unregister function */ +void +__attribute__((regparm(1))) +_SEH3$_Unregister( + volatile SEH3$_REGISTRATION_FRAME *Frame); + +/* These are only dummies here */ +#define _SEH3$_DECLARE_CLEANUP_FUNC(_Name) +#define _SEH3$_DEFINE_CLEANUP_FUNC(_Name) +#define _SEH3$_DECLARE_FILTER_FUNC(_Name) +#define _SEH3$_DEFINE_DUMMY_FINALLY(_Name) + +#else /* __cplusplus || __clang__ */ #define _SEH3$_DECLARE_EXCEPT_INTRINSICS() \ inline __attribute__((always_inline, gnu_inline)) \ unsigned long _exception_code() { return _SEH3$_TrylevelFrame.ExceptionPointers->ExceptionRecord->ExceptionCode; } - /* On GCC the filter function is a nested function with __fastcall calling convention. The eax register contains a base address the function uses to address the callers stack frame. __fastcall is chosen, because it gives @@ -219,25 +256,8 @@ _SEH3$_RegisterTryLevelWithNonVolatiles( _SEH3$_FinallyFunction(1); \ } -/* Define the registers that get clobbered, when reaching the __except block. - We specify ebp on optimized builds without frame pointer, since it will be - used by GCC as a general purpose register then. */ -#if defined(__OPTIMIZE__) && defined(_ALLOW_OMIT_FRAME_POINTER) -#define _SEH3$_CLOBBER_ON_EXCEPTION "ebp", "ebx", "ecx", "edx", "esi", "edi", "flags", "memory" -#else -#define _SEH3$_CLOBBER_ON_EXCEPTION "ebx", "ecx", "edx", "esi", "edi", "flags", "memory" -#endif +#endif /* __cplusplus || __clang__ */ -/* This construct scares GCC so much, that it will stop moving code - around into places that are never executed. */ -#define _SEH3$_SCARE_GCC() \ - void *plabel; \ - _SEH3$_ASM_GOTO(_SEH3$_l_BeforeTry); \ - _SEH3$_ASM_GOTO(_SEH3$_l_HandlerTarget); \ - _SEH3$_ASM_GOTO(_SEH3$_l_OnException); \ - asm volatile ("#" : "=a"(plabel) : "p"(&&_SEH3$_l_BeforeTry), "p"(&&_SEH3$_l_HandlerTarget), "p"(&&_SEH3$_l_OnException) \ - : _SEH3$_CLOBBER_ON_EXCEPTION ); \ - goto _SEH3$_l_OnException; #define _SEH3_TRY \ @@ -259,7 +279,7 @@ _SEH3$_RegisterTryLevelWithNonVolatiles( }; \ \ /* Forward declaration of the auto cleanup function */ \ - _SEH3$_DECLARE_CLEANUP_FUNC(_SEH3$_AutoCleanup); \ + _SEH3$_DECLARE_CLEANUP_FUNC(_SEH3$_Unregister); \ \ /* Allocate a registration frame */ \ volatile SEH3$_REGISTRATION_FRAME _SEH3$_AUTO_CLEANUP _SEH3$_TrylevelFrame; \ @@ -355,7 +375,7 @@ _SEH3$_RegisterTryLevelWithNonVolatiles( _SEH3$_ASM_GOTO(_SEH3$_l_OnException); \ \ /* Implementation of the auto cleanup function */ \ - _SEH3$_DEFINE_CLEANUP_FUNC(_SEH3$_AutoCleanup); \ + _SEH3$_DEFINE_CLEANUP_FUNC(_SEH3$_Unregister); \ \ /* Close the outer scope */ \ } while (0); diff --git a/reactos/lib/pseh/i386/pseh3.c b/reactos/lib/pseh/i386/pseh3.c index 1d37ca0a981..47d742d3f98 100644 --- a/reactos/lib/pseh/i386/pseh3.c +++ b/reactos/lib/pseh/i386/pseh3.c @@ -50,8 +50,9 @@ C_ASSERT(SEH3_REGISTRATION_FRAME_Ebp == FIELD_OFFSET(SEH3$_REGISTRATION_FRAME, E C_ASSERT(SEH3_SCOPE_TABLE_Filter == FIELD_OFFSET(SEH3$_SCOPE_TABLE, Filter)); C_ASSERT(SEH3_SCOPE_TABLE_Target == FIELD_OFFSET(SEH3$_SCOPE_TABLE, Target)); -static inline -void _SEH3$_Unregister( +void +__attribute__((regparm(1))) +_SEH3$_Unregister( volatile SEH3$_REGISTRATION_FRAME *Frame) { if (Frame->Handler) From 35bcabdf0031494a2c4971a56b86ba34fb9df45c Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 2 Mar 2014 22:11:49 +0000 Subject: [PATCH 051/113] [CMAKE] * Don't treat warnings like errors in the Clang build just yet. svn path=/trunk/; revision=62403 --- reactos/cmake/gcc.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/reactos/cmake/gcc.cmake b/reactos/cmake/gcc.cmake index 5f2c99d6470..9c31f25cce0 100644 --- a/reactos/cmake/gcc.cmake +++ b/reactos/cmake/gcc.cmake @@ -73,7 +73,11 @@ else() endif() # Warnings, errors -add_compile_flags("-Werror -Wall -Wpointer-arith") +if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang") + add_compile_flags("-Werror") +endif() + +add_compile_flags("-Wall -Wpointer-arith") add_compile_flags("-Wno-char-subscripts -Wno-multichar -Wno-unused-value") if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang") From 53b9cb60dc643c8f2a313868899f90abaa66b830 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Sun, 2 Mar 2014 22:39:02 +0000 Subject: [PATCH 052/113] - Code cleanup and update. Change trace to error for tracking. svn path=/trunk/; revision=62404 --- reactos/win32ss/user/ntuser/winpos.c | 72 +--------------------------- 1 file changed, 2 insertions(+), 70 deletions(-) diff --git a/reactos/win32ss/user/ntuser/winpos.c b/reactos/win32ss/user/ntuser/winpos.c index da0f7e8f985..7919b9a0639 100644 --- a/reactos/win32ss/user/ntuser/winpos.c +++ b/reactos/win32ss/user/ntuser/winpos.c @@ -1381,7 +1381,7 @@ co_WinPosDoWinPosChanging(PWND Window, * * FIXME: hide/show owned popups when owner visibility changes. * - * ReactOS: See bug 6751 and 7228. + * ReactOS: See bug CORE-6129 and CORE-6554. * */ //// @@ -1450,7 +1450,7 @@ WinPosDoOwnedPopups(PWND Window, HWND hWndInsertAfter) if (hWndInsertAfter == HWND_BOTTOM) { - TRACE("Window is HWND_BOTTOM\n"); + ERR("Window is HWND_BOTTOM\n"); if (List) ExFreePoolWithTag(List, USERTAG_WINDOWLIST); goto done; } @@ -1721,7 +1721,6 @@ co_WinPosSetWindowPos( RECTL CopyRect; PWND Ancestor; BOOL bPointerInWindow; - //BOOL bNoTopMost; ASSERT_REFS_CO(Window); @@ -1760,9 +1759,6 @@ co_WinPosSetWindowPos( co_WinPosDoWinPosChanging(Window, &WinPos, &NewWindowRect, &NewClientRect); - // HWND_NOTOPMOST is redirected in WinPosFixupFlags. - //bNoTopMost = WndInsertAfter == HWND_NOTOPMOST; - /* Does the window still exist? */ if (!IntIsWindow(WinPos.hwnd)) { @@ -1823,70 +1819,6 @@ co_WinPosSetWindowPos( if (!(WinPos.flags & SWP_NOZORDER) && WinPos.hwnd != UserGetShellWindow()) { IntLinkHwnd(Window, WinPos.hwndInsertAfter); -#if 0 - //// Fix bug 6751 & 7228 see WinPosDoOwnedPopups wine Fixme. - PWND ParentWindow; - PWND Sibling; - PWND InsertAfterWindow; - - if ((ParentWindow = Window->spwndParent)) // Must have a Parent window! - { - //ERR("SetWindowPos has parent window.\n"); - if (WinPos.hwndInsertAfter == HWND_TOPMOST) - { - InsertAfterWindow = NULL; - } - else if ( WinPos.hwndInsertAfter == HWND_TOP ) - { - InsertAfterWindow = NULL; - - Sibling = ParentWindow->spwndChild; - - while ( Sibling && Sibling->ExStyle & WS_EX_TOPMOST ) - { - InsertAfterWindow = Sibling; - Sibling = Sibling->spwndNext; - } - } - else if (WinPos.hwndInsertAfter == HWND_BOTTOM) - { - if (ParentWindow->spwndChild) - { - InsertAfterWindow = ParentWindow->spwndChild; - - if(InsertAfterWindow) - { - while (InsertAfterWindow->spwndNext) - InsertAfterWindow = InsertAfterWindow->spwndNext; - } - } - else - InsertAfterWindow = NULL; - } - else - InsertAfterWindow = IntGetWindowObject(WinPos.hwndInsertAfter); - /* Do nothing if hwndInsertAfter is HWND_BOTTOM and Window is already - the last window */ - if (InsertAfterWindow != Window) - { - IntUnlinkWindow(Window); - IntLinkWindow(Window, InsertAfterWindow); - } - - if ( ( WinPos.hwndInsertAfter == HWND_TOPMOST || - ( Window->ExStyle & WS_EX_TOPMOST && Window->spwndPrev && Window->spwndPrev->ExStyle & WS_EX_TOPMOST ) || - ( Window->spwndNext && Window->spwndNext->ExStyle & WS_EX_TOPMOST ) ) && - !bNoTopMost ) - { - Window->ExStyle |= WS_EX_TOPMOST; - } - else - { - Window->ExStyle &= ~ WS_EX_TOPMOST; - } - } - //// -#endif } OldWindowRect = Window->rcWindow; From d0ba06e7f2185cce87117a5ab511cf98cc48e1b3 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Sun, 2 Mar 2014 22:42:00 +0000 Subject: [PATCH 053/113] - Move code, this relates to CORE-6651. svn path=/trunk/; revision=62405 --- reactos/win32ss/user/ntuser/focus.c | 46 +++++++++++++++-------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/reactos/win32ss/user/ntuser/focus.c b/reactos/win32ss/user/ntuser/focus.c index c58e1d072ea..8c6973feb49 100644 --- a/reactos/win32ss/user/ntuser/focus.c +++ b/reactos/win32ss/user/ntuser/focus.c @@ -298,28 +298,6 @@ IntSendFocusMessages( PTHREADINFO pti, PWND pWnd) } } -HWND FASTCALL -IntFindChildWindowToOwner(PWND Root, PWND Owner) -{ - HWND Ret; - PWND Child, OwnerWnd; - - for(Child = Root->spwndChild; Child; Child = Child->spwndNext) - { - OwnerWnd = Child->spwndOwner; - if(!OwnerWnd) - continue; - - if(OwnerWnd == Owner) - { - Ret = Child->head.h; - return Ret; - } - } - - return NULL; -} - VOID FASTCALL FindRemoveAsyncMsg(PWND Wnd, WPARAM wParam) { @@ -546,6 +524,30 @@ co_IntSetForegroundAndFocusWindow( return Ret && fgRet; } +/* + Revision 7888, activate modal dialog when clicking on a disabled window. +*/ +HWND FASTCALL +IntFindChildWindowToOwner(PWND Root, PWND Owner) +{ + HWND Ret; + PWND Child, OwnerWnd; + + for(Child = Root->spwndChild; Child; Child = Child->spwndNext) + { + OwnerWnd = Child->spwndOwner; + if(!OwnerWnd) + continue; + + if(OwnerWnd == Owner) + { + Ret = Child->head.h; + return Ret; + } + } + return NULL; +} + BOOL FASTCALL co_IntMouseActivateWindow(PWND Wnd) { From 6e275a78d21b3e54c010d026a8fc23ba4d1afb83 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 2 Mar 2014 23:39:20 +0000 Subject: [PATCH 054/113] [SERVICES] RSetServiceStatus: Set the wait hint and check point only if the service is in a pending state, otherwise they should be 0. svn path=/trunk/; revision=62408 --- reactos/base/system/services/rpcserver.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/reactos/base/system/services/rpcserver.c b/reactos/base/system/services/rpcserver.c index fbe4bb5c0bc..692628a29b8 100644 --- a/reactos/base/system/services/rpcserver.c +++ b/reactos/base/system/services/rpcserver.c @@ -1661,6 +1661,16 @@ DWORD RSetServiceStatus( return ERROR_INVALID_DATA; } + /* Set the wait hint and check point only if the service is in a pending state, + otherwise they should be 0 */ + if (lpServiceStatus->dwCurrentState == SERVICE_STOPPED || + lpServiceStatus->dwCurrentState == SERVICE_PAUSED || + lpServiceStatus->dwCurrentState == SERVICE_RUNNING) + { + lpServiceStatus->dwWaitHint = 0; + lpServiceStatus->dwCheckPoint = 0; + } + /* Lock the service database exclusively */ ScmLockDatabaseExclusive(); From 6334f63dbc09d9397a06b08ee89f6c2e2dae4cea Mon Sep 17 00:00:00 2001 From: James Tabor Date: Mon, 3 Mar 2014 06:38:45 +0000 Subject: [PATCH 055/113] [WinSS] - Fix activate modal dialog when clicking on a disabled window (part 2) without zorder support. Other than clicking the tool bar, it will help activate the popup and bring it to the top. Panic mode support. - Adapt window from point to ignore disabled windows. Attempting to fill a code hole. See CORE-6651. svn path=/trunk/; revision=62410 --- reactos/win32ss/user/ntuser/focus.c | 21 ++++++--------------- reactos/win32ss/user/ntuser/msgqueue.c | 17 +++++------------ reactos/win32ss/user/ntuser/winpos.c | 13 +++++++------ reactos/win32ss/user/ntuser/winpos.h | 2 +- 4 files changed, 19 insertions(+), 34 deletions(-) diff --git a/reactos/win32ss/user/ntuser/focus.c b/reactos/win32ss/user/ntuser/focus.c index 8c6973feb49..bf1a32d259d 100644 --- a/reactos/win32ss/user/ntuser/focus.c +++ b/reactos/win32ss/user/ntuser/focus.c @@ -120,7 +120,7 @@ co_IntSendActivateMessages(PWND WindowPrev, PWND Window, BOOL MouseActivate, BOO (WPARAM)UserHMGetHandle(Window), 0); } - //// Fixes bug 7089. + //// Fixes CORE-6434. if (!(Window->style & WS_CHILD)) { PWND pwndTemp = co_GetDesktopWindow(Window)->spwndChild; @@ -229,8 +229,6 @@ co_IntSendActivateMessages(PWND WindowPrev, PWND Window, BOOL MouseActivate, BOO co_IntMakeWindowActive(Window); - /* FIXME: IntIsWindow */ - co_IntSendMessageNoWait( UserHMGetHandle(Window), WM_NCACTIVATE, (WPARAM)(Window == (gpqForeground ? gpqForeground->spwndActive : NULL)), @@ -552,9 +550,7 @@ BOOL FASTCALL co_IntMouseActivateWindow(PWND Wnd) { HWND Top; - PWND TopWindow; USER_REFERENCE_ENTRY Ref; - ASSERT_REFS_CO(Wnd); if (Wnd->style & WS_DISABLED) @@ -564,6 +560,7 @@ co_IntMouseActivateWindow(PWND Wnd) PWND DesktopWindow = UserGetDesktopWindow(); if (DesktopWindow) { + ERR("Window Diabled\n"); Top = IntFindChildWindowToOwner(DesktopWindow, Wnd); if ((TopWnd = ValidateHwndNoErr(Top))) { @@ -576,15 +573,8 @@ co_IntMouseActivateWindow(PWND Wnd) } return FALSE; } - - TopWindow = UserGetAncestor(Wnd, GA_ROOT); - //if (TopWindow) {ERR("MAW 2 pWnd %p hWnd %p\n",TopWindow,TopWindow->head.h);} - if (!TopWindow) return FALSE; - - /* TMN: Check return value from this function? */ - UserRefObjectCo(TopWindow, &Ref); - co_IntSetForegroundAndFocusWindow(TopWindow, TRUE); - UserDerefObjectCo(TopWindow); + ERR("Mouse Active\n"); + co_IntSetForegroundAndFocusWindow(Wnd, TRUE); return TRUE; } @@ -733,6 +723,7 @@ co_IntSetActiveWindow(PWND Wnd OPTIONAL, BOOL bMouse, BOOL bFocus, BOOL Async) InAAPM = co_IntSendActivateMessages(WndPrev, Wnd, bMouse, Async); /* now change focus if necessary */ + //// Fixes CORE-6452 allows setting focus on window. if (bFocus && !(ThreadQueue->QF_flags & QF_FOCUSNULLSINCEACTIVE)) { /* Do not change focus if the window is no longer active */ @@ -745,7 +736,7 @@ co_IntSetActiveWindow(PWND Wnd OPTIONAL, BOOL bMouse, BOOL bFocus, BOOL Async) IntSendFocusMessages( pti, pWndSend); } } - + //// if (InAAPM) { pti->TIF_flags &= ~TIF_INACTIVATEAPPMSG; diff --git a/reactos/win32ss/user/ntuser/msgqueue.c b/reactos/win32ss/user/ntuser/msgqueue.c index f4475111ded..e6f31cb62b4 100644 --- a/reactos/win32ss/user/ntuser/msgqueue.c +++ b/reactos/win32ss/user/ntuser/msgqueue.c @@ -575,6 +575,7 @@ co_MsqInsertMouseMessage(MSG* Msg, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook { pti = pwnd->head.pti; MessageQueue = pti->MessageQueue; + // MessageQueue->ptiMouse = pti; if ( pti->TIF_flags & TIF_INCLEANUP || MessageQueue->QF_flags & QF_INDESTROY) { @@ -1342,7 +1343,7 @@ BOOL co_IntProcessMouseMessage(MSG* msg, BOOL* RemoveMessages, UINT first, UINT USHORT hittest; EVENTMSG event; MOUSEHOOKSTRUCT hook; - BOOL eatMsg; + BOOL eatMsg = FALSE; PWND pwndMsg, pwndDesktop; PUSER_MESSAGE_QUEUE MessageQueue; @@ -1367,9 +1368,8 @@ BOOL co_IntProcessMouseMessage(MSG* msg, BOOL* RemoveMessages, UINT first, UINT if (pwndMsg) UserReferenceObject(pwndMsg); } else - { // Fix wine Msg test_HTTRANSPARENT. Start with a NULL window. - // http://www.winehq.org/pipermail/wine-patches/2012-August/116776.html - pwndMsg = co_WinPosWindowFromPoint(NULL, &msg->pt, &hittest); + { + pwndMsg = co_WinPosWindowFromPoint(NULL, &msg->pt, &hittest, TRUE); } TRACE("Got mouse message for %p, hittest: 0x%x\n", msg->hwnd, hittest); @@ -1392,10 +1392,6 @@ BOOL co_IntProcessMouseMessage(MSG* msg, BOOL* RemoveMessages, UINT first, UINT msg->hwnd = UserHMGetHandle(pwndMsg); -#if 0 - if (!check_hwnd_filter( msg, hwnd_filter )) RETURN(FALSE); -#endif - pt = msg->pt; message = msg->message; /* Note: windows has no concept of a non-client wheel message */ @@ -1547,8 +1543,6 @@ BOOL co_IntProcessMouseMessage(MSG* msg, BOOL* RemoveMessages, UINT first, UINT RETURN(TRUE); } - eatMsg = FALSE; - if ((msg->message == WM_LBUTTONDOWN) || (msg->message == WM_RBUTTONDOWN) || (msg->message == WM_MBUTTONDOWN) || @@ -1807,8 +1801,7 @@ co_MsqPeekHardwareMessage(IN PTHREADINFO pti, break; } } - CurrentMessage = CONTAINING_RECORD(CurrentEntry, USER_MESSAGE, - ListEntry); + CurrentMessage = CONTAINING_RECORD(CurrentEntry, USER_MESSAGE, ListEntry); } while(CurrentEntry != ListHead); diff --git a/reactos/win32ss/user/ntuser/winpos.c b/reactos/win32ss/user/ntuser/winpos.c index 7919b9a0639..5ad490abfb6 100644 --- a/reactos/win32ss/user/ntuser/winpos.c +++ b/reactos/win32ss/user/ntuser/winpos.c @@ -2440,7 +2440,8 @@ PWND FASTCALL co_WinPosSearchChildren( PWND ScopeWin, POINT *Point, - USHORT *HitTest + USHORT *HitTest, + BOOL Ignore ) { PWND pwndChild; @@ -2451,7 +2452,7 @@ co_WinPosSearchChildren( return NULL; } - if ((ScopeWin->style & WS_DISABLED)) + if (!Ignore && (ScopeWin->style & WS_DISABLED)) { return NULL; } @@ -2475,7 +2476,7 @@ co_WinPosSearchChildren( continue; } - pwndChild = co_WinPosSearchChildren(pwndChild, Point, HitTest); + pwndChild = co_WinPosSearchChildren(pwndChild, Point, HitTest, Ignore); if(pwndChild != NULL) { @@ -2506,7 +2507,7 @@ co_WinPosSearchChildren( } PWND FASTCALL -co_WinPosWindowFromPoint(PWND ScopeWin, POINT *WinPoint, USHORT* HitTest) +co_WinPosWindowFromPoint(PWND ScopeWin, POINT *WinPoint, USHORT* HitTest, BOOL Ignore) { PWND Window; POINT Point = *WinPoint; @@ -2524,7 +2525,7 @@ co_WinPosWindowFromPoint(PWND ScopeWin, POINT *WinPoint, USHORT* HitTest) ASSERT_REFS_CO(ScopeWin); UserRefObjectCo(ScopeWin, &Ref); - Window = co_WinPosSearchChildren(ScopeWin, &Point, HitTest); + Window = co_WinPosSearchChildren(ScopeWin, &Point, HitTest, Ignore); UserDerefObjectCo(ScopeWin); if (Window) @@ -3447,7 +3448,7 @@ NtUserWindowFromPoint(LONG X, LONG Y) UserRefObjectCo(DesktopWindow, &Ref); //pti = PsGetCurrentThreadWin32Thread(); - Window = co_WinPosWindowFromPoint(DesktopWindow, &pt, &hittest); + Window = co_WinPosWindowFromPoint(DesktopWindow, &pt, &hittest, FALSE); if (Window) { diff --git a/reactos/win32ss/user/ntuser/winpos.h b/reactos/win32ss/user/ntuser/winpos.h index adfaa32c17d..ed3464cf19d 100644 --- a/reactos/win32ss/user/ntuser/winpos.h +++ b/reactos/win32ss/user/ntuser/winpos.h @@ -52,7 +52,7 @@ UINT FASTCALL co_WinPosMinMaximize(PWND WindowObject, UINT ShowFlag, RECTL* NewP BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags); BOOLEAN FASTCALL co_WinPosShowWindow(PWND Window, INT Cmd); void FASTCALL co_WinPosSendSizeMove(PWND Window); -PWND FASTCALL co_WinPosWindowFromPoint(PWND ScopeWin, POINT *WinPoint, USHORT* HitTest); +PWND FASTCALL co_WinPosWindowFromPoint(PWND ScopeWin, POINT *WinPoint, USHORT* HitTest, BOOL Ignore); VOID FASTCALL co_WinPosActivateOtherWindow(PWND); PWND FASTCALL IntRealChildWindowFromPoint(PWND,LONG,LONG); BOOL FASTCALL IntScreenToClient(PWND,LPPOINT); From 50c9a384f470a1d9f54ba00f3018ac2f072893c2 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Mon, 3 Mar 2014 15:44:44 +0000 Subject: [PATCH 056/113] [ADVAPI32] Implement the ANSI part of ion's half done patch from r59843. Fixes two more service bugs. svn path=/trunk/; revision=62413 --- reactos/dll/win32/advapi32/service/sctrl.c | 92 ++++++++++++++-------- 1 file changed, 58 insertions(+), 34 deletions(-) diff --git a/reactos/dll/win32/advapi32/service/sctrl.c b/reactos/dll/win32/advapi32/service/sctrl.c index 6893c14ac12..9b32bbb36a0 100644 --- a/reactos/dll/win32/advapi32/service/sctrl.c +++ b/reactos/dll/win32/advapi32/service/sctrl.c @@ -288,8 +288,10 @@ ScBuildUnicodeArgsVector(PSCM_CONTROL_PACKET ControlPacket, { LPWSTR *lpVector; LPWSTR *lpArg; - DWORD i, cbServiceName, cbTotal; LPWSTR pszServiceName; + DWORD cbServiceName; + DWORD cbTotal; + DWORD i; if (ControlPacket == NULL || lpArgCount == NULL || lpArgVector == NULL) return ERROR_INVALID_PARAMETER; @@ -297,18 +299,12 @@ ScBuildUnicodeArgsVector(PSCM_CONTROL_PACKET ControlPacket, *lpArgCount = 0; *lpArgVector = NULL; - pszServiceName = (PWSTR) ((PBYTE) ControlPacket + ControlPacket->dwServiceNameOffset); + pszServiceName = (PWSTR)((PBYTE)ControlPacket + ControlPacket->dwServiceNameOffset); cbServiceName = lstrlenW(pszServiceName) * sizeof(WCHAR) + sizeof(UNICODE_NULL); + cbTotal = cbServiceName + sizeof(LPWSTR); if (ControlPacket->dwArgumentsCount > 0) - { - cbTotal = ControlPacket->dwSize - ControlPacket->dwArgumentsOffset + - cbServiceName + sizeof(LPWSTR); - } - else - { - cbTotal = cbServiceName + sizeof(LPWSTR); - } + cbTotal += ControlPacket->dwSize - ControlPacket->dwArgumentsOffset; lpVector = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, @@ -321,7 +317,7 @@ ScBuildUnicodeArgsVector(PSCM_CONTROL_PACKET ControlPacket, lpArg++; memcpy(lpArg, pszServiceName, cbServiceName); - lpArg = (LPWSTR*) ((ULONG_PTR) lpArg + cbServiceName); + lpArg = (LPWSTR*)((ULONG_PTR)lpArg + cbServiceName); if (ControlPacket->dwArgumentsCount > 0) { @@ -351,10 +347,13 @@ ScBuildAnsiArgsVector(PSCM_CONTROL_PACKET ControlPacket, LPSTR *lpVector; LPSTR *lpPtr; LPWSTR lpUnicodeString; + LPWSTR pszServiceName; LPSTR lpAnsiString; + DWORD cbServiceName; DWORD dwVectorSize; DWORD dwUnicodeSize; - DWORD dwAnsiSize; + DWORD dwAnsiSize = 0; + DWORD dwAnsiNameSize = 0; DWORD i; if (ControlPacket == NULL || lpArgCount == NULL || lpArgVector == NULL) @@ -363,13 +362,21 @@ ScBuildAnsiArgsVector(PSCM_CONTROL_PACKET ControlPacket, *lpArgCount = 0; *lpArgVector = NULL; - /* FIXME: There should always be one argument (the name) sent to services... */ - /* FIXME: See the Unicode version above on how to achieve this */ + pszServiceName = (PWSTR)((PBYTE)ControlPacket + ControlPacket->dwServiceNameOffset); + cbServiceName = lstrlenW(pszServiceName) * sizeof(WCHAR) + sizeof(UNICODE_NULL); + dwAnsiNameSize = WideCharToMultiByte(CP_ACP, + 0, + pszServiceName, + cbServiceName, + NULL, + 0, + NULL, + NULL); + + dwVectorSize = ControlPacket->dwArgumentsCount * sizeof(LPWSTR); if (ControlPacket->dwArgumentsCount > 0) { - dwVectorSize = ControlPacket->dwArgumentsCount * sizeof(LPWSTR); - lpUnicodeString = (LPWSTR)((PBYTE)ControlPacket + ControlPacket->dwArgumentsOffset + dwVectorSize); @@ -385,15 +392,31 @@ ScBuildAnsiArgsVector(PSCM_CONTROL_PACKET ControlPacket, 0, NULL, NULL); + } - lpVector = HeapAlloc(GetProcessHeap(), - HEAP_ZERO_MEMORY, - dwVectorSize + dwAnsiSize); - if (lpVector == NULL) - return ERROR_OUTOFMEMORY; + dwVectorSize += sizeof(LPWSTR); - lpPtr = (LPSTR*)lpVector; - lpAnsiString = (LPSTR)((ULONG_PTR)lpVector + dwVectorSize); + lpVector = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + dwVectorSize + dwAnsiNameSize + dwAnsiSize); + if (lpVector == NULL) + return ERROR_OUTOFMEMORY; + + lpPtr = (LPSTR*)lpVector; + lpAnsiString = (LPSTR)((ULONG_PTR)lpVector + dwVectorSize); + + WideCharToMultiByte(CP_ACP, + 0, + pszServiceName, + cbServiceName, + lpAnsiString, + dwAnsiNameSize, + NULL, + NULL); + + if (ControlPacket->dwArgumentsCount > 0) + { + lpAnsiString = (LPSTR)((ULONG_PTR)lpAnsiString + dwAnsiNameSize); WideCharToMultiByte(CP_ACP, 0, @@ -403,19 +426,20 @@ ScBuildAnsiArgsVector(PSCM_CONTROL_PACKET ControlPacket, dwAnsiSize, NULL, NULL); - - for (i = 0; i < ControlPacket->dwArgumentsCount; i++) - { - *lpPtr = lpAnsiString; - - lpPtr++; - lpAnsiString += (strlen(lpAnsiString) + 1); - } - - *lpArgCount = ControlPacket->dwArgumentsCount; - *lpArgVector = lpVector; } + lpAnsiString = (LPSTR)((ULONG_PTR)lpVector + dwVectorSize); + for (i = 0; i < ControlPacket->dwArgumentsCount + 1; i++) + { + *lpPtr = lpAnsiString; + + lpPtr++; + lpAnsiString += (strlen(lpAnsiString) + 1); + } + + *lpArgCount = ControlPacket->dwArgumentsCount + 1; + *lpArgVector = lpVector; + return ERROR_SUCCESS; } From 2b1527a42167cd8aeb5a9ef18c599e43d1254879 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Mon, 3 Mar 2014 20:41:39 +0000 Subject: [PATCH 057/113] [FREETYPE] * Update to version 2.5.2. Thanks to Robert Naumann for providing a patch that I used as a base for this. [WIN32K] * Update the FreeType header inclusions. CORE-7719 svn path=/trunk/; revision=62417 --- reactos/lib/3rdparty/freetype/CMakeLists.txt | 19 +- reactos/lib/3rdparty/freetype/ChangeLog | 1560 ++++++++++++++++- reactos/lib/3rdparty/freetype/README | 8 +- reactos/lib/3rdparty/freetype/autogen.sh | 4 +- .../lib/3rdparty/freetype/devel/ft2build.h | 40 + .../lib/3rdparty/freetype/devel/ftoption.h | 833 +++++++++ .../include/{freetype => }/config/ftconfig.h | 88 +- .../include/{freetype => }/config/ftheader.h | 118 +- .../include/{freetype => }/config/ftmodule.h | 0 .../include/{freetype => }/config/ftoption.h | 14 +- .../include/{freetype => }/config/ftstdlib.h | 0 .../include/{freetype => }/freetype.h | 96 +- .../freetype/include/freetype/ftcffdrv.h | 151 -- .../lib/3rdparty/freetype/include/ft2build.h | 23 +- .../include/{freetype => }/ftadvanc.h | 4 +- .../freetype/include/{freetype => }/ftautoh.h | 4 +- .../freetype/include/{freetype => }/ftbbox.h | 6 +- .../freetype/include/{freetype => }/ftbdf.h | 0 .../include/{freetype => }/ftbitmap.h | 0 .../freetype/include/{freetype => }/ftbzip2.h | 0 .../freetype/include/{freetype => }/ftcache.h | 2 +- .../lib/3rdparty/freetype/include/ftcffdrv.h | 254 +++ .../include/{freetype => }/ftchapters.h | 2 +- .../freetype/include/{freetype => }/ftcid.h | 0 .../include/{freetype => }/fterrdef.h | 0 .../include/{freetype => }/fterrors.h | 0 .../freetype/include/{freetype => }/ftgasp.h | 0 .../freetype/include/{freetype => }/ftglyph.h | 10 +- .../freetype/include/{freetype => }/ftgxval.h | 10 +- .../freetype/include/{freetype => }/ftgzip.h | 49 +- .../freetype/include/{freetype => }/ftimage.h | 18 +- .../include/{freetype => }/ftincrem.h | 0 .../include/{freetype => }/ftlcdfil.h | 6 +- .../freetype/include/{freetype => }/ftlist.h | 12 +- .../freetype/include/{freetype => }/ftlzw.h | 0 .../freetype/include/{freetype => }/ftmac.h | 6 +- .../freetype/include/{freetype => }/ftmm.h | 7 +- .../include/{freetype => }/ftmodapi.h | 8 +- .../include/{freetype => }/ftmoderr.h | 0 .../freetype/include/{freetype => }/ftotval.h | 6 +- .../freetype/include/{freetype => }/ftoutln.h | 23 +- .../freetype/include/{freetype => }/ftpfr.h | 0 .../include/{freetype => }/ftrender.h | 0 .../freetype/include/{freetype => }/ftsizes.h | 4 +- .../include/{freetype => }/ftsnames.h | 6 +- .../include/{freetype => }/ftstroke.h | 0 .../freetype/include/{freetype => }/ftsynth.h | 4 +- .../include/{freetype => }/ftsystem.h | 0 .../include/{freetype => }/fttrigon.h | 0 .../freetype/include/{freetype => }/ftttdrv.h | 22 +- .../freetype/include/{freetype => }/fttypes.h | 6 +- .../include/{freetype => }/ftwinfnt.h | 7 +- .../freetype/include/{freetype => }/ftxf86.h | 4 +- .../{freetype => }/internal/autohint.h | 0 .../include/{freetype => }/internal/ftcalc.h | 6 +- .../include/{freetype => }/internal/ftdebug.h | 0 .../{freetype => }/internal/ftdriver.h | 0 .../{freetype => }/internal/ftgloadr.h | 0 .../{freetype => }/internal/ftmemory.h | 0 .../include/{freetype => }/internal/ftobjs.h | 0 .../include/{freetype => }/internal/ftpic.h | 0 .../include/{freetype => }/internal/ftrfork.h | 0 .../include/{freetype => }/internal/ftserv.h | 36 +- .../{freetype => }/internal/ftstream.h | 0 .../include/{freetype => }/internal/fttrace.h | 0 .../include/{freetype => }/internal/ftvalid.h | 0 .../{freetype => }/internal/internal.h | 38 +- .../include/{freetype => }/internal/psaux.h | 0 .../include/{freetype => }/internal/pshints.h | 0 .../{freetype => }/internal/services/svbdf.h | 0 .../{freetype => }/internal/services/svcid.h | 0 .../internal/services/svgldict.h | 0 .../internal/services/svgxval.h | 0 .../{freetype => }/internal/services/svkern.h | 0 .../{freetype => }/internal/services/svmm.h | 0 .../internal/services/svotval.h | 0 .../{freetype => }/internal/services/svpfr.h | 0 .../internal/services/svpostnm.h | 0 .../{freetype => }/internal/services/svprop.h | 0 .../internal/services/svpscmap.h | 0 .../internal/services/svpsinfo.h | 0 .../{freetype => }/internal/services/svsfnt.h | 0 .../internal/services/svttcmap.h | 4 +- .../internal/services/svtteng.h | 0 .../internal/services/svttglyf.h | 0 .../internal/services/svwinfnt.h | 0 .../internal/services/svxf86nm.h | 0 .../include/{freetype => }/internal/sfnt.h | 0 .../include/{freetype => }/internal/t1types.h | 0 .../include/{freetype => }/internal/tttypes.h | 108 +- .../include/{freetype => }/t1tables.h | 0 .../include/{freetype => }/ttnameid.h | 4 +- .../include/{freetype => }/tttables.h | 38 +- .../freetype/include/{freetype => }/tttags.h | 2 + .../freetype/include/{freetype => }/ttunpat.h | 0 reactos/lib/3rdparty/freetype/modules.cfg | 50 +- reactos/lib/3rdparty/freetype/objs/README | 2 + .../3rdparty/freetype/src/autofit/afblue.c | 166 ++ .../3rdparty/freetype/src/autofit/afblue.cin | 39 + .../3rdparty/freetype/src/autofit/afblue.dat | 218 +++ .../3rdparty/freetype/src/autofit/afblue.h | 199 +++ .../3rdparty/freetype/src/autofit/afblue.hin | 142 ++ .../lib/3rdparty/freetype/src/autofit/afcjk.c | 650 +++---- .../lib/3rdparty/freetype/src/autofit/afcjk.h | 59 +- .../3rdparty/freetype/src/autofit/afdummy.c | 39 +- .../3rdparty/freetype/src/autofit/afdummy.h | 10 +- .../3rdparty/freetype/src/autofit/afglobal.c | 126 +- .../3rdparty/freetype/src/autofit/afglobal.h | 23 +- .../3rdparty/freetype/src/autofit/afhints.c | 283 +-- .../3rdparty/freetype/src/autofit/afhints.h | 45 +- .../3rdparty/freetype/src/autofit/afindic.c | 64 +- .../3rdparty/freetype/src/autofit/afindic.h | 11 +- .../3rdparty/freetype/src/autofit/aflatin.c | 532 ++++-- .../3rdparty/freetype/src/autofit/aflatin.h | 43 +- .../3rdparty/freetype/src/autofit/aflatin2.c | 72 +- .../3rdparty/freetype/src/autofit/aflatin2.h | 18 +- .../3rdparty/freetype/src/autofit/afloader.c | 43 +- .../lib/3rdparty/freetype/src/autofit/afpic.c | 49 +- .../lib/3rdparty/freetype/src/autofit/afpic.h | 35 +- .../3rdparty/freetype/src/autofit/afscript.h | 37 + .../3rdparty/freetype/src/autofit/aftypes.h | 287 ++- .../3rdparty/freetype/src/autofit/afwrtsys.h | 51 + .../3rdparty/freetype/src/autofit/autofit.c | 3 +- .../3rdparty/freetype/src/autofit/rules.mk | 7 +- .../lib/3rdparty/freetype/src/base/ftbbox.c | 332 +--- .../lib/3rdparty/freetype/src/base/ftbitmap.c | 4 + .../lib/3rdparty/freetype/src/base/ftcalc.c | 30 +- .../lib/3rdparty/freetype/src/base/ftdebug.c | 2 +- .../lib/3rdparty/freetype/src/base/ftglyph.c | 62 +- .../lib/3rdparty/freetype/src/base/ftinit.c | 4 +- .../lib/3rdparty/freetype/src/base/ftmac.c | 1 - .../lib/3rdparty/freetype/src/base/ftobjs.c | 40 +- .../lib/3rdparty/freetype/src/base/ftoutln.c | 7 +- .../lib/3rdparty/freetype/src/base/ftpic.c | 4 +- .../lib/3rdparty/freetype/src/base/ftsynth.c | 11 +- reactos/lib/3rdparty/freetype/src/base/md5.c | 51 +- reactos/lib/3rdparty/freetype/src/base/md5.h | 2 +- .../lib/3rdparty/freetype/src/base/rules.mk | 4 +- reactos/lib/3rdparty/freetype/src/bdf/Jamfile | 29 - .../lib/3rdparty/freetype/src/bdf/bdfdrivr.c | 16 +- .../lib/3rdparty/freetype/src/bzip2/Jamfile | 19 - .../lib/3rdparty/freetype/src/cache/Jamfile | 43 - .../lib/3rdparty/freetype/src/cff/cf2blues.c | 2 + .../lib/3rdparty/freetype/src/cff/cf2font.c | 161 +- .../lib/3rdparty/freetype/src/cff/cf2font.h | 2 + reactos/lib/3rdparty/freetype/src/cff/cf2ft.c | 9 + .../lib/3rdparty/freetype/src/cff/cf2hints.c | 196 ++- .../lib/3rdparty/freetype/src/cff/cf2hints.h | 4 +- .../lib/3rdparty/freetype/src/cff/cffdrivr.c | 63 +- .../lib/3rdparty/freetype/src/cff/cffgload.c | 6 +- .../lib/3rdparty/freetype/src/cff/cffload.c | 10 +- .../lib/3rdparty/freetype/src/cff/cffobjs.c | 11 +- .../lib/3rdparty/freetype/src/cff/cffobjs.h | 2 + .../lib/3rdparty/freetype/src/cid/cidgload.c | 2 +- .../lib/3rdparty/freetype/src/cid/cidload.c | 6 +- .../3rdparty/freetype/src/gxvalid/gxvcommn.c | 8 + .../3rdparty/freetype/src/gxvalid/gxvcommn.h | 2 +- .../3rdparty/freetype/src/gxvalid/gxvmort.c | 2 + .../3rdparty/freetype/src/gxvalid/gxvmorx2.c | 4 +- .../lib/3rdparty/freetype/src/gzip/Jamfile | 16 - .../lib/3rdparty/freetype/src/gzip/ftgzip.c | 78 +- .../lib/3rdparty/freetype/src/gzip/rules.mk | 59 +- .../lib/3rdparty/freetype/src/pcf/pcfdrivr.c | 42 +- .../lib/3rdparty/freetype/src/pcf/pcfread.c | 2 +- .../lib/3rdparty/freetype/src/pcf/pcfutil.c | 12 +- .../lib/3rdparty/freetype/src/pfr/pfrcmap.c | 10 +- .../lib/3rdparty/freetype/src/pfr/pfrgload.c | 2 +- .../lib/3rdparty/freetype/src/pfr/pfrobjs.c | 2 + .../lib/3rdparty/freetype/src/psaux/Jamfile | 31 - .../3rdparty/freetype/src/pshinter/pshglob.c | 4 +- .../3rdparty/freetype/src/raster/ftraster.c | 4 +- .../lib/3rdparty/freetype/src/sfnt/pngshim.c | 57 +- .../lib/3rdparty/freetype/src/sfnt/pngshim.h | 5 +- .../lib/3rdparty/freetype/src/sfnt/sfdriver.c | 4 +- .../lib/3rdparty/freetype/src/sfnt/sfobjs.c | 421 ++++- .../lib/3rdparty/freetype/src/sfnt/ttcmap.c | 11 +- .../lib/3rdparty/freetype/src/sfnt/ttkern.c | 6 +- .../lib/3rdparty/freetype/src/sfnt/ttload.c | 52 +- .../lib/3rdparty/freetype/src/sfnt/ttmtx.c | 19 +- .../lib/3rdparty/freetype/src/sfnt/ttsbit.c | 612 +++++-- .../lib/3rdparty/freetype/src/sfnt/ttsbit.h | 4 +- .../3rdparty/freetype/src/smooth/ftgrays.c | 87 +- .../lib/3rdparty/freetype/src/tools/afblue.pl | 542 ++++++ .../3rdparty/freetype/src/tools/chktrcmp.py | 4 +- .../freetype/src/tools/docmaker/content.py | 19 +- .../freetype/src/tools/docmaker/docmaker.py | 4 +- .../freetype/src/tools/docmaker/sources.py | 40 +- .../freetype/src/tools/docmaker/tohtml.py | 33 +- .../3rdparty/freetype/src/truetype/ttdriver.c | 3 +- .../3rdparty/freetype/src/truetype/ttgload.c | 238 ++- .../3rdparty/freetype/src/truetype/ttgload.h | 1 + .../3rdparty/freetype/src/truetype/ttinterp.c | 253 ++- .../3rdparty/freetype/src/truetype/ttinterp.h | 4 +- .../3rdparty/freetype/src/truetype/ttobjs.c | 23 +- .../lib/3rdparty/freetype/src/type1/t1gload.c | 2 + .../lib/3rdparty/freetype/src/type1/t1load.c | 4 +- .../3rdparty/freetype/src/type42/t42objs.c | 5 +- .../3rdparty/freetype/src/winfonts/winfnt.c | 4 +- reactos/media/doc/3rd Party Files.txt | 2 +- reactos/win32ss/gdi/ntgdi/freetype.c | 10 +- 200 files changed, 8423 insertions(+), 2432 deletions(-) create mode 100644 reactos/lib/3rdparty/freetype/devel/ft2build.h create mode 100644 reactos/lib/3rdparty/freetype/devel/ftoption.h rename reactos/lib/3rdparty/freetype/include/{freetype => }/config/ftconfig.h (89%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/config/ftheader.h (89%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/config/ftmodule.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/config/ftoption.h (99%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/config/ftstdlib.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/freetype.h (98%) delete mode 100644 reactos/lib/3rdparty/freetype/include/freetype/ftcffdrv.h rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftadvanc.h (98%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftautoh.h (98%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftbbox.h (97%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftbdf.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftbitmap.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftbzip2.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftcache.h (99%) create mode 100644 reactos/lib/3rdparty/freetype/include/ftcffdrv.h rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftchapters.h (99%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftcid.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/fterrdef.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/fterrors.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftgasp.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftglyph.h (99%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftgxval.h (98%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftgzip.h (74%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftimage.h (99%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftincrem.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftlcdfil.h (97%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftlist.h (97%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftlzw.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftmac.h (98%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftmm.h (98%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftmodapi.h (99%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftmoderr.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftotval.h (97%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftoutln.h (96%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftpfr.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftrender.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftsizes.h (98%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftsnames.h (98%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftstroke.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftsynth.h (96%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftsystem.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/fttrigon.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftttdrv.h (85%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/fttypes.h (99%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftwinfnt.h (97%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ftxf86.h (96%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/autohint.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/ftcalc.h (98%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/ftdebug.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/ftdriver.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/ftgloadr.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/ftmemory.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/ftobjs.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/ftpic.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/ftrfork.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/ftserv.h (96%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/ftstream.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/fttrace.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/ftvalid.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/internal.h (61%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/psaux.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/pshints.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/services/svbdf.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/services/svcid.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/services/svgldict.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/services/svgxval.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/services/svkern.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/services/svmm.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/services/svotval.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/services/svpfr.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/services/svpostnm.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/services/svprop.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/services/svpscmap.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/services/svpsinfo.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/services/svsfnt.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/services/svttcmap.h (97%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/services/svtteng.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/services/svttglyf.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/services/svwinfnt.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/services/svxf86nm.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/sfnt.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/t1types.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/internal/tttypes.h (94%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/t1tables.h (100%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ttnameid.h (99%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/tttables.h (97%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/tttags.h (97%) rename reactos/lib/3rdparty/freetype/include/{freetype => }/ttunpat.h (100%) create mode 100644 reactos/lib/3rdparty/freetype/objs/README create mode 100644 reactos/lib/3rdparty/freetype/src/autofit/afblue.c create mode 100644 reactos/lib/3rdparty/freetype/src/autofit/afblue.cin create mode 100644 reactos/lib/3rdparty/freetype/src/autofit/afblue.dat create mode 100644 reactos/lib/3rdparty/freetype/src/autofit/afblue.h create mode 100644 reactos/lib/3rdparty/freetype/src/autofit/afblue.hin create mode 100644 reactos/lib/3rdparty/freetype/src/autofit/afscript.h create mode 100644 reactos/lib/3rdparty/freetype/src/autofit/afwrtsys.h delete mode 100644 reactos/lib/3rdparty/freetype/src/bdf/Jamfile delete mode 100644 reactos/lib/3rdparty/freetype/src/bzip2/Jamfile delete mode 100644 reactos/lib/3rdparty/freetype/src/cache/Jamfile delete mode 100644 reactos/lib/3rdparty/freetype/src/gzip/Jamfile delete mode 100644 reactos/lib/3rdparty/freetype/src/psaux/Jamfile create mode 100644 reactos/lib/3rdparty/freetype/src/tools/afblue.pl diff --git a/reactos/lib/3rdparty/freetype/CMakeLists.txt b/reactos/lib/3rdparty/freetype/CMakeLists.txt index 764c3a1bfb1..c6afe6e77d7 100644 --- a/reactos/lib/3rdparty/freetype/CMakeLists.txt +++ b/reactos/lib/3rdparty/freetype/CMakeLists.txt @@ -7,24 +7,35 @@ include_directories(include) list(APPEND SOURCE src/autofit/autofit.c - src/base/ftbase.c + src/base/ftadvanc.c src/base/ftbbox.c - src/base/ftbdf.c src/base/ftbitmap.c + src/base/ftcalc.c + src/base/ftcid.c + src/base/ftdbgmem.c src/base/ftdebug.c + src/base/ftfstype.c src/base/ftgasp.c + src/base/ftgloadr.c src/base/ftglyph.c src/base/ftgxval.c src/base/ftinit.c src/base/ftlcdfil.c src/base/ftmm.c + src/base/ftobjs.c src/base/ftotval.c + src/base/ftoutln.c src/base/ftpatent.c src/base/ftpfr.c + src/base/ftrfork.c + src/base/ftsnames.c + src/base/ftstream.c src/base/ftstroke.c src/base/ftsynth.c src/base/ftsystem.c + src/base/fttrigon.c src/base/fttype1.c + src/base/ftutil.c src/base/ftwinfnt.c src/base/ftxf86.c src/bdf/bdf.c @@ -32,15 +43,13 @@ list(APPEND SOURCE src/cache/ftcache.c src/cff/cff.c src/cid/type1cid.c - src/gxvalid/gxvalid.c src/gzip/ftgzip.c src/lzw/ftlzw.c - src/otvalid/otvalid.c src/pcf/pcf.c src/pfr/pfr.c src/psaux/psaux.c src/pshinter/pshinter.c - src/psnames/psnames.c + src/psnames/psmodule.c src/raster/raster.c src/sfnt/sfnt.c src/smooth/smooth.c diff --git a/reactos/lib/3rdparty/freetype/ChangeLog b/reactos/lib/3rdparty/freetype/ChangeLog index 5cda57a46ec..b67e4362a38 100644 --- a/reactos/lib/3rdparty/freetype/ChangeLog +++ b/reactos/lib/3rdparty/freetype/ChangeLog @@ -1,3 +1,1559 @@ +2013-12-08 Werner Lemberg + + * Version 2.5.2 released. + ========================= + + + Tag sources with `VER-2-5-2'. + + * docs/VERSION.DLL: Update documentation and bump version number to + 2.5.2. + + * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, + builds/windows/vc2005/index.html, + builds/windows/vc2008/freetype.vcproj, + builds/windows/vc2008/index.html, + builds/windows/vc2010/freetype.vcxproj, + builds/windows/vc2010/index.html, + builds/windows/visualc/freetype.dsp, + builds/windows/visualc/freetype.vcproj, + builds/windows/visualc/index.html, + builds/windows/visualce/freetype.dsp, + builds/windows/visualce/freetype.vcproj, + builds/windows/visualce/index.html, + builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2005-ce/index.html, + builds/wince/vc2008-ce/freetype.vcproj, + builds/wince/vc2008-ce/index.html: s/2.5.1/2.5.2/, s/251/252/. + + * include/freetype/freetype.h (FREETYPE_PATCH): Set to 1. + + * builds/unix/configure.raw (version_info): Set to 17:1:11. + * docs/CHANGES: Updated. + +2013-12-07 Werner Lemberg + + [truetype] Next round in phantom point handling. + + Greg Hitchcock provided very interesting insights into the + complicated history of the horizontal positions of the TSB and BSB + phantom points. + + * src/truetype/ttgload.c (TT_LOADER_SET_PP) + [TT_CONFIG_OPTION_SUBPIXEL_HINTING]: Use `subpixel_hinting' and + `grayscale_hinting' flags as conditionals for the x position of TSB + and BSB. + +2013-12-05 Werner Lemberg + + * builds/freetype.mk (FT_CC): Removed. Unused. + +2013-12-04 Werner Lemberg + + [sfnt] Fix handling of embedded bitmap strikes. + + This corrects the commit from 2013-11-21. Problem reported by + Andrey Panov . + + * src/sfnt/ttsbit.c (tt_sbit_decoder_load_bitmap): Fix logic to + detect excessive bytes for bit-aligned bitmaps. + +2013-12-03 Werner Lemberg + + [truetype] Remove dead code. + + Reported by Nigel Tao . + + * include/internal/tttypes.h (TT_LoaderRec): Remove unused + `preserve_pps' field. + * src/truetype/ttgload.c (TT_Hint_Glyph): Updated. + +2013-12-03 Werner Lemberg + + [truetype] Fix phantom point handling. + + This is a further improvement to the changes from 2013-11-06. + + * src/truetype/ttgload.c (TT_Hint_Glyph): Horizontal phantom points + are rounded horizontally, vertical ones are rounded vertically. + (TT_LOADER_SET_PP): The horizontal position of vertical phantom + points in pre-ClearType mode is zero, as shown in the OpenType + specification. + +2013-12-02 Werner Lemberg + + [truetype] Fix change from 2013-11-20. + + Problem reported by Akira Kakuto . + + * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Protect call to + `Update_Max' with both a TT_USE_BYTECODE_INTERPRETER guard and a + `IS_HINTED' clause. + Also remove redundant check using `maxSizeOfInstructions' – in + simple glyphs, the bytecode data comes before the outline data, and + a validity test for this is already present. + +2013-11-27 Werner Lemberg + + [autofit] Fix use of dumping functions in `ftgrid' demo program. + + * src/autofit/afhints.c (AF_DUMP) [FT_DEBUG_AUTOFIT]: New macro. + (af_glyph_hints_dump_points, af_glyph_hints_dump_segments, + af_glyph_hints_dump_edges) [FT_DEBUG_AUTOFIT]: Add parameter to + handle output to stdout. + Use AF_DUMP. + (af_glyph_hints_dump_points, af_glyph_hints_dump_segments, + af_glyph_hints_dump_edges) [!FT_DEBUG_AUTOFIT]: Removed. + +2013-11-25 Werner Lemberg + + * Version 2.5.1 released. + ========================= + + + Tag sources with `VER-2-5-1'. + + * docs/VERSION.DLL: Update documentation and bump version number to + 2.5.1. + + * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, + builds/windows/vc2005/index.html, + builds/windows/vc2008/freetype.vcproj, + builds/windows/vc2008/index.html, + builds/windows/vc2010/freetype.vcxproj, + builds/windows/vc2010/index.html, + builds/windows/visualc/freetype.dsp, + builds/windows/visualc/freetype.vcproj, + builds/windows/visualc/index.html, + builds/windows/visualce/freetype.dsp, + builds/windows/visualce/freetype.vcproj, + builds/windows/visualce/index.html, + builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2005-ce/index.html, + builds/wince/vc2008-ce/freetype.vcproj, + builds/wince/vc2008-ce/index.html: s/2.5.0/2.5.1/, s/250/251/. + + * include/freetype/freetype.h (FREETYPE_PATCH): Set to 1. + + * builds/unix/configure.raw (version_info): Set to 17:0:11. + * CMakeLists.txt (VERSION_PATCH): Set to 2. + * docs/CHANGES, docs/release: Updated. + +2013-11-23 Werner Lemberg + + [truetype]: Add tricky font names `hkscsiic.ttf' and `iicore.ttf'. + + * src/truetype/ttobjs.c (TRICK_NAMES_MAX_CHARACTERS, + TRICK_NAMES_COUNT): Updated. + (trick_names): Add family name for the two fonts. + +2013-11-23 Werner Lemberg + + * src/sfnt/ttsbit.c (tt_sbit_decoder_load_bitmap): Typo. + +2013-11-21 Werner Lemberg + + [sfnt] Typo. + + Problem reported by Hin-Tak Leung . + + * src/sfnt/sfobjs.c (sfnt_load_face): Return correct `bsize->width' + value if the font lacks an `OS/2' table. + +2013-11-21 Werner Lemberg + + [sfnt] Improve handling of buggy embedded bitmap strikes. + + We are now able to successfully load `AppleMyoungJo.ttf'. + Problem reported by Hin-Tak Leung . + + * src/sfnt/ttsbit.c (tt_sbit_decoder_load_bitmap): Don't trust glyph + format. + +2013-11-20 Werner Lemberg + + [truetype] Don't trust `maxp's `maxSizeOfInstructions'. + + Problem reported by Hin-Tak Leung ; see + + http://lists.nongnu.org/archive/html/freetype-devel/2013-08/msg00005.html + + for details. + + * src/base/ftobjs.c (FT_Load_Glyph): Check size of `fpgm' and `prep' + tables also for setting `autohint'. + + * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Use code from + `TT_Process_Composite_Glyph' for handling unreliable values of + `maxSizeOfInstructions'. + +2013-11-16 Werner Lemberg + + [sfnt] Fix `OS/2' table version 5 support. + + We now follow the `official' announcement from Microsoft (on the + OpenType mailing list, which unfortunately hasn't a public archive). + + * include/freetype/tttables.h (TT_OS2): + s/usLowerPointSize/usLowerOpticalPointSize/, + s/usUpperPointSize/usUpperOpticalPointSize/. + + * src/sfnt/ttload.c (tt_face_load_os2): Update, and set correct + default values. + +2013-11-13 Werner Lemberg + + * builds/unix/ft2unix.h: Remove. No longer necessary. + + * builds/unix/install.mk (install): Updated. + +2013-11-13 Werner Lemberg + + Simplify header file hierarchy. + + This large patch changes the header file directory layout from + `include/freetype/...' to `include/...', effectively removing one + level. Since the file `ft2build.h' is also located in `include' + (and it stays there even after installation), all FreeType header + files are now in a single directory. + + Applications that use (a) `freetype-config' or FreeType's + `pkg-config' file to get the include directory for the compiler, and + (b) the documented way for header inclusion like + + #include + #include FT_FREETYPE_H + ... + + don't need any change to the source code. + + * include/freetype/*: Move up to... + * include/*: ... this directory. + + * builds/amiga/include/freetype/*: Move up to... + * builds/amiga/include/*: ... this directory. + + */*: Essentially do `s@/freetype/@/@' where appropriate. + + * CMakeList.txt: Simplify. + * builds/unix/freetype-config.in, builds/unix/freetype2.in: For + `--cflags', return a single directory. + * builds/unix/install.mk (install): No longer try to remove `cache' + and `internal' subdirectories; instead, remove the `freetype' + subdirectory. + +2013-11-12 Werner Lemberg + + [truetype] Fix last `truetype' commit. + + * src/truetype/ttgload.c (tt_get_metrics): Preserve stream position. + Return error value. + (load_truetype_glyph): Updated. + +2013-11-10 Werner Lemberg + + * docs/CMAKE: New dummy file. + +2013-11-08 Dave Arnold + + [cff] Fix for hints that touch. + + * src/cff/cf2hints.c (cf2_hintmap_insertHint): Fix condition for + finding index value of insertion point. + +2013-11-06 Werner Lemberg + + [truetype] Fix handling of phantom points in composite glyphs. + Problem reported by Nigel Tao . + + This is a follow-up commit to the previous one. + + * src/truetype/ttgload.c (load_truetype_glyph): Call + `tt_get_metrics' after loading the glyph header. + +2013-11-06 Werner Lemberg + + [truetype] Improve emulation of vertical metrics. + + This commit also improves the start values of vertical phantom + points. Kudos to Greg Hitchcock for help. + + * src/truetype/ttgload.c (TT_Get_VMetrics): Add parameter to pass + `yMax' value. Replace code with fixed Microsoft definition. + (tt_get_metrics): Updated. + (TT_LOADER_SET_PP): Add explanation how to initialize phantom + points, taken from both the OpenType specification and private + communication with Greg (which will eventually be added to the + standard). + Fix horizontal position of `pp3' and `pp4'. + + * src/truetype/ttgload.h: Updated. + + * src/truetype/ttdriver.c (tt_get_advances): Updated. + + * docs/CHANGES: Updated. + +2013-11-05 Werner Lemberg + + * builds/windows/vc2010/freetype.vcxproj: s/v110/v100/. + PlatformToolSet version 110 is for VC2012. + + Problem reported (with solution) by Dave Arnold . + +2013-11-05 Werner Lemberg + + [truetype] Correctly reset point tags for glyph components. + Problem reported by Nigel Tao . + + * src/truetype/ttgload.c (TT_Process_Composite_Glyph): Fix loop. + +2013-11-02 Werner Lemberg + + [truetype] Fix GETINFO opcode handling of subpixel hinting bits. + + * src/truetype/ttinterp.c (Ins_GETINFO): Don't request bit 6 set to + get info on subpixel hinting. + + * docs/CHANGES: Updated. + +2013-11-02 Werner Lemberg + + Fix Savannah bug #40451. + + Simply apply the patch from the bug report. + + * builds/unix/ftconfig.in, builds/vms/ftconfig.h, + include/freetype/config/ftconfig.h: The used #pragma directives only + work with gcc versions 4.6 and higher. + +2013-11-01 Werner Lemberg + + * docs/CHANGES: Updated. + +2013-11-01 Werner Lemberg + + [truetype] Minor code refactoring. + + Two benefits: The allocated FDEF (and IDEF) array gets slightly + smaller, and the `ttdebug' demo program has access to function + numbers without additional costs. + + Fortunately, no changes to FontForge are necessary – this is the + only external TrueType debugger I know of, but others may exist and + should check the code accordingly. + + * src/truetype/ttinterp.h (TT_CallRec): Replace `Cur_Restart' and + `Cur_End' with a pointer to the corresponding `TT_DefRecord' + structure. + + * src/truetype/ttinterp.c (DO_JROT, DO_JMPR, DO_JROF, Ins_ENDF, + Ins_CALL, Ins_LOOPCALL, Ins_UNKNOWN, TT_RunIns ): + Updated. + +2013-10-27 Werner Lemberg + + [sfnt] Implement support for `OS/2' table version 5. + + See + + http://typedrawers.com/discussion/470/new-microsoft-size-specific-design-selection-mechanism + + for the announcement. + + * include/freetype/tttables.h (TT_OS2): Add fields + `usLowerPointSize' and `usUpperPointSize'. Since FreeType returns + this structure only as a pointer through `FT_Get_Sfnt_Table', there + shouldn't be any ABI problems. + + * src/sfnt/ttload.c (tt_face_load_os2): Implement it. + + * docs/CHANGES: Updated. + +2013-10-24 Werner Lemberg + + * README.git, docs/CHANGES, docs/INSTALL: Updated. + +2013-10-24 John Cary + + Provide cmake support. + + * CMakeLists.txt: New file. + +2013-10-23 Kenneth Miller + Werner Lemberg + + Provide support for x64 builds in Visual C++ project files. + + * src/builds/win32: Renamed to... + * src/builds/windows: This. + + * src/builds/windows/vc2010/*: Updated to handle x64 target. + + * src/builds/windows/*.mk, docs/INSTALL.GNU: s/win32/windows/ where + appropriate. + +2013-10-22 Werner Lemberg + + * src/base/md5.c, src/base/md5.h: Updated to recent version. + + * src/base/ftobjs.c: Updated; `md5.c' no longer uses `free'. + + The canonical URL to get updates for this file is + + http://cvsweb.openwall.com/cgi/cvsweb.cgi/Owl/packages/popa3d/popa3d/md5/ + + as the author told me in private communication. + +2013-10-19 Werner Lemberg + + [autofit] s/SMALL_TOP/X_HEIGHT/. + + * src/autofit/afblue.dat: Updated. + + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + + * src/autofit/aflatin.c, src/autofit/aflatin.h, + src/autofit/atlatin2.c: Updated. + +2013-10-19 Werner Lemberg + + * src/autofit/afblue.dat: s/MINOR/DESCENDER/. + + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + +2013-10-16 Werner Lemberg + + [autofit] Add description strings to script entries. + + Currently, this is unused. + + * src/autofit/afscript.h: Do it. + * src/autofit/afglobal.c, src/autofit/afpic.c, + src/autofit/aftypes.h: Updated. + +2013-10-16 Werner Lemberg + + [autofit] Improve tracing message for extra light flag. + + * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Do it. + +2013-10-15 Chongyu Zhu + + [arm] Fix thumb2 inline assembly under LLVM. + + When using `ADD' with an immediate operand, the instruction is + actually `ADD Rd, Rn, #', that is, the maximum of the + immediate operand cannot exceed 4095. It will fail to compile with + LLVM. + + However, in GCC, due to some legacy compatibility considerations, + `ADD.W' will be automatically emitted when the immediate operand is + larger than 4095. + + * builds/unix/ftconfig.in, include/freetype/config/ftconfig.h + (FT_MulFix_arm) [__GNUC__]: Support clang compiler. + + * src/truetype/ttinterp.c (TT_MulFix14_arm) [__GNUC__]: Ditto. + +2013-10-12 Werner Lemberg + + [autofit] Improve tracing of `latin' hinter. + + * src/autofit/aflatin.c (af_latin_metrics_init_blues): Report blue + zone types. + (af_latin_metrics_scale_dim): Report scaling changes due to x height + alignment. + Report scaled stroke width and blue zone values. + +2013-10-03 Dave Arnold + + * src/cff/cf2font.c (cf2_computeDarkening): Avoid division by zero. + + Note that the old code avoided using a region of the piecewise + linear function where the slope was zero. The recovery was to use a + different section of the function, which produced a different, + incorrect amount of darkening. + +2013-10-02 Darrell Bellert + + * src/sfnt/ttload.c (tt_face_load_pclt): Fix `pclt_fields'. + +2013-10-02 Dave Arnold + + * src/cff/cf2font.c (cf2_computeDarkening): Initialize darkenAmount. + + This line was lost in commit 89ca1fd6 (from 2013-06-25). The effect + is to use a previous darkening amount when producing an unhinted, + unscaled outline. This can cause autohint samples in ftgrid and + ftview to be based on darkened CFF outlines instead of unhinted, + undarkened ones. + +2013-09-29 Dave Arnold + + Fix Savannah bug #39295. + + The bug was caused by switching to the initial hintmap (the one in + effect when `moveto' executes) just before drawing the final element + in the charstring. This ensured that the path was closed (in both + Character Space and Device Space). But if the final element was a + curve and if the final hintmap was different enough from the initial + one, then the curve was visibly distorted. + + The first part of the fix is to draw the final curve using the final + hintmap as specified by the charstring. This corrects the + distortion but does not ensure closing in Device Space. It may + require the rasterizer to automatically generate an extra closing + line. Depending on the hintmap differences, this line could be from + zero to a couple pixels in length. + + The second part of the fix covers the case where the charstring + subpath is closed with an explicit line. We now modify that line's + end point to avoid the distortion. + + Some glyphs in the bug report font (TexGyreHeros-Regular) that show + the change are: + + 25ppem S (98) + 24ppem eight (52) + 25.5ppem p (85) + + Curves at the *end* of a subpath are no longer distorted. However, + some of these glyphs have bad hint substitutions in the middle of a + subpath, and these are not affected. + + The patch has been tested with a set of 106 fonts that shipped with + Adobe Creative Suite 4, together with 756 Open Source CFF fonts from + Google Fonts. There are 1.5 million glyphs, of which some 20k are + changed with the fix. A sampling of a few hundred of these changes + have been examined more closely, and the changes look good (or at + least acceptable). + + * src/cff/cf2hints.h (CF2_GlyphPathRec): New element `pathIsClosing' + to indicate that we synthesize a closepath line. + + * src/cff/cf2hints.c (cf2_glyphpath_init): Updated. + (cf2_glyphpath_pushPrevElem): If closing, use first hint map (for + `lineto' operator) and adjust hint zone. + For synthesized closing lines, use end point in first hint zone. + (cf2_glyphpath_lineTo): Take care of synthesized closing lines. In + particular, shift the detection of zero-length lines from character + space to device space. + (cf2_glyphpath_closeOpenPath): Remove assertion. + Updated. + +2013-09-25 Werner Lemberg + + * src/autofit/aflatin.c (af_{grek,cyrl}_uniranges): Fix arrays. + +2013-09-25 suzuki toshiya + + [bdf, pcf] Refuse non-zero face_index. + + Suggested by Akira Tagoh, see + + http://lists.gnu.org/archive/html/freetype/2013-09/msg00030.html + + * src/bdf/bdfdrivr.c (BDF_Face_Init): Return `Invalid_Argument' + error if the font could be opened but non-zero `face_index' is + given. + * src/pcf/pcfdrivr.c (PCF_Face_Init): Ditto. + + * src/type42/t42objs.c (T42_Face_Init): Remove unrequired FT_UNUSED + macro for `face_index' because it is validated later. + +2013-09-23 Werner Lemberg + + Fix Savannah bug #40090. + + * src/autofit/afcjk.c (af_cjk_metrics_scale): Revert commit + 306f8c5d (from 2013-08-25) affecting this function. + +2013-09-22 Werner Lemberg + + [autofit] Disunify Cyrillic and Greek handling from Latin. + + * src/autofit/afscript.h: Add Cyrillic and Greek. + + * src/autofit/afblue.dat (AF_BLUE_STRINGSET_GREK, + AF_BLUE_STRINGSET_CYRL): Add blue zones for Greek and Cyrillic. + (AF_BLUE_STRINGSET_LATN): Fix typo. + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + + * src/autofit/aflatin.c (af_grek_uniranges, af_cyrl_uniranges): New + arrays. + (af_grek_script_class, af_cyrl_script_class): New scripts. + * src/autofit/aflatin.h: Updated. + +2013-09-20 Werner Lemberg + + * docs/CHANGES: Updated. + +2013-09-20 Behdad Esfahbod + + Fix vertical size of emboldened glyphs. + + Cf. https://bugzilla.gnome.org/show_bug.cgi?id=686709 + + * src/base/ftsynth.c (FT_GlyphSlot_Embolden): Adjust `horiBearingY' + also. + +2013-09-11 Alexei Podtelezhnikov + + * include/freetype/ftoutln.h: Correct FT_Outline_Get_Orientation + algorithm description. + +2013-09-11 Werner Lemberg + + [autofit] Improve Hebrew rendering. + + This change introduces a new blue zone property + `AF_BLUE_PROPERTY_LATIN_LONG' to make the auto-hinter ignore short + top segments. + + * src/autofit/afblue.dat: Fix Hebrew blue strings. + Use AF_BLUE_PROPERTY_LATIN_LONG for AF_BLUE_STRING_HEBREW_TOP. + + * src/autofit/afblue.hin (AF_BLUE_PROPERTY_LATIN_LONG): New macro. + + * src/autofit/afblue.c, src/autofit/afblue.h: Updated. + + * src/autofit/aflatin.c (af_latin_metrics_init_blues): Handle + `AF_LATIN_IS_LONG_BLUE'. + + * src/autofit/aflatin.h (AF_LATIN_IS_LONG_BLUE): New macro. + +2013-08-28 Behdad Esfahbod + + [sfnt] Fix frame access while reading WOFF table directory. + + * src/sfnt/sfobjs.c (woff_open_font): Using single memory frame + while reading the directory entries for the whole loop. + +2013-08-29 Werner Lemberg + Behdad Esfahbod + + Implement support for WOFF containers. + + We simply synthesize a SFNT from the WOFF, create a memory stream + for the new data, and load the SFNT as usual. + + Does NOT add any API to access WOFF metadata or private blocks. + + * include/freetype/internal/tttypes.h (WOFF_HeaderRec, + WOFF_TableRec): New structures. + + * include/freetype/tttags.h (TTAG_wOFF): New macro. + + * src/base/ftobjs.c (FT_Open_Face): Set `stream' after calling + `open_face'. + + * src/sfnt/sfobjs.c [FT_CONFIG_OPTION_SYSTEM_ZLIB]: Include + `FT_GZIP_H'. + (WRITE_BYTE, WRITE_USHORT, WRITE_ULONG): New temporary macros for + writing to a stream. + (sfnt_stream_close, compare_offsets, woff_open_font): New functions. + (sfnt_open_font): Handle `TTAG_wOFF'. + (sfnt_init_face): Set `stream' after calling `sfnt_open_font'. + + * src/truetype/ttobjs.c (tt_face_init): Set `stream' after calling + `sfnt->init_face'. + + * src/base/ftobjs.c (open_face): Use a pointer to FT_Stream as an + argument so that a changed stream survives. + Update callers. + +2013-08-28 Werner Lemberg + + [gzip] New function `FT_Gzip_Uncompress'. + + This is modeled after zlib's `uncompress' function. We need this + for WOFF support. + + * include/freetype/ftgzip.h, src/gzip/ftgzip.c (FT_Gzip_Uncompress): + New function. + + * src/gzip/rules.mk: Rewrite to better reflect dependencies. + +2013-08-28 Werner Lemberg + + [autofit] Fix `make multi' compilation. + + * src/autofit/afblue.cin, src/autofit/afblue.c: Don't include + `afblue.h' but `aftypes.h'. + * src/autofit/afcjk.c: Don't include `aftypes.h' but `afglobal.h'. + +2013-08-28 Werner Lemberg + + [autofit] Fix C++ compilation. + + * src/autofit/afglobal.c (af_face_globals_get_metrics), + src/autofit/afdummy.c (af_dflt_script_class), src/autofit/afindic.c + (af_deva_script_class): Use proper casts. + +2013-08-27 Behdad Esfahbod + + * src/sfnt/ttload.c (tt_face_load_font_dir): Fix sign typos. + +2013-08-27 Behdad Esfahbod + + FT_Open_Face: Improve external stream handling. + + If the font's `clazz->init_face' function wants to swap to new + stream, handling of whether original stream was external could + result to either memory leak or double free. Mark externality into + face flags before calling `init_face' such that the clazz can handle + external streams properly. + + * src/base/ftobjs.c (FT_Open_Face): Move code to set + FT_FACE_FLAG_EXTERNAL_STREAM to... + (open_face): This function. + +2013-08-27 Werner Lemberg + + Remove `FT_SqrtFixed' function. + + It's no longer used. + + * include/freetype/internal/ftcalc.h, src/base/ftcalc.c: Do it. + +2013-08-27 Werner Lemberg + + [autofit] While tracing, report script names instead of ID values. + + * src/autofit/afglobal.c (af_script_names) [FT_DEBUG_LEVEL_TRACE]: + New array. + * src/autofit/afglobal.h: Updated. + + * src/autofit/afcjk.c (af_cjk_metrics_init_widths, + af_cjk_hint_edges): Use `af_script_names'. + * src/autofit/aflatin.c (af_latin_metrics_init_widths, + af_latin_hint_edges): Ditto. + +2013-08-26 Werner Lemberg + + [autofit] Report used script while hinting a glyph. + + * src/autofit/afcjk.c (af_cjk_hint_edges), src/autofit/aflatin.c + (af_latin_hint_edges): Implement it. + +2013-08-26 Werner Lemberg + + [autofit] Add support for Hebrew script. + + * src/autofit/afblue.dat: Add blue strings for Hebrew. + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + + * src/autofit/aflatin.c (af_hebr_uniranges): New array. + (af_hebr_script_class): New script. + * src/autofit/aflatin.h, src/autofit/afscript.h: Updated. + +2013-08-26 Werner Lemberg + + [autofit] Improve tracing messages. + + * src/autofit/afcjk.c (af_cjk_metrics_init_widths): Mention script + ID in tracing message. + (af_cjk_metrics_init_blues): Initialize `axis' outside of the inner + loop. + Improve tracing messages. + (af_cjk_hint_edges) [FT_DEBUG_LEVEL_TRACE]: New variable + `num_actions' to count hinting actions. + Improve tracing messages. + + * src/autofit/aflatin.c (af_latin_metrics_init_widths): Mention + script ID in tracing message. + (af_latin_metrics_init_blues, af_latin_hint_edges): Improve tracing + messages. + +2013-08-26 Werner Lemberg + + Better tracing of loaded glyphs. + + Previously, the loading of a glyph was traced at level 4, if at all. + With this change, all font loading routines emit a tracing message + at level 1, making it easier to select tracing output (for example + using F2_DEBUG="any:1 afhints:7 aflatin:7"). + + * src/bdf/bdfdrivr.c (BDF_Glyph_Load): Add tracing message. + * src/cff/cffdrivr.c (cff_glyph_load): Ditto. + * src/cff/cffgload.c (cff_decoder_prepare): Improve tracing + messages. + * src/cid/cidgload.c (cid_load_glyph): Use level 1 for tracing + message. + * src/pcf/pcfdrivr.c (PCF_Glyph_Load): Ditto. + * src/pfr/pfrobjs.c (pfr_slot_load): Add tracing message. + * src/truetype/ttgload.c (TT_Load_Glyph): Ditto. + * src/type1/t1gload.c (T1_Load_Glyph): Ditto. + * src/type42/t42objs.c (T42_GlyphSlot_Load): Ditto. + * src/winfonts/winfnt.c (FNT_Load_Glyph): Ditto. + +2013-08-26 Werner Lemberg + + [autofit] Fix script selection. + + * src/autofit/afglobal.c (af_face_globals_get_metrics): Use + `AF_SCRIPT_DFLT', not value 0. + Simplify code. + + * src/autofit/afscript.h: Sort by script name. + +2013-08-26 Werner Lemberg + + [autofit] Make `dummy' hinter work as expected. + + * src/autofit/afdummy.c (af_dummy_hints_init): Properly set scaling + information. + (af_dummy_hints_apply): Scale the glyphs. + +2013-08-25 Werner Lemberg + + [autofit] Make `cjk' module use blue stringsets. + + * src/autofit/afcjk.c (AF_CJK_MAX_TEST_CHARACTERS): Removed. + (af_cjk_hani_blue_chars): Removed. + (AF_CJK_BLUE_TYPE_*): Removed. + (af_cjk_metrics_init_blues): Replace AF_CJK_MAX_TEST_CHARACTERS with + AF_BLUE_STRING_MAX_LEN. + Change loops to use offsets (in file `afblue.h') into the new arrays + `af_blue_stringsets' and `af_blue_strings' (in file `afblue.c'). + Instead of three dimensions (as used in the old blue string array) + we now use properties to do the same, saving one loop nesting level. + + * src/autofit/afcjk.h: Remove old enumeration values superseded by + the new data in `afblue.h'. + (AF_CJK_IS_TOP_BLUE, AF_CJK_IS_HORIZ_BLUE, AF_CJK_IS_FILLED_BLUE, + AF_CJK_IS_RIGHT_BLUE): New macros, to be used in + `af_cjk_metrics_init_blues'. + (AF_CJK_BLUE_IS_RIGHT): Remove this now redundant enum value. + (AF_CJK_BLUE_IS_TOP): Renamed to... + (AF_CJK_BLUE_TOP): This. + (AF_CJK_MAX_BLUES): Remove. + (AF_CJKAxisRec): Updated. + +2013-08-25 Werner Lemberg + + [autofit] Typo. + + * src/autofit/afblue.hin, src/autofit/afblue.c (GET_UTF8_CHAR): Use + cast. + +2013-08-25 Werner Lemberg + + [autofit] Synchronize `cjk' with `latin' module (and vice versa). + + * src/autofit/afcjk.c (af_cjk_metrics_init_widths): Add tracing + messages. + (af_cjk_metrics_init_blues): Don't pass blue string array as + argument but use the global array directly. + Use `outline' directly. + Update and add tracing messages. + (af_cjk_metrics_init): Simplify code. + (af_cjk_metrics_scale_dim): Improve tracing message. + (af_cjk_metrics_scale): Synchronize. + + * src/autofit/aflatin.c (af_latin_metrics_init_widths, + af_latin_metrics_init_blues): Improve and add tracing messages. + +2013-08-25 Werner Lemberg + + [autofit] Make `latin' module use blue stringsets. + + * src/autofit/aflatin.c (AF_LATIN_MAX_TEST_CHARACTERS): Removed. + (af_latin_blue_chars): Removed. + (af_latin_metrics_init_blues): Replace AF_LATIN_MAX_TEST_CHARACTERS + with AF_BLUE_STRING_MAX_LEN. + Change loops to use offsets (in file `afblue.h') into the new arrays + `af_blue_stringsets' and `af_blue_strings' (in file `afblue.c'). + Use `AF_LATIN_IS_SMALL_TOP_BLUE' macro. + + * src/autofit/aflatin.h: Remove old enumeration values superseded by + the new data in `afblue.h'. + (AF_LATIN_IS_TOP_BLUE): Updated definition. + (AF_LATIN_IS_SMALL_TOP_BLUE): New macro. + (AF_LATIN_MAX_BLUES): Remove. + (AF_LatinAxisRec): Updated. + +2013-08-25 Werner Lemberg + + [autofit] Add blue stringsets. + + * src/autofit/aftypes.h: Include `afblue.h'. + (AF_ScriptClassRec): Add `blue_stringset' field. + (AF_DEFINE_SCRIPT_CLASS): Updated. + + * src/autofit/autofit.c: Include `afblue.c'. + + * src/autofit/afcjk.c (af_hani_script_class), src/autofit/afdummy.c + (af_dflt_script_class), src/autofit/afindic.c + (af_deva_script_class), src/autofit/aflatin.c + (af_latn_script_class), src/autofit/aflatin2.c + (af_ltn2_script_class): Updated. + + * src/autofit/rules.mk (AUTOF_DRV_SRC): Add `afblue.c'. + +2013-08-25 Werner Lemberg + + [autofit] Introduce data file for blue strings. + + The idea is to have a central file which gets processed by a Perl + script to create proper `.c' and `.h' files using templates. There + are two other reasons to do that: + + . The data file should be easily readable. We use UTF-8 encoding + which then gets converted to single bytes. + + . Since the number of supported scripts will increase soon, the + current usage of blue string arrays is a waste of space. Using + the Perl script it is possible to imitate jagged arrays, + defining enumeration constants as offsets into the arrays. + + This commit only adds files without changing any functionality. + + * src/autofit/afblue.dat: New data file. + * src/tools/afblue.pl: New Perl script for processing `afblue.dat'. + + * src/autofit/afblue.cin, src/autofit/afblue.hin: New template files + for... + * src/autofit/afblue.c, src/autofit/afblue.c: New source files. + To avoid a dependency on Perl, we add them too. + +2013-08-19 Alexei Podtelezhnikov + + [base] Enable new algorithm for `BBox_Cubic_Check'. + + * src/base/ftbbox.c: Enable new BBox_Cubic_Check algorithm, remove + the old one. + Improve comments. + +2013-08-18 Werner Lemberg + + * builds/unix/unix-def.in (freetype2.pc): Don't set executable bit. + +2013-08-18 Werner Lemberg + + Fix Savannah bug #39804. + + * builds/unix/configure.raw (LIBPNG): Define and export. + * builds/unix/freetype-config.in, builds/unix/freetype2.in: Handle + libpng. + +2013-08-17 Alexei Podtelezhnikov + + [base] Clean up BBox_Conic_Check. + + * src/base/ftbbox.c (BBox_Conic_Check): Remove redundant checks for + extremum at the segment ends, which are already within the bbox. + Slightly modify calculations. + +2013-08-15 Alexei Podtelezhnikov + + [base] Finish experimental (disabled) BBox_Cubic_Check implementation. + + * src/base/ftbbox.c (BBox_Cubic_Check): Scale arguments to improve + accuracy and avoid overflows. + +2013-08-13 Alexei Podtelezhnikov + + [base] Refactor experimental (disabled) BBox_Cubic_Check. + + * src/base/ftbbox.c (BBox_Cubic_Check): Implement the minimum search + as the mirror image of the maximum search implemented here... + (update_max): New function. + +2013-08-06 John Tytgat + + Fix Savannah bug #39702. + + * src/cff/cffload.c (cff_index_get_pointers): Check for `cur_offset + != 0'; this stronger test is mandated by the CFF specification. + Fix test for INDEX structures which have one or more empty entries + at the end. + +2013-08-05 Werner Lemberg + + Fix gcc pragmas, part 2. + + * src/truetype/ttinterp.c (TT_MulFix14_long_long, + TT_DotFix14_long_long): `#pragma gcc diagnostic {push,pop}' has been + introduced with gcc version 4.6. + +2013-08-05 Werner Lemberg + + Fix gcc pragmas. + + * src/truetype/ttinterp.c (TT_MulFix14_long_long, + TT_DotFix14_long_long): Older gcc versions don't accept diagnostic + pragmas within a function body. + +2013-08-05 Werner Lemberg + + Fix Savannah bug #39700. + + * builds/unix/ftconfig.h: Synchronize with + `include/freetype/config/ftconfig.h'. + + * builds/vms/ftconfig.h: Ditto. + Make the differences to the master `ftconfig.h' file as small as + possible for easier maintainance. + +2013-08-05 Werner Lemberg + + [autofit] Improve handling of `near' points. + + Points which are very near to each other are now marked as such. + The `weak' flag is then computed by using the `in' vector of the + first and the `out' vector of the last point of a group of near + points. + + For example, this fixes the rendering of glyph `Oslash' in + `Roboto-Thin.ttf'. + + * src/autofit/afhints.h (AF_Flags): New value `AF_FLAGS_NEAR'. + + * src/autofit/afhints.c (af_glyph_hints_reload): Introduce + the heuristic value `near_limit' to decide whether the current point + is near to the previous one, then set `AF_FLAG_NEAR' accordingly. + Store good `in' vector (of last non-near point) in + `last_good_in_{x,y}' and use it as an argument to + `ft_corner_is_flat' if necessary. + +2013-08-02 Werner Lemberg + + * include/freetype/ftcffdrv.h: Improve documentation. + This is based on blog entries from David Lemon and Dave Arnold (both + from Adobe) with kind permission. Dave also helped in + proof-reading. + +2013-08-02 Werner Lemberg + + [autofit] Move declaration of scripts into separate file. + + This has the benefit that we don't need to duplicate the data at + different places. + + * src/autofit/afscript.h: New file. + + * src/autofit/aftypes.h (AF_Script): Include `afscript.h' to define + the enumeration values. + + * src/autofit/afglobal.c: Include `afscript.h' to get the script + specific header files. + (af_script_classes): Include `afscript.h' to fill this array. + + * src/autofit/afpic.c: Include `afscript.h' to get the script + specific header files. + (autofit_module_class_pic_init): Include `afscript.h' for + initialization. + * src/autofit/afpic.h (AF_SCRIPT_CLASSES_COUNT, + AF_SCRIPT_CLASSES_REC_COUNT): Removed. Use `AF_SCRIPT_MAX' instead. + + * src/autofit/rules.mk (AUTOF_DRV_H): Updated. + +2013-08-02 Werner Lemberg + + [autofit] Move declaration of writing systems into separate file. + + This has the benefit that we don't need to duplicate the data at + different places. + + * src/autofit/afwrtsys.h: New file. + + * src/autofit/aftypes.h (AF_WritingSystem): Include `afwrtsys.h' to + define the enumeration values. + + * src/autofit/afglobal.c: Include `afwrtsys.h' to get the writing + system specific header files. + Include `afpic.h'. + (af_writing_system_classes): Include `afwrtsys.h' to fill this + array. + + * src/autofit/afpic.c: Include `afwrtsys.h' to get the writing + system specific header files. + (autofit_module_class_pic_init): Include `afwrtsys.h' for + initialization. + * src/autofit/afpic.h (AF_WRITING_SYSTEM_CLASSES_COUNT, + AF_WRITING_SYSTEM_CLASSES_REC_COUNT): Removed. Use + `AF_WRITING_SYSTEM_MAX' instead. + +2013-08-02 Werner Lemberg + + [sfnt] Fix compilation with g++. + + * src/sfnt/pngshim.c (error_callback, read_data_from_FT_stream): Use + cast. + (Load_SBit_Png): Pacify compiler. + +2013-08-02 suzuki toshiya + Werner Lemberg + + [autofit] Fix `make multi'. + + * include/freetype/config/ftconfig.h (FT_LOCAL_ARRAY, + FT_LOCAL_ARRAY_DEF): New macros. + + * src/autofit/afglobal.c (af_writing_system_classes, + af_script_classes): Use FT_LOCAL_ARRAY_DEF. + * src/autofit/afglobal.h: Declare `af_writing_system_classes' and + `af_script_classes'. + * src/autofit/afloader.c: Include `afpic.h'. + +2013-08-01 Werner Lemberg + + Another round of cppcheck nitpicks. + + The call was (from the top-level of the FreeType tree): + + cppcheck --force \ + --enable=all \ + -I /usr/include \ + -I /usr/local/include \ + -I /usr/lib/gcc/i586-suse-linux/4.7/include \ + -I include \ + -I include/freetype \ + -I include/freetype/config \ + -I include/freetype/internal \ + -DFT2_BUILD_LIBRARY \ + . &> cppcheck.log + + using cppcheck git commit f7e93f99. + + Note that cppcheck still can't handle `#include FOO' (with `FOO' a + macro). + + */* Improve variable scopes. + */* Remove redundant initializations which get overwritten. + + * src/gxvalid/*: Comment out redundant code or guard it with + FT_DEBUG_LEVEL_TRACE. + +2013-07-30 Werner Lemberg + + [autofit] Introduce `writing systems'. + + This patch adds a new top level to the auto-hinter's script class + hierarchy. It defines `writing systems' which can contain multiple + scripts. + + For example, the `latin' writing system (in file `aflatin.c') is + able to support scripts like Latin, Cyrillic, Armenian, etc., which + can be handled similarly. + + Scripts are now named using four-letter OpenType tags. + + * src/autofit/aftypes.h (AF_ScriptClassRec): Move relevant members + to... + (AF_WritingSystemClassRec): This new structure. It holds pointers + to functions which can be shared among related scripts. + (AF_WritingSystem): New enumeration. + (AF_Script): Revised values using four-letter tags. + (AF_DEFINE_WRITING_SYSTEM_CLASS): New macro. + (AF_DEFINE_SCRIPT_CLASS): Updated. + + * src/autofit/afglobal.c (af_writing_system_classes): New global, + constant array. + (af_script_classes): Updated. + (af_face_globals_free): Updated. + Remove assertion. + (af_face_globals_get_metrics): Updated. + + * src/autofit/afglobal.h (AF_SCRIPT_FALLBACK) + [!AF_CONFIG_OPTION_CJK]: Handle this case. + + * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): + Updated. + + * src/autofit/afpic.c (autofit_module_class_pic_init): Updated; + initialize structures for both writing systems and scripts. + * src/autofit/afpic.h: Updated. + (AF_WRITING_SYSTEM_CLASSES_GET): New macro. + + * src/autofit/afcjk.c (af_cjk_writing_system_class): New writing + system. + (af_cjk_uniranges): Renamed to... + (af_hani_uniranges): This. + (af_cjk_script_class): Reduced and renamed to... + (af_hani_script_class): This. + * src/autofit/afcjk.h: Updated. + + * src/autofit/afdummy.c (af_dummy_writing_system_class): New writing + system. + (af_dummy_script_class): Reduced and renamed to... + (af_dflt_script_class): This. + * src/autofit/afdummy.h: Updated. + + * src/autofit/afindic.c (af_indic_writing_system_class): New writing + system. + (af_indic_uniranges): Renamed to... + (af_deva_uniranges): This. + (af_indic_script_class): Reduced and renamed to... + (af_deva_script_class): This. + * src/autofit/afcjk.h: Updated. + + * src/autofit/aflatin.c (af_latin_writing_system_class): New writing + system. + (af_latin_uniranges): Renamed to... + (af_latn_uniranges): This. + (af_latin_script_class): Reduced and renamed to... + (af_latn_script_class): This. + * src/autofit/aflatin.h: Updated. + + * src/autofit/aflatin2.c (af_latin2_writing_system_class): New + writing system. + (af_latin2_uniranges): Renamed to... + (af_ltn2_uniranges): This. + Synchronize ranges with `latin'. + (af_latin2_script_class): Reduced and renamed to... + (af_ltn2_script_class): This. + * src/autofit/aflatin2.h: Updated. + +2013-07-30 Werner Lemberg + + [autofit] Variable renaming. + + * src/autofit/aftypes.h (AF_ScriptMetricsRec): + s/clazz/script_class/. + Update all users. + +2013-07-30 suzuki toshiya + + Ignore libpng-config under cross-building configuration, + because it will return the flags for the hosting environment. + + * builds/unix/configure.raw: Ignore libpng-config when + `cross_compiling' == yes. + +2013-07-30 Behdad Esfahbod + + Prevent division by zero by a transparent color. + + * src/base/ftbitmap.c (ft_gray_for_premultiplied_srgb_bgra): + Return 0 immediately, when alpha channel is zero. + +2013-07-25 Behdad Esfahbod + + Add FT_FACE_FLAG_COLOR and FT_HAS_COLOR. + + Also disambiguate Google's color bitmap tables. + + * include/freetype/freetype.h (FT_FACE_FLAG_COLOR, FT_HAS_COLOR): + New macros. + + * include/freetype/internal/tttypes.h (TT_SbitTableType): Add + TT_SBIT_TABLE_TYPE_CBLC. + + * src/sfnt/sfobjs.c (sfnt_load_face): Handle FT_FACE_FLAG_COLOR. + + * src/sfnt/ttsbit.c (tt_face_load_sbit, + tt_face_load_strike_metrics, tt_face_load_sbit_image): Handle + TT_SBIT_TABLE_TYPE_CBLC. + +2013-07-24 suzuki toshiya + + [sfnt] Fix for `make multi' target. + + * src/sfnt/pngshim.c (Load_SBit_Png): Use FT_LOCAL_DEF(). + +2013-07-20 Werner Lemberg + + * docs/INSTALL.GNU: Updated. + +2013-07-20 Behdad Esfahbod + + [sfnt] Fix `sbix' table version handling. + + * src/sfnt/ttsbit.c (tt_face_load_sbit) [TT_SBIT_TABLE_TYPE_SBIX]: + USHORT version numbers are to be considered as `minor'. + +2013-07-19 Werner Lemberg + + [autofit] Fix segment classification for blue zones. + + The old code (essentially unchanged since the very beginning) + incorrectly handled this configuration + + x -o- x + / \ + / \ + / \ + o o + + as flat and this + + o o + / / + x| x| + | | + o---------------o + + as round. (`o' and `x' are on and off points, respectively). + + This is a major change which should improve the rendering results + enormously for many TrueType fonts, especially in the range approx. + 20-40ppem, fixing the appearance of many overshoots. + + * src/autofit/aflatin.c (af_latin_metrics_init_blues): Look at the + first and last points of the segment, not the points right before + and after. + +2013-07-19 Behdad Esfahbod + + [sfnt] `sbix' fix-ups. + + * src/sfnt/sfobjs.c (sfnt_load_face): Apple's `sbix' color bitmaps + are rendered scaled and then the `glyf' outline rendered on top. We + don't support that yet, so just ignore the `glyf' outline and + advertise it as a bitmap-only font. + + * src/sfnt/ttsbit.c (tt_face_load_strike_metrics) + [TT_SBIT_TABLE_TYPE_SBIX]: Return metrics in 26.6 units. + (tt_face_load_sbix_image): Typo. + +2013-07-18 Behdad Esfahbod + + [sfnt] Add support for Apple's `sbix' color bitmap table. + + * include/freetype/internal/tttypes.h (TT_SBit_MetricsRec): Widen + fields to FT_Short and FT_UShort, respectively. + (TT_SBitTableType): New enumeration. + (TT_FaceRec): Add `sbit_table_type' field. + + * include/freetype/tttags.h (TTAG_sbix): New macro. + + * src/sfnt/pngshim.c (Load_SBit_Png): Pass a more generic + FT_GlyphSlot argument instead FT_Bitmap. + Add flag to control map and metrics handling. + Update all users. + + * src/sfnt/ttsbit.c: Include `ttmtx.h'. + (tt_face_load_eblc): Renamed to... + (tt_face_load_sbit): This. + Handlic `sbix' bitmaps. + (tt_face_free_eblc): Renamed to... + (tt_face_load_sbit): This. + Updated. + (tt_face_load_strike_metrics): Handle `sbix' bitmaps. + (tt_face_load_sbix_image): New function. + (tt_sbit_decoder_alloc_bitmap, tt_sbit_decoder_load_image, + tt_sbit_decoder_load_byte_aligned, tt_sbit_decoder_load_bit_aligned, + tt_sbit_decoder_load_compound, tt_sbit_decoder_load_png, + tt_sbit_decoder_load_image, tt_sbit_decoder_load_bitmap): Don't pass + and handle load flags. + (tt_sbit_decoder_load_bitmap) [!FT_CONFIG_OPTION_USE_PNG]: Better + handle formats 17-19. + Move color to grayscale conversion to... + (tt_face_load_sbit_image): Here. + Handle `sbix' bitmaps. + + * src/sfnt/pngshim.h: Updated. + * src/sfnt/ttsbit.h: Updated. + * src/sfnt/sfdriver.c: Updated. + +2013-07-18 Werner Lemberg + + [sfnt] Ignore invalid magic number in `head' or `bhed'. + + Other font engines seem to ignore it also. Problem reported by + Hin-Tak Leung . + + * src/sfnt/ttload.c (check_table_dir): Don't abort but warn only if + we have an invalid magic number. + +2013-07-16 Werner Lemberg + + [smooth] Fix segfault caused by previous commit. + + * src/smooth/ftgrays.c (gray_set_cell): Always compute + `ras.invalid'. + +2013-07-16 David Turner + + [smooth] Improve performance. + + Provide a work-around for an ARM-specific performance bug in GCC. + This speeds up the rasterizer by more than 5%. + + Also slightly optimize `set_gray_cell' and `gray_record_cell' (which + also improves performance on other platforms by a tiny bit (<1%). + + * src/smooth/ftgrays.c (FT_DIV_MOD): New macro. + Use it where appropriate. + + (gray_record_cell, gray_set_cell, gray_move_to, + gray_convert_glyph_inner): Streamline condition handling. + +2013-07-16 David Turner + + [truetype] Add assembler code for TT_MulFix14 and TT_DotFix14. + + This patch provides slightly optimized versions for ARM, x86, and + x86_64 CPUs if built with GCC. + + Also remove some dead code. + + * src/truetype/ttinterp.c (TT_MulFix14_arm, TT_MulFix14_long_long, + TT_DotFix14_long_long): New functions. + +2013-07-16 David Turner + + Optimize FT_MulFix for x86_64 GCC builds. + + This patch provides an optimized `FT_MulFix' implementation for + x86_64 machines when FreeType is built with GCC, or compatible + compilers like Clang. + + Example: + bin/ftbench -p -t 5 -s 14 -f 0008 Arial.ttf + + Before: + + Load 4.863 us/op + Load_Advances (Normal) 4.816 us/op + Load_Advances (Fast) 0.028 us/op + Render 2.753 us/op + Get_Glyph 0.463 us/op + Get_CBox 0.077 us/op + Get_Char_Index 0.023 us/op + Iterate CMap 13.898 us/op + New_Face 12.368 us/op + Embolden 0.028 us/op + Get_BBox 0.302 us/op + + After: + + Load 4.617 us/op + Load_Advances (Normal) 4.645 us/op + Load_Advances (Fast) 0.027 us/op + Render 2.789 us/op + Get_Glyph 0.460 us/op + Get_CBox 0.077 us/op + Get_Char_Index 0.024 us/op + Iterate CMap 13.403 us/op + New_Face 12.278 us/op + Embolden 0.028 us/op + Get_BBox 0.301 us/op + + * builds/unix/ftconfig.in, include/freetype/config/ftconfig.h + (FT_MulFix_x86_64): New function. + +2013-07-16 David Turner + + Speed up ARMv7 support. + + When building for ARMv7 with thumb2 instructions, the optimized + `FT_MulFix_arm' assembly routine was not being used. + + The reason for this is in the `ftconfig.h' header, namely: + + - The assembly routine uses the `smull' instruction which is not + available when generating Thumb-1 machine code. It is available + in Thumb-2 mode, though. + + - The header was written a long time ago before Thumb-2 became + widely popular (e.g. with Android). So it simply doesn't use the + assembly routine if the `__thumb__' built-in macro is defined. + + - When compiling in Thumb-2 mode, the compiler will define both + `__thumb__' and `__thumb2__'. + + By checking for `(__thumb2__ || !__thumb__)', we ensure that the + assembly routine is only avoided when generating Thumb-1 code. + + Given that this is performance-sensitive function, this improves + `ftbench' as follows on a Galaxy Nexus: + + Before (us/op) After (us/op) + + - loading Arial.ttf glyphs at 14 ppem [1] + + Load 34.285 33.098 + + - same operation with the light auto-hinter [2] + + Load 31.317 29.590 + + - same operation without hinting [3] + + Load 6.143 5.376 + + - loading Arial.ttf advances at 14 ppem [4] + + Load_Advances (normal) 34.216 33.016 + Load_Advances (fast) 0.176 0.176 + + [1] ftbench -t 5 -p -s 14 -b a -f 0008 Arial.ttf + [2] ftbench -t 5 -p -s 14 -b a -r 1 -f 0028 Arial.ttf + [3] ftbench -t 5 -p -s 14 -b a -f 000a Arial.ttf + [4] ftbench -t 5 -p -s 14 -b b -f 0008 Arial.ttf + + * builds/unix/ftconfig.in, include/freetype/config/ftconfig.h + (FT_MULFIX_ASSEMBLER): Fix handling for ARMv7. + +2013-06-28 Werner Lemberg + + * docs/CHANGES: Updated. + +2013-06-27 Werner Lemberg + + * src/winfonts/winfnt.c (FNT_Load_Glyph): Fix bitmap width guard. + +2013-06-25 Werner Lemberg + + [cff] Add darkening limit to `darkening-parameters'. + + * src/cff/cffdrivr.c (cff_property_set): Add check. + +2013-06-25 Werner Lemberg + + [cff] Add `darkening-parameters' property. + + * include/freetype/ftcffdrv.h: Document it. + + * src/cff/cffdrivr.c (cff_property_set, cff_property_get): Handle + `darkening-parameters' property. + + * src/cff/cf2font.h (CF2_FontRec): Add `darkenParams' array. + + * src/cff/cf2font.c (cf2_computeDarkening): Add `darkenParams' + argument and use it. + Update all callers. + + * src/cff/cf2ft.c (cf2_decoder_parse_charstrings): Copy + `darken_params' values. + + * src/cff/cffobjs.h (CFF_DriverRec): Add `darken_params' array. + + * src/cff/cffobjs.c (cff_driver_init): Set default values for + `darken_params'. + +2013-06-25 Werner Lemberg + + [docmaker] Code shuffling. + + * src/tools/docmaker/tohtml.py (re_url): Move regexp... + * src/tools/docmaker/sources.py: ... to this file. + +2013-06-25 Werner Lemberg + + [docmaker] Remove unused functions. + + * src/tools/docmaker/content.py (DocMarkup.get_start, + DocBlock.get_markup_name): Removed. + * src/tools/docmaker/tohtml.py (html_quote0, dump_html_code, + HtmlFormatter.make_html_words): Removed. + +2013-06-25 Werner Lemberg + + * builds/freetype.mk (dll): Remove target. + + Problem reported by Jörg Günnewig . + +2013-06-25 Werner Lemberg + + [docmaker] Recognise URLs. + + * src/tools/docmaker/tohtml.py (re_url): New regular expression. + (make_html_para): Use it. + 2013-06-19 Werner Lemberg * Version 2.5.0.1 released. @@ -295,7 +1851,7 @@ */* Improve variable scopes. */* Remove redundant initializations which get overwritten. - * src/base/ftmac.c ,builds/mac/ftmac.c (count_faces_scalable): + * src/base/ftmac.c, builds/mac/ftmac.c (count_faces_scalable): Remove unused variable. * src/base/ftdbgmem.c (ft_mem_table_destroy): `table' can't be zero. @@ -575,7 +2131,7 @@ [sfnt] Clean up bitmap code. * src/sfnt/ttsbit.c: Deleted. - * src/sfnt/ttsbit0.c: Renamed to `ttsbit.c'. + * src/sfnt/ttsbit0.c: Renamed to `ttsbit.c'. * rules.mk (SFNT_DRV_H): Updated. 2013-05-10 Werner Lemberg diff --git a/reactos/lib/3rdparty/freetype/README b/reactos/lib/3rdparty/freetype/README index 798715a4119..c660cd1c27e 100644 --- a/reactos/lib/3rdparty/freetype/README +++ b/reactos/lib/3rdparty/freetype/README @@ -1,4 +1,4 @@ - FreeType 2.5.0 + FreeType 2.5.2 ============== Homepage: http://www.freetype.org @@ -24,9 +24,9 @@ and download one of the following files. - freetype-doc-2.5.0.tar.bz2 - freetype-doc-2.5.0.tar.gz - ftdoc250.zip + freetype-doc-2.5.2.tar.bz2 + freetype-doc-2.5.2.tar.gz + ftdoc252.zip To view the documentation online, go to diff --git a/reactos/lib/3rdparty/freetype/autogen.sh b/reactos/lib/3rdparty/freetype/autogen.sh index 0eaba395b5f..cc0e661ce5a 100644 --- a/reactos/lib/3rdparty/freetype/autogen.sh +++ b/reactos/lib/3rdparty/freetype/autogen.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright 2005, 2006, 2007, 2008, 2009, 2010 by +# Copyright 2005-2010, 2013 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -139,7 +139,7 @@ check_tool_version $LIBTOOLIZE libtoolize LIBTOOLIZE 2.2.4 check_tool_version $AUTOCONF autoconf AUTOCONF 2.62 # This sets freetype_major, freetype_minor, and freetype_patch. -eval `sed -nf version.sed include/freetype/freetype.h` +eval `sed -nf version.sed include/freetype.h` # We set freetype-patch to an empty value if it is zero. if test "$freetype_patch" = ".0"; then diff --git a/reactos/lib/3rdparty/freetype/devel/ft2build.h b/reactos/lib/3rdparty/freetype/devel/ft2build.h new file mode 100644 index 00000000000..6cc34b77b42 --- /dev/null +++ b/reactos/lib/3rdparty/freetype/devel/ft2build.h @@ -0,0 +1,40 @@ +/***************************************************************************/ +/* */ +/* ft2build.h */ +/* */ +/* FreeType 2 build and setup macros (development version). */ +/* */ +/* Copyright 1996-2001, 2003, 2006, 2013 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /* + * This is a development version of to build the library in + * debug mode. Its only difference to the default version is that it + * includes a local `ftoption.h' header file with different settings for + * many configuration macros. + * + * To use it, simply ensure that the directory containing this file is + * scanned by the compiler before the default FreeType header directory. + * + */ + +#ifndef __FT2BUILD_H__ +#define __FT2BUILD_H__ + +#define FT_CONFIG_OPTIONS_H + +#include + +#endif /* __FT2BUILD_H__ */ + + +/* END */ diff --git a/reactos/lib/3rdparty/freetype/devel/ftoption.h b/reactos/lib/3rdparty/freetype/devel/ftoption.h new file mode 100644 index 00000000000..27d1bd9a5d7 --- /dev/null +++ b/reactos/lib/3rdparty/freetype/devel/ftoption.h @@ -0,0 +1,833 @@ +/***************************************************************************/ +/* */ +/* ftoption.h (for development) */ +/* */ +/* User-selectable configuration macros (specification only). */ +/* */ +/* Copyright 1996-2013 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTOPTION_H__ +#define __FTOPTION_H__ + + +#include + + +FT_BEGIN_HEADER + + /*************************************************************************/ + /* */ + /* USER-SELECTABLE CONFIGURATION MACROS */ + /* */ + /* This file contains the default configuration macro definitions for */ + /* a standard build of the FreeType library. There are three ways to */ + /* use this file to build project-specific versions of the library: */ + /* */ + /* - You can modify this file by hand, but this is not recommended in */ + /* cases where you would like to build several versions of the */ + /* library from a single source directory. */ + /* */ + /* - You can put a copy of this file in your build directory, more */ + /* precisely in `$BUILD/config/ftoption.h', where `$BUILD' is the */ + /* name of a directory that is included _before_ the FreeType include */ + /* path during compilation. */ + /* */ + /* The default FreeType Makefiles and Jamfiles use the build */ + /* directory `builds/' by default, but you can easily change */ + /* that for your own projects. */ + /* */ + /* - Copy the file to `$BUILD/ft2build.h' and modify it */ + /* slightly to pre-define the macro FT_CONFIG_OPTIONS_H used to */ + /* locate this file during the build. For example, */ + /* */ + /* #define FT_CONFIG_OPTIONS_H */ + /* #include */ + /* */ + /* will use `$BUILD/myftoptions.h' instead of this file for macro */ + /* definitions. */ + /* */ + /* Note also that you can similarly pre-define the macro */ + /* FT_CONFIG_MODULES_H used to locate the file listing of the modules */ + /* that are statically linked to the library at compile time. By */ + /* default, this file is . */ + /* */ + /* We highly recommend using the third method whenever possible. */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** G E N E R A L F R E E T Y P E 2 C O N F I G U R A T I O N ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* Uncomment the line below if you want to activate sub-pixel rendering */ + /* (a.k.a. LCD rendering, or ClearType) in this build of the library. */ + /* */ + /* Note that this feature is covered by several Microsoft patents */ + /* and should not be activated in any default build of the library. */ + /* */ + /* This macro has no impact on the FreeType API, only on its */ + /* _implementation_. For example, using FT_RENDER_MODE_LCD when calling */ + /* FT_Render_Glyph still generates a bitmap that is 3 times wider than */ + /* the original size in case this macro isn't defined; however, each */ + /* triplet of subpixels has R=G=B. */ + /* */ + /* This is done to allow FreeType clients to run unmodified, forcing */ + /* them to display normal gray-level anti-aliased glyphs. */ + /* */ +#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING + + + /*************************************************************************/ + /* */ + /* Many compilers provide a non-ANSI 64-bit data type that can be used */ + /* by FreeType to speed up some computations. However, this will create */ + /* some problems when compiling the library in strict ANSI mode. */ + /* */ + /* For this reason, the use of 64-bit integers is normally disabled when */ + /* the __STDC__ macro is defined. You can however disable this by */ + /* defining the macro FT_CONFIG_OPTION_FORCE_INT64 here. */ + /* */ + /* For most compilers, this will only create compilation warnings when */ + /* building the library. */ + /* */ + /* ObNote: The compiler-specific 64-bit integers are detected in the */ + /* file `ftconfig.h' either statically or through the */ + /* `configure' script on supported platforms. */ + /* */ +#undef FT_CONFIG_OPTION_FORCE_INT64 + + + /*************************************************************************/ + /* */ + /* If this macro is defined, do not try to use an assembler version of */ + /* performance-critical functions (e.g. FT_MulFix). You should only do */ + /* that to verify that the assembler function works properly, or to */ + /* execute benchmark tests of the various implementations. */ +/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */ + + + /*************************************************************************/ + /* */ + /* If this macro is defined, try to use an inlined assembler version of */ + /* the `FT_MulFix' function, which is a `hotspot' when loading and */ + /* hinting glyphs, and which should be executed as fast as possible. */ + /* */ + /* Note that if your compiler or CPU is not supported, this will default */ + /* to the standard and portable implementation found in `ftcalc.c'. */ + /* */ +#define FT_CONFIG_OPTION_INLINE_MULFIX + + + /*************************************************************************/ + /* */ + /* LZW-compressed file support. */ + /* */ + /* FreeType now handles font files that have been compressed with the */ + /* `compress' program. This is mostly used to parse many of the PCF */ + /* files that come with various X11 distributions. The implementation */ + /* uses NetBSD's `zopen' to partially uncompress the file on the fly */ + /* (see src/lzw/ftgzip.c). */ + /* */ + /* Define this macro if you want to enable this `feature'. */ + /* */ +#define FT_CONFIG_OPTION_USE_LZW + + + /*************************************************************************/ + /* */ + /* Gzip-compressed file support. */ + /* */ + /* FreeType now handles font files that have been compressed with the */ + /* `gzip' program. This is mostly used to parse many of the PCF files */ + /* that come with XFree86. The implementation uses `zlib' to */ + /* partially uncompress the file on the fly (see src/gzip/ftgzip.c). */ + /* */ + /* Define this macro if you want to enable this `feature'. See also */ + /* the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below. */ + /* */ +#define FT_CONFIG_OPTION_USE_ZLIB + + + /*************************************************************************/ + /* */ + /* ZLib library selection */ + /* */ + /* This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined. */ + /* It allows FreeType's `ftgzip' component to link to the system's */ + /* installation of the ZLib library. This is useful on systems like */ + /* Unix or VMS where it generally is already available. */ + /* */ + /* If you let it undefined, the component will use its own copy */ + /* of the zlib sources instead. These have been modified to be */ + /* included directly within the component and *not* export external */ + /* function names. This allows you to link any program with FreeType */ + /* _and_ ZLib without linking conflicts. */ + /* */ + /* Do not #undef this macro here since the build system might define */ + /* it for certain configurations only. */ + /* */ +/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */ + + + /*************************************************************************/ + /* */ + /* Bzip2-compressed file support. */ + /* */ + /* FreeType now handles font files that have been compressed with the */ + /* `bzip2' program. This is mostly used to parse many of the PCF */ + /* files that come with XFree86. The implementation uses `libbz2' to */ + /* partially uncompress the file on the fly (see src/bzip2/ftbzip2.c). */ + /* Contrary to gzip, bzip2 currently is not included and need to use */ + /* the system available bzip2 implementation. */ + /* */ + /* Define this macro if you want to enable this `feature'. */ + /* */ +#define FT_CONFIG_OPTION_USE_BZIP2 + + + /*************************************************************************/ + /* */ + /* PNG bitmap support. */ + /* */ + /* FreeType now handles loading color bitmap glyphs in the PNG format. */ + /* This requires help from the external libpng library. Uncompressed */ + /* color bitmaps do not need any external libraries and will be */ + /* supported regardless of this configuration. */ + /* */ + /* Define this macro if you want to enable this `feature'. */ + /* */ +#define FT_CONFIG_OPTION_USE_PNG + + + /*************************************************************************/ + /* */ + /* Define to disable the use of file stream functions and types, FILE, */ + /* fopen() etc. Enables the use of smaller system libraries on embedded */ + /* systems that have multiple system libraries, some with or without */ + /* file stream support, in the cases where file stream support is not */ + /* necessary such as memory loading of font files. */ + /* */ +/* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */ + + + /*************************************************************************/ + /* */ + /* DLL export compilation */ + /* */ + /* When compiling FreeType as a DLL, some systems/compilers need a */ + /* special keyword in front OR after the return type of function */ + /* declarations. */ + /* */ + /* Two macros are used within the FreeType source code to define */ + /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ + /* */ + /* FT_EXPORT( return_type ) */ + /* */ + /* is used in a function declaration, as in */ + /* */ + /* FT_EXPORT( FT_Error ) */ + /* FT_Init_FreeType( FT_Library* alibrary ); */ + /* */ + /* */ + /* FT_EXPORT_DEF( return_type ) */ + /* */ + /* is used in a function definition, as in */ + /* */ + /* FT_EXPORT_DEF( FT_Error ) */ + /* FT_Init_FreeType( FT_Library* alibrary ) */ + /* { */ + /* ... some code ... */ + /* return FT_Err_Ok; */ + /* } */ + /* */ + /* You can provide your own implementation of FT_EXPORT and */ + /* FT_EXPORT_DEF here if you want. If you leave them undefined, they */ + /* will be later automatically defined as `extern return_type' to */ + /* allow normal compilation. */ + /* */ + /* Do not #undef these macros here since the build system might define */ + /* them for certain configurations only. */ + /* */ +/* #define FT_EXPORT(x) extern x */ +/* #define FT_EXPORT_DEF(x) x */ + + + /*************************************************************************/ + /* */ + /* Glyph Postscript Names handling */ + /* */ + /* By default, FreeType 2 is compiled with the `psnames' module. This */ + /* module is in charge of converting a glyph name string into a */ + /* Unicode value, or return a Macintosh standard glyph name for the */ + /* use with the TrueType `post' table. */ + /* */ + /* Undefine this macro if you do not want `psnames' compiled in your */ + /* build of FreeType. This has the following effects: */ + /* */ + /* - The TrueType driver will provide its own set of glyph names, */ + /* if you build it to support postscript names in the TrueType */ + /* `post' table. */ + /* */ + /* - The Type 1 driver will not be able to synthesize a Unicode */ + /* charmap out of the glyphs found in the fonts. */ + /* */ + /* You would normally undefine this configuration macro when building */ + /* a version of FreeType that doesn't contain a Type 1 or CFF driver. */ + /* */ +#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES + + + /*************************************************************************/ + /* */ + /* Postscript Names to Unicode Values support */ + /* */ + /* By default, FreeType 2 is built with the `PSNames' module compiled */ + /* in. Among other things, the module is used to convert a glyph name */ + /* into a Unicode value. This is especially useful in order to */ + /* synthesize on the fly a Unicode charmap from the CFF/Type 1 driver */ + /* through a big table named the `Adobe Glyph List' (AGL). */ + /* */ + /* Undefine this macro if you do not want the Adobe Glyph List */ + /* compiled in your `PSNames' module. The Type 1 driver will not be */ + /* able to synthesize a Unicode charmap out of the glyphs found in the */ + /* fonts. */ + /* */ +#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST + + + /*************************************************************************/ + /* */ + /* Support for Mac fonts */ + /* */ + /* Define this macro if you want support for outline fonts in Mac */ + /* format (mac dfont, mac resource, macbinary containing a mac */ + /* resource) on non-Mac platforms. */ + /* */ + /* Note that the `FOND' resource isn't checked. */ + /* */ +#define FT_CONFIG_OPTION_MAC_FONTS + + + /*************************************************************************/ + /* */ + /* Guessing methods to access embedded resource forks */ + /* */ + /* Enable extra Mac fonts support on non-Mac platforms (e.g. */ + /* GNU/Linux). */ + /* */ + /* Resource forks which include fonts data are stored sometimes in */ + /* locations which users or developers don't expected. In some cases, */ + /* resource forks start with some offset from the head of a file. In */ + /* other cases, the actual resource fork is stored in file different */ + /* from what the user specifies. If this option is activated, */ + /* FreeType tries to guess whether such offsets or different file */ + /* names must be used. */ + /* */ + /* Note that normal, direct access of resource forks is controlled via */ + /* the FT_CONFIG_OPTION_MAC_FONTS option. */ + /* */ +#ifdef FT_CONFIG_OPTION_MAC_FONTS +#define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK +#endif + + + /*************************************************************************/ + /* */ + /* Allow the use of FT_Incremental_Interface to load typefaces that */ + /* contain no glyph data, but supply it via a callback function. */ + /* This is required by clients supporting document formats which */ + /* supply font data incrementally as the document is parsed, such */ + /* as the Ghostscript interpreter for the PostScript language. */ + /* */ +#define FT_CONFIG_OPTION_INCREMENTAL + + + /*************************************************************************/ + /* */ + /* The size in bytes of the render pool used by the scan-line converter */ + /* to do all of its work. */ + /* */ + /* This must be greater than 4KByte if you use FreeType to rasterize */ + /* glyphs; otherwise, you may set it to zero to avoid unnecessary */ + /* allocation of the render pool. */ + /* */ +#define FT_RENDER_POOL_SIZE 16384L + + + /*************************************************************************/ + /* */ + /* FT_MAX_MODULES */ + /* */ + /* The maximum number of modules that can be registered in a single */ + /* FreeType library object. 32 is the default. */ + /* */ +#define FT_MAX_MODULES 32 + + + /*************************************************************************/ + /* */ + /* Debug level */ + /* */ + /* FreeType can be compiled in debug or trace mode. In debug mode, */ + /* errors are reported through the `ftdebug' component. In trace */ + /* mode, additional messages are sent to the standard output during */ + /* execution. */ + /* */ + /* Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode. */ + /* Define FT_DEBUG_LEVEL_TRACE to build it in trace mode. */ + /* */ + /* Don't define any of these macros to compile in `release' mode! */ + /* */ + /* Do not #undef these macros here since the build system might define */ + /* them for certain configurations only. */ + /* */ +#define FT_DEBUG_LEVEL_ERROR +#define FT_DEBUG_LEVEL_TRACE + + + /*************************************************************************/ + /* */ + /* Autofitter debugging */ + /* */ + /* If FT_DEBUG_AUTOFIT is defined, FreeType provides some means to */ + /* control the autofitter behaviour for debugging purposes with global */ + /* boolean variables (consequently, you should *never* enable this */ + /* while compiling in `release' mode): */ + /* */ + /* _af_debug_disable_horz_hints */ + /* _af_debug_disable_vert_hints */ + /* _af_debug_disable_blue_hints */ + /* */ + /* Additionally, the following functions provide dumps of various */ + /* internal autofit structures to stdout (using `printf'): */ + /* */ + /* af_glyph_hints_dump_points */ + /* af_glyph_hints_dump_segments */ + /* af_glyph_hints_dump_edges */ + /* */ + /* As an argument, they use another global variable: */ + /* */ + /* _af_debug_hints */ + /* */ + /* Please have a look at the `ftgrid' demo program to see how those */ + /* variables and macros should be used. */ + /* */ + /* Do not #undef these macros here since the build system might define */ + /* them for certain configurations only. */ + /* */ +#define FT_DEBUG_AUTOFIT + + + /*************************************************************************/ + /* */ + /* Memory Debugging */ + /* */ + /* FreeType now comes with an integrated memory debugger that is */ + /* capable of detecting simple errors like memory leaks or double */ + /* deletes. To compile it within your build of the library, you */ + /* should define FT_DEBUG_MEMORY here. */ + /* */ + /* Note that the memory debugger is only activated at runtime when */ + /* when the _environment_ variable `FT2_DEBUG_MEMORY' is defined also! */ + /* */ + /* Do not #undef this macro here since the build system might define */ + /* it for certain configurations only. */ + /* */ +#define FT_DEBUG_MEMORY + + + /*************************************************************************/ + /* */ + /* Module errors */ + /* */ + /* If this macro is set (which is _not_ the default), the higher byte */ + /* of an error code gives the module in which the error has occurred, */ + /* while the lower byte is the real error code. */ + /* */ + /* Setting this macro makes sense for debugging purposes only, since */ + /* it would break source compatibility of certain programs that use */ + /* FreeType 2. */ + /* */ + /* More details can be found in the files ftmoderr.h and fterrors.h. */ + /* */ +#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS + + + /*************************************************************************/ + /* */ + /* Position Independent Code */ + /* */ + /* If this macro is set (which is _not_ the default), FreeType2 will */ + /* avoid creating constants that require address fixups. Instead the */ + /* constants will be moved into a struct and additional intialization */ + /* code will be used. */ + /* */ + /* Setting this macro is needed for systems that prohibit address */ + /* fixups, such as BREW. */ + /* */ +/* #define FT_CONFIG_OPTION_PIC */ + + + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** S F N T D R I V E R C O N F I G U R A T I O N ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* Define TT_CONFIG_OPTION_EMBEDDED_BITMAPS if you want to support */ + /* embedded bitmaps in all formats using the SFNT module (namely */ + /* TrueType & OpenType). */ + /* */ +#define TT_CONFIG_OPTION_EMBEDDED_BITMAPS + + + /*************************************************************************/ + /* */ + /* Define TT_CONFIG_OPTION_POSTSCRIPT_NAMES if you want to be able to */ + /* load and enumerate the glyph Postscript names in a TrueType or */ + /* OpenType file. */ + /* */ + /* Note that when you do not compile the `PSNames' module by undefining */ + /* the above FT_CONFIG_OPTION_POSTSCRIPT_NAMES, the `sfnt' module will */ + /* contain additional code used to read the PS Names table from a font. */ + /* */ + /* (By default, the module uses `PSNames' to extract glyph names.) */ + /* */ +#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES + + + /*************************************************************************/ + /* */ + /* Define TT_CONFIG_OPTION_SFNT_NAMES if your applications need to */ + /* access the internal name table in a SFNT-based format like TrueType */ + /* or OpenType. The name table contains various strings used to */ + /* describe the font, like family name, copyright, version, etc. It */ + /* does not contain any glyph name though. */ + /* */ + /* Accessing SFNT names is done through the functions declared in */ + /* `ftsnames.h'. */ + /* */ +#define TT_CONFIG_OPTION_SFNT_NAMES + + + /*************************************************************************/ + /* */ + /* TrueType CMap support */ + /* */ + /* Here you can fine-tune which TrueType CMap table format shall be */ + /* supported. */ +#define TT_CONFIG_CMAP_FORMAT_0 +#define TT_CONFIG_CMAP_FORMAT_2 +#define TT_CONFIG_CMAP_FORMAT_4 +#define TT_CONFIG_CMAP_FORMAT_6 +#define TT_CONFIG_CMAP_FORMAT_8 +#define TT_CONFIG_CMAP_FORMAT_10 +#define TT_CONFIG_CMAP_FORMAT_12 +#define TT_CONFIG_CMAP_FORMAT_13 +#define TT_CONFIG_CMAP_FORMAT_14 + + + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** T R U E T Y P E D R I V E R C O N F I G U R A T I O N ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER if you want to compile */ + /* a bytecode interpreter in the TrueType driver. */ + /* */ + /* By undefining this, you will only compile the code necessary to load */ + /* TrueType glyphs without hinting. */ + /* */ + /* Do not #undef this macro here, since the build system might */ + /* define it for certain configurations only. */ + /* */ +#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER + + + /*************************************************************************/ + /* */ + /* Define TT_CONFIG_OPTION_SUBPIXEL_HINTING if you want to compile */ + /* EXPERIMENTAL subpixel hinting support into the TrueType driver. This */ + /* replaces the native TrueType hinting mechanism when anything but */ + /* FT_RENDER_MODE_MONO is requested. */ + /* */ + /* Enabling this causes the TrueType driver to ignore instructions under */ + /* certain conditions. This is done in accordance with the guide here, */ + /* with some minor differences: */ + /* */ + /* http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ + /* */ + /* By undefining this, you only compile the code necessary to hint */ + /* TrueType glyphs with native TT hinting. */ + /* */ + /* This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be */ + /* defined. */ + /* */ +#define TT_CONFIG_OPTION_SUBPIXEL_HINTING + + + /*************************************************************************/ + /* */ + /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version */ + /* of the TrueType bytecode interpreter is used that doesn't implement */ + /* any of the patented opcodes and algorithms. The patents related to */ + /* TrueType hinting have expired worldwide since May 2010; this option */ + /* is now deprecated. */ + /* */ + /* Note that the TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* */ + /* if you define TT_CONFIG_OPTION_BYTECODE_INTERPRETER; in other words, */ + /* either define TT_CONFIG_OPTION_BYTECODE_INTERPRETER or */ + /* TT_CONFIG_OPTION_UNPATENTED_HINTING but not both at the same time. */ + /* */ + /* This macro is only useful for a small number of font files (mostly */ + /* for Asian scripts) that require bytecode interpretation to properly */ + /* load glyphs. For all other fonts, this produces unpleasant results, */ + /* thus the unpatented interpreter is never used to load glyphs from */ + /* TrueType fonts unless one of the following two options is used. */ + /* */ + /* - The unpatented interpreter is explicitly activated by the user */ + /* through the FT_PARAM_TAG_UNPATENTED_HINTING parameter tag */ + /* when opening the FT_Face. */ + /* */ + /* - FreeType detects that the FT_Face corresponds to one of the */ + /* `trick' fonts (e.g., `Mingliu') it knows about. The font engine */ + /* contains a hard-coded list of font names and other matching */ + /* parameters (see function `tt_face_init' in file */ + /* `src/truetype/ttobjs.c'). */ + /* */ + /* Here a sample code snippet for using FT_PARAM_TAG_UNPATENTED_HINTING. */ + /* */ + /* { */ + /* FT_Parameter parameter; */ + /* FT_Open_Args open_args; */ + /* */ + /* */ + /* parameter.tag = FT_PARAM_TAG_UNPATENTED_HINTING; */ + /* */ + /* open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; */ + /* open_args.pathname = my_font_pathname; */ + /* open_args.num_params = 1; */ + /* open_args.params = ¶meter; */ + /* */ + /* error = FT_Open_Face( library, &open_args, index, &face ); */ + /* ... */ + /* } */ + /* */ +/* #define TT_CONFIG_OPTION_UNPATENTED_HINTING */ + + + /*************************************************************************/ + /* */ + /* Define TT_CONFIG_OPTION_INTERPRETER_SWITCH to compile the TrueType */ + /* bytecode interpreter with a huge switch statement, rather than a call */ + /* table. This results in smaller and faster code for a number of */ + /* architectures. */ + /* */ + /* Note however that on some compiler/processor combinations, undefining */ + /* this macro will generate faster, though larger, code. */ + /* */ +#define TT_CONFIG_OPTION_INTERPRETER_SWITCH + + + /*************************************************************************/ + /* */ + /* Define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED to compile the */ + /* TrueType glyph loader to use Apple's definition of how to handle */ + /* component offsets in composite glyphs. */ + /* */ + /* Apple and MS disagree on the default behavior of component offsets */ + /* in composites. Apple says that they should be scaled by the scaling */ + /* factors in the transformation matrix (roughly, it's more complex) */ + /* while MS says they should not. OpenType defines two bits in the */ + /* composite flags array which can be used to disambiguate, but old */ + /* fonts will not have them. */ + /* */ + /* http://www.microsoft.com/typography/otspec/glyf.htm */ + /* http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html */ + /* */ +#undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED + + + /*************************************************************************/ + /* */ + /* Define TT_CONFIG_OPTION_GX_VAR_SUPPORT if you want to include */ + /* support for Apple's distortable font technology (fvar, gvar, cvar, */ + /* and avar tables). This has many similarities to Type 1 Multiple */ + /* Masters support. */ + /* */ +#define TT_CONFIG_OPTION_GX_VAR_SUPPORT + + + /*************************************************************************/ + /* */ + /* Define TT_CONFIG_OPTION_BDF if you want to include support for */ + /* an embedded `BDF ' table within SFNT-based bitmap formats. */ + /* */ +#define TT_CONFIG_OPTION_BDF + + + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* T1_MAX_DICT_DEPTH is the maximum depth of nest dictionaries and */ + /* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */ + /* required. */ + /* */ +#define T1_MAX_DICT_DEPTH 5 + + + /*************************************************************************/ + /* */ + /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */ + /* calls during glyph loading. */ + /* */ +#define T1_MAX_SUBRS_CALLS 16 + + + /*************************************************************************/ + /* */ + /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */ + /* minimum of 16 is required. */ + /* */ + /* The Chinese font MingTiEG-Medium (CNS 11643 character set) needs 256. */ + /* */ +#define T1_MAX_CHARSTRINGS_OPERANDS 256 + + + /*************************************************************************/ + /* */ + /* Define this configuration macro if you want to prevent the */ + /* compilation of `t1afm', which is in charge of reading Type 1 AFM */ + /* files into an existing face. Note that if set, the T1 driver will be */ + /* unable to produce kerning distances. */ + /* */ +#undef T1_CONFIG_OPTION_NO_AFM + + + /*************************************************************************/ + /* */ + /* Define this configuration macro if you want to prevent the */ + /* compilation of the Multiple Masters font support in the Type 1 */ + /* driver. */ + /* */ +#undef T1_CONFIG_OPTION_NO_MM_SUPPORT + + + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** C F F D R I V E R C O N F I G U R A T I O N ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* CFF_CONFIG_OPTION_OLD_ENGINE controls whether the pre-Adobe CFF */ + /* engine gets compiled into FreeType. If defined, it is possible to */ + /* switch between the two engines using the `hinting-engine' property of */ + /* the cff driver module. */ + /* */ +#define CFF_CONFIG_OPTION_OLD_ENGINE + + + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* Compile autofit module with CJK (Chinese, Japanese, Korean) script */ + /* support. */ + /* */ +#define AF_CONFIG_OPTION_CJK + + /*************************************************************************/ + /* */ + /* Compile autofit module with Indic script support. */ + /* */ +#define AF_CONFIG_OPTION_INDIC + + /*************************************************************************/ + /* */ + /* Compile autofit module with warp hinting. The idea of the warping */ + /* code is to slightly scale and shift a glyph within a single dimension */ + /* so that as much of its segments are aligned (more or less) on the */ + /* grid. To find out the optimal scaling and shifting value, various */ + /* parameter combinations are tried and scored. */ + /* */ + /* This experimental option is only active if the render mode is */ + /* FT_RENDER_MODE_LIGHT. */ + /* */ +#define AF_CONFIG_OPTION_USE_WARPER + + /* */ + + + /* + * This macro is obsolete. Support has been removed in FreeType + * version 2.5. + */ +/* #define FT_CONFIG_OPTION_OLD_INTERNALS */ + + + /* + * This macro is defined if either unpatented or native TrueType + * hinting is requested by the definitions above. + */ +#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER +#define TT_USE_BYTECODE_INTERPRETER +#undef TT_CONFIG_OPTION_UNPATENTED_HINTING +#elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING +#define TT_USE_BYTECODE_INTERPRETER +#endif + +FT_END_HEADER + + +#endif /* __FTOPTION_H__ */ + + +/* END */ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/config/ftconfig.h b/reactos/lib/3rdparty/freetype/include/config/ftconfig.h similarity index 89% rename from reactos/lib/3rdparty/freetype/include/freetype/config/ftconfig.h rename to reactos/lib/3rdparty/freetype/include/config/ftconfig.h index 5dce30ef3ed..0770e787883 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/config/ftconfig.h +++ b/reactos/lib/3rdparty/freetype/include/config/ftconfig.h @@ -27,11 +27,11 @@ /* Note however that if some specific modifications are needed, we */ /* advise you to place a modified copy in your build directory. */ /* */ - /* The build directory is usually `freetype/builds/', and */ - /* contains system-specific files that are always included first when */ - /* building the library. */ + /* The build directory is usually `builds/', and contains */ + /* system-specific files that are always included first when building */ + /* the library. */ /* */ - /* This ANSI version should stay in `include/freetype/config'. */ + /* This ANSI version should stay in `include/config/'. */ /* */ /*************************************************************************/ @@ -53,7 +53,7 @@ FT_BEGIN_HEADER /* These macros can be toggled to suit a specific system. The current */ /* ones are defaults used to compile FreeType in an ANSI C environment */ /* (16bit compilers are also supported). Copy this file to your own */ - /* `freetype/builds/' directory, and edit it to port the engine. */ + /* `builds/' directory, and edit it to port the engine. */ /* */ /*************************************************************************/ @@ -338,6 +338,7 @@ FT_BEGIN_HEADER /* These must be defined `static __inline__' with GCC. */ #if defined( __CC_ARM ) || defined( __ARMCC__ ) /* RVCT */ + #define FT_MULFIX_ASSEMBLER FT_MulFix_arm /* documentation is in freetype.h */ @@ -367,8 +368,10 @@ FT_BEGIN_HEADER #ifdef __GNUC__ -#if defined( __arm__ ) && !defined( __thumb__ ) && \ +#if defined( __arm__ ) && \ + ( !defined( __thumb__ ) || defined( __thumb2__ ) ) && \ !( defined( __CC_ARM ) || defined( __ARMCC__ ) ) + #define FT_MULFIX_ASSEMBLER FT_MulFix_arm /* documentation is in freetype.h */ @@ -383,7 +386,11 @@ FT_BEGIN_HEADER __asm__ __volatile__ ( "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */ "mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */ +#ifdef __clang__ + "add.w %0, %0, #0x8000\n\t" /* %0 += 0x8000 */ +#else "add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */ +#endif "adds %1, %1, %0\n\t" /* %1 += %0 */ "adc %2, %2, #0\n\t" /* %2 += carry */ "mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */ @@ -394,9 +401,13 @@ FT_BEGIN_HEADER return a; } -#endif /* __arm__ && !__thumb__ && !( __CC_ARM || __ARMCC__ ) */ +#endif /* __arm__ && */ + /* ( __thumb2__ || !__thumb__ ) && */ + /* !( __CC_ARM || __ARMCC__ ) */ + #if defined( __i386__ ) + #define FT_MULFIX_ASSEMBLER FT_MulFix_i386 /* documentation is in freetype.h */ @@ -465,6 +476,66 @@ FT_BEGIN_HEADER #endif /* _MSC_VER */ + +#if defined( __GNUC__ ) && defined( __x86_64__ ) + +#define FT_MULFIX_ASSEMBLER FT_MulFix_x86_64 + + static __inline__ FT_Int32 + FT_MulFix_x86_64( FT_Int32 a, + FT_Int32 b ) + { + /* Temporarily disable the warning that C90 doesn't support */ + /* `long long'. */ +#if ( __GNUC__ > 4 ) || ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ >= 6 ) ) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" +#endif + +#if 1 + /* Technically not an assembly fragment, but GCC does a really good */ + /* job at inlining it and generating good machine code for it. */ + long long ret, tmp; + + + ret = (long long)a * b; + tmp = ret >> 63; + ret += 0x8000 + tmp; + + return (FT_Int32)( ret >> 16 ); +#else + + /* For some reason, GCC 4.6 on Ubuntu 12.04 generates invalid machine */ + /* code from the lines below. The main issue is that `wide_a' is not */ + /* properly initialized by sign-extending `a'. Instead, the generated */ + /* machine code assumes that the register that contains `a' on input */ + /* can be used directly as a 64-bit value, which is wrong most of the */ + /* time. */ + long long wide_a = (long long)a; + long long wide_b = (long long)b; + long long result; + + + __asm__ __volatile__ ( + "imul %2, %1\n" + "mov %1, %0\n" + "sar $63, %0\n" + "lea 0x8000(%1, %0), %0\n" + "sar $16, %0\n" + : "=&r"(result), "=&r"(wide_a) + : "r"(wide_b) + : "cc" ); + + return (FT_Int32)result; +#endif + +#if ( __GNUC__ > 4 ) || ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ >= 6 ) ) +#pragma GCC diagnostic pop +#endif + } + +#endif /* __GNUC__ && __x86_64__ */ + #endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */ @@ -492,6 +563,9 @@ FT_BEGIN_HEADER #endif /* FT_MAKE_OPTION_SINGLE_OBJECT */ +#define FT_LOCAL_ARRAY( x ) extern const x +#define FT_LOCAL_ARRAY_DEF( x ) const x + #ifndef FT_BASE diff --git a/reactos/lib/3rdparty/freetype/include/freetype/config/ftheader.h b/reactos/lib/3rdparty/freetype/include/config/ftheader.h similarity index 89% rename from reactos/lib/3rdparty/freetype/include/freetype/config/ftheader.h rename to reactos/lib/3rdparty/freetype/include/config/ftheader.h index 8371a31611b..b6236299210 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/config/ftheader.h +++ b/reactos/lib/3rdparty/freetype/include/config/ftheader.h @@ -107,7 +107,7 @@ * */ #ifndef FT_CONFIG_CONFIG_H -#define FT_CONFIG_CONFIG_H +#define FT_CONFIG_CONFIG_H #endif @@ -122,7 +122,7 @@ * */ #ifndef FT_CONFIG_STANDARD_LIBRARY_H -#define FT_CONFIG_STANDARD_LIBRARY_H +#define FT_CONFIG_STANDARD_LIBRARY_H #endif @@ -137,7 +137,7 @@ * */ #ifndef FT_CONFIG_OPTIONS_H -#define FT_CONFIG_OPTIONS_H +#define FT_CONFIG_OPTIONS_H #endif @@ -153,7 +153,7 @@ * */ #ifndef FT_CONFIG_MODULES_H -#define FT_CONFIG_MODULES_H +#define FT_CONFIG_MODULES_H #endif /* */ @@ -170,7 +170,7 @@ * base FreeType~2 API. * */ -#define FT_FREETYPE_H +#define FT_FREETYPE_H /************************************************************************* @@ -185,7 +185,7 @@ * It is included by @FT_FREETYPE_H. * */ -#define FT_ERRORS_H +#define FT_ERRORS_H /************************************************************************* @@ -198,7 +198,7 @@ * list of FreeType~2 module error offsets (and messages). * */ -#define FT_MODULE_ERRORS_H +#define FT_MODULE_ERRORS_H /************************************************************************* @@ -214,7 +214,7 @@ * It is included by @FT_FREETYPE_H. * */ -#define FT_SYSTEM_H +#define FT_SYSTEM_H /************************************************************************* @@ -230,7 +230,7 @@ * It is included by @FT_FREETYPE_H. * */ -#define FT_IMAGE_H +#define FT_IMAGE_H /************************************************************************* @@ -245,7 +245,7 @@ * It is included by @FT_FREETYPE_H. * */ -#define FT_TYPES_H +#define FT_TYPES_H /************************************************************************* @@ -260,7 +260,7 @@ * (Most applications will never need to include this file.) * */ -#define FT_LIST_H +#define FT_LIST_H /************************************************************************* @@ -273,7 +273,7 @@ * scalable outline management API of FreeType~2. * */ -#define FT_OUTLINE_H +#define FT_OUTLINE_H /************************************************************************* @@ -286,7 +286,7 @@ * API which manages multiple @FT_Size objects per face. * */ -#define FT_SIZES_H +#define FT_SIZES_H /************************************************************************* @@ -299,7 +299,7 @@ * module management API of FreeType~2. * */ -#define FT_MODULE_H +#define FT_MODULE_H /************************************************************************* @@ -312,7 +312,7 @@ * renderer module management API of FreeType~2. * */ -#define FT_RENDER_H +#define FT_RENDER_H /************************************************************************* @@ -325,7 +325,7 @@ * structures and macros related to the auto-hinting module. * */ -#define FT_AUTOHINTER_H +#define FT_AUTOHINTER_H /************************************************************************* @@ -338,7 +338,7 @@ * structures and macros related to the CFF driver module. * */ -#define FT_CFF_DRIVER_H +#define FT_CFF_DRIVER_H /************************************************************************* @@ -351,7 +351,7 @@ * structures and macros related to the TrueType driver module. * */ -#define FT_TRUETYPE_DRIVER_H +#define FT_TRUETYPE_DRIVER_H /************************************************************************* @@ -364,7 +364,7 @@ * types and API specific to the Type~1 format. * */ -#define FT_TYPE1_TABLES_H +#define FT_TYPE1_TABLES_H /************************************************************************* @@ -379,7 +379,7 @@ * definitions, taken from the TrueType and OpenType specifications. * */ -#define FT_TRUETYPE_IDS_H +#define FT_TRUETYPE_IDS_H /************************************************************************* @@ -392,7 +392,7 @@ * types and API specific to the TrueType (as well as OpenType) format. * */ -#define FT_TRUETYPE_TABLES_H +#define FT_TRUETYPE_TABLES_H /************************************************************************* @@ -406,7 +406,7 @@ * SFNT-based font formats (i.e., TrueType and OpenType). * */ -#define FT_TRUETYPE_TAGS_H +#define FT_TRUETYPE_TAGS_H /************************************************************************* @@ -420,7 +420,7 @@ * face. * */ -#define FT_BDF_H +#define FT_BDF_H /************************************************************************* @@ -434,7 +434,7 @@ * face. * */ -#define FT_CID_H +#define FT_CID_H /************************************************************************* @@ -447,7 +447,7 @@ * definitions of an API which supports gzip-compressed files. * */ -#define FT_GZIP_H +#define FT_GZIP_H /************************************************************************* @@ -460,7 +460,7 @@ * definitions of an API which supports LZW-compressed files. * */ -#define FT_LZW_H +#define FT_LZW_H /************************************************************************* @@ -473,7 +473,7 @@ * definitions of an API which supports bzip2-compressed files. * */ -#define FT_BZIP2_H +#define FT_BZIP2_H /************************************************************************* @@ -486,7 +486,7 @@ * definitions of an API which supports Windows FNT files. * */ -#define FT_WINFONTS_H +#define FT_WINFONTS_H /************************************************************************* @@ -499,7 +499,7 @@ * API of the optional glyph management component. * */ -#define FT_GLYPH_H +#define FT_GLYPH_H /************************************************************************* @@ -512,7 +512,7 @@ * API of the optional bitmap conversion component. * */ -#define FT_BITMAP_H +#define FT_BITMAP_H /************************************************************************* @@ -525,7 +525,7 @@ * API of the optional exact bounding box computation routines. * */ -#define FT_BBOX_H +#define FT_BBOX_H /************************************************************************* @@ -538,7 +538,7 @@ * API of the optional FreeType~2 cache sub-system. * */ -#define FT_CACHE_H +#define FT_CACHE_H /************************************************************************* @@ -612,7 +612,7 @@ * compiled on the Mac (note that the base API still works though). * */ -#define FT_MAC_H +#define FT_MAC_H /************************************************************************* @@ -625,7 +625,7 @@ * optional multiple-masters management API of FreeType~2. * */ -#define FT_MULTIPLE_MASTERS_H +#define FT_MULTIPLE_MASTERS_H /************************************************************************* @@ -639,7 +639,7 @@ * SFNT-based font formats (i.e., TrueType and OpenType). * */ -#define FT_SFNT_NAMES_H +#define FT_SFNT_NAMES_H /************************************************************************* @@ -653,7 +653,7 @@ * GPOS, GSUB, JSTF). * */ -#define FT_OPENTYPE_VALIDATE_H +#define FT_OPENTYPE_VALIDATE_H /************************************************************************* @@ -667,7 +667,7 @@ * mort, morx, bsln, just, kern, opbd, trak, prop). * */ -#define FT_GX_VALIDATE_H +#define FT_GX_VALIDATE_H /************************************************************************* @@ -680,7 +680,7 @@ * FreeType~2 API which accesses PFR-specific data. * */ -#define FT_PFR_H +#define FT_PFR_H /************************************************************************* @@ -692,7 +692,7 @@ * A macro used in #include statements to name the file containing the * FreeType~2 API which provides functions to stroke outline paths. */ -#define FT_STROKER_H +#define FT_STROKER_H /************************************************************************* @@ -704,7 +704,7 @@ * A macro used in #include statements to name the file containing the * FreeType~2 API which performs artificial obliquing and emboldening. */ -#define FT_SYNTHESIS_H +#define FT_SYNTHESIS_H /************************************************************************* @@ -717,7 +717,7 @@ * FreeType~2 API which provides functions specific to the XFree86 and * X.Org X11 servers. */ -#define FT_XFREE86_H +#define FT_XFREE86_H /************************************************************************* @@ -730,7 +730,7 @@ * FreeType~2 API which performs trigonometric computations (e.g., * cosines and arc tangents). */ -#define FT_TRIGONOMETRY_H +#define FT_TRIGONOMETRY_H /************************************************************************* @@ -742,7 +742,7 @@ * A macro used in #include statements to name the file containing the * FreeType~2 API which performs color filtering for subpixel rendering. */ -#define FT_LCD_FILTER_H +#define FT_LCD_FILTER_H /************************************************************************* @@ -754,7 +754,7 @@ * A macro used in #include statements to name the file containing the * FreeType~2 API which performs color filtering for subpixel rendering. */ -#define FT_UNPATENTED_HINTING_H +#define FT_UNPATENTED_HINTING_H /************************************************************************* @@ -766,7 +766,7 @@ * A macro used in #include statements to name the file containing the * FreeType~2 API which performs color filtering for subpixel rendering. */ -#define FT_INCREMENTAL_H +#define FT_INCREMENTAL_H /************************************************************************* @@ -778,7 +778,7 @@ * A macro used in #include statements to name the file containing the * FreeType~2 API which returns entries from the TrueType GASP table. */ -#define FT_GASP_H +#define FT_GASP_H /************************************************************************* @@ -790,38 +790,38 @@ * A macro used in #include statements to name the file containing the * FreeType~2 API which returns individual and ranged glyph advances. */ -#define FT_ADVANCES_H +#define FT_ADVANCES_H /* */ -#define FT_ERROR_DEFINITIONS_H +#define FT_ERROR_DEFINITIONS_H /* The internals of the cache sub-system are no longer exposed. We */ /* default to FT_CACHE_H at the moment just in case, but we know of */ /* no rogue client that uses them. */ /* */ -#define FT_CACHE_MANAGER_H -#define FT_CACHE_INTERNAL_MRU_H -#define FT_CACHE_INTERNAL_MANAGER_H -#define FT_CACHE_INTERNAL_CACHE_H -#define FT_CACHE_INTERNAL_GLYPH_H -#define FT_CACHE_INTERNAL_IMAGE_H -#define FT_CACHE_INTERNAL_SBITS_H +#define FT_CACHE_MANAGER_H +#define FT_CACHE_INTERNAL_MRU_H +#define FT_CACHE_INTERNAL_MANAGER_H +#define FT_CACHE_INTERNAL_CACHE_H +#define FT_CACHE_INTERNAL_GLYPH_H +#define FT_CACHE_INTERNAL_IMAGE_H +#define FT_CACHE_INTERNAL_SBITS_H -#define FT_INCREMENTAL_H +#define FT_INCREMENTAL_H -#define FT_TRUETYPE_UNPATENTED_H +#define FT_TRUETYPE_UNPATENTED_H /* - * Include internal headers definitions from + * Include internal headers definitions from * only when building the library. */ #ifdef FT2_BUILD_LIBRARY -#define FT_INTERNAL_INTERNAL_H +#define FT_INTERNAL_INTERNAL_H #include FT_INTERNAL_INTERNAL_H #endif /* FT2_BUILD_LIBRARY */ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/config/ftmodule.h b/reactos/lib/3rdparty/freetype/include/config/ftmodule.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/config/ftmodule.h rename to reactos/lib/3rdparty/freetype/include/config/ftmodule.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/config/ftoption.h b/reactos/lib/3rdparty/freetype/include/config/ftoption.h similarity index 99% rename from reactos/lib/3rdparty/freetype/include/freetype/config/ftoption.h rename to reactos/lib/3rdparty/freetype/include/config/ftoption.h index 90057c3a7f0..fe2ba15b48c 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/config/ftoption.h +++ b/reactos/lib/3rdparty/freetype/include/config/ftoption.h @@ -38,9 +38,9 @@ FT_BEGIN_HEADER /* library from a single source directory. */ /* */ /* - You can put a copy of this file in your build directory, more */ - /* precisely in `$BUILD/freetype/config/ftoption.h', where `$BUILD' */ - /* is the name of a directory that is included _before_ the FreeType */ - /* include path during compilation. */ + /* precisely in `$BUILD/config/ftoption.h', where `$BUILD' is the */ + /* name of a directory that is included _before_ the FreeType include */ + /* path during compilation. */ /* */ /* The default FreeType Makefiles and Jamfiles use the build */ /* directory `builds/' by default, but you can easily change */ @@ -51,7 +51,7 @@ FT_BEGIN_HEADER /* locate this file during the build. For example, */ /* */ /* #define FT_CONFIG_OPTIONS_H */ - /* #include */ + /* #include */ /* */ /* will use `$BUILD/myftoptions.h' instead of this file for macro */ /* definitions. */ @@ -59,7 +59,7 @@ FT_BEGIN_HEADER /* Note also that you can similarly pre-define the macro */ /* FT_CONFIG_MODULES_H used to locate the file listing of the modules */ /* that are statically linked to the library at compile time. By */ - /* default, this file is . */ + /* default, this file is . */ /* */ /* We highly recommend using the third method whenever possible. */ /* */ @@ -323,7 +323,7 @@ FT_BEGIN_HEADER /* */ /* Note that the `FOND' resource isn't checked. */ /* */ -/*#define FT_CONFIG_OPTION_MAC_FONTS */ +#define FT_CONFIG_OPTION_MAC_FONTS /*************************************************************************/ @@ -528,7 +528,7 @@ FT_BEGIN_HEADER /* does not contain any glyph name though. */ /* */ /* Accessing SFNT names is done through the functions declared in */ - /* `freetype/ftsnames.h'. */ + /* `ftsnames.h'. */ /* */ #define TT_CONFIG_OPTION_SFNT_NAMES diff --git a/reactos/lib/3rdparty/freetype/include/freetype/config/ftstdlib.h b/reactos/lib/3rdparty/freetype/include/config/ftstdlib.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/config/ftstdlib.h rename to reactos/lib/3rdparty/freetype/include/config/ftstdlib.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/freetype.h b/reactos/lib/3rdparty/freetype/include/freetype.h similarity index 98% rename from reactos/lib/3rdparty/freetype/include/freetype/freetype.h rename to reactos/lib/3rdparty/freetype/include/freetype.h index fe46d229787..39a18af89e9 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/freetype.h +++ b/reactos/lib/3rdparty/freetype/include/freetype.h @@ -98,7 +98,10 @@ FT_BEGIN_HEADER /* FT_FACE_FLAG_FIXED_WIDTH */ /* FT_FACE_FLAG_HORIZONTAL */ /* FT_FACE_FLAG_VERTICAL */ + /* FT_FACE_FLAG_COLOR */ /* FT_FACE_FLAG_SFNT */ + /* FT_FACE_FLAG_CID_KEYED */ + /* FT_FACE_FLAG_TRICKY */ /* FT_FACE_FLAG_KERNING */ /* FT_FACE_FLAG_MULTIPLE_MASTERS */ /* FT_FACE_FLAG_GLYPH_NAMES */ @@ -417,7 +420,8 @@ FT_BEGIN_HEADER /* */ /* Each @FT_Face has an _active_ @FT_Size object that is used by */ /* functions like @FT_Load_Glyph to determine the scaling */ - /* transformation which is used to load and hint glyphs and metrics. */ + /* transformation that in turn is used to load and hint glyphs and */ + /* metrics. */ /* */ /* You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, */ /* @FT_Request_Size or even @FT_Select_Size to change the content */ @@ -552,11 +556,12 @@ FT_BEGIN_HEADER /* FT_ENCODING_MS_SYMBOL :: */ /* Corresponds to the Microsoft Symbol encoding, used to encode */ /* mathematical symbols in the 32..255 character code range. For */ - /* more information, see `http://www.ceviz.net/symbol.htm'. */ + /* more information, see */ + /* `http://www.kostis.net/charsets/symbol.htm'. */ /* */ /* FT_ENCODING_SJIS :: */ /* Corresponds to Japanese SJIS encoding. More info at */ - /* at `http://langsupport.japanreference.com/encoding.shtml'. */ + /* at `http://en.wikipedia.org/wiki/Shift_JIS'. */ /* See note on multi-byte encodings below. */ /* */ /* FT_ENCODING_GB2312 :: */ @@ -570,7 +575,7 @@ FT_BEGIN_HEADER /* FT_ENCODING_WANSUNG :: */ /* Corresponds to the Korean encoding system known as Wansung. */ /* For more information see */ - /* `http://www.microsoft.com/typography/unicode/949.txt'. */ + /* `http://msdn.microsoft.com/en-US/goglobal/cc305154'. */ /* */ /* FT_ENCODING_JOHAB :: */ /* The Korean standard character set (KS~C 5601-1992), which */ @@ -645,10 +650,10 @@ FT_BEGIN_HEADER /* FT_ENCODING_APPLE_ROMAN). */ /* */ /* If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function */ - /* @FT_Get_CMap_Language_ID to query the Mac language ID which may */ + /* @FT_Get_CMap_Language_ID to query the Mac language ID that may */ /* be needed to be able to distinguish Apple encoding variants. See */ /* */ - /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/README.TXT */ + /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt */ /* */ /* to get an idea how to do that. Basically, if the language ID */ /* is~0, don't use it, otherwise subtract 1 from the language ID. */ @@ -808,7 +813,7 @@ FT_BEGIN_HEADER /* highest CID used in the font. */ /* */ /* family_name :: The face's family name. This is an ASCII */ - /* string, usually in English, which describes */ + /* string, usually in English, that describes */ /* the typeface's family (like `Times New */ /* Roman', `Bodoni', `Garamond', etc). This */ /* is a least common denominator used to list */ @@ -820,7 +825,7 @@ FT_BEGIN_HEADER /* PDF file). */ /* */ /* style_name :: The face's style name. This is an ASCII */ - /* string, usually in English, which describes */ + /* string, usually in English, that describes */ /* the typeface's style (like `Italic', */ /* `Bold', `Condensed', etc). Not all font */ /* formats provide a style name, so this field */ @@ -1054,7 +1059,7 @@ FT_BEGIN_HEADER /* exist make FT_Load_Glyph return successfully; in all other cases */ /* you get an `FT_Err_Invalid_Argument' error. */ /* */ - /* Note that CID-keyed fonts which are in an SFNT wrapper don't */ + /* Note that CID-keyed fonts that are in an SFNT wrapper don't */ /* have this flag set since the glyphs are accessed in the normal */ /* way (using contiguous indices); the `CID-ness' isn't visible to */ /* the application. */ @@ -1062,7 +1067,7 @@ FT_BEGIN_HEADER /* FT_FACE_FLAG_TRICKY :: */ /* Set if the font is `tricky', this is, it always needs the */ /* font format's native hinting engine to get a reasonable result. */ - /* A typical example is the Chinese font `mingli.ttf' which uses */ + /* A typical example is the Chinese font `mingli.ttf' that uses */ /* TrueType bytecode instructions to move and scale all of its */ /* subglyphs. */ /* */ @@ -1075,6 +1080,10 @@ FT_BEGIN_HEADER /* Currently, there are about a dozen TrueType fonts in the list of */ /* tricky fonts; they are hard-coded in file `ttobjs.c'. */ /* */ + /* FT_FACE_FLAG_COLOR :: */ + /* Set if the font has color glyph tables. To access color glyphs */ + /* use @FT_LOAD_COLOR. */ + /* */ #define FT_FACE_FLAG_SCALABLE ( 1L << 0 ) #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 ) #define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 ) @@ -1089,6 +1098,7 @@ FT_BEGIN_HEADER #define FT_FACE_FLAG_HINTER ( 1L << 11 ) #define FT_FACE_FLAG_CID_KEYED ( 1L << 12 ) #define FT_FACE_FLAG_TRICKY ( 1L << 13 ) +#define FT_FACE_FLAG_COLOR ( 1L << 14 ) /************************************************************************* @@ -1273,6 +1283,20 @@ FT_BEGIN_HEADER ( face->face_flags & FT_FACE_FLAG_TRICKY ) + /************************************************************************* + * + * @macro: + * FT_HAS_COLOR( face ) + * + * @description: + * A macro that returns true whenever a face object contains + * tables for color glyphs. + * + */ +#define FT_HAS_COLOR( face ) \ + ( face->face_flags & FT_FACE_FLAG_COLOR ) + + /*************************************************************************/ /* */ /* */ @@ -1394,9 +1418,9 @@ FT_BEGIN_HEADER /* */ /* face :: Handle to the parent face object. */ /* */ - /* generic :: A typeless pointer, which is unused by the FreeType */ - /* library or any of its drivers. It can be used by */ - /* client applications to link their own data to each size */ + /* generic :: A typeless pointer, unused by the FreeType library or */ + /* any of its drivers. It can be used by client */ + /* applications to link their own data to each size */ /* object. */ /* */ /* metrics :: Metrics for this size object. This field is read-only. */ @@ -1464,10 +1488,10 @@ FT_BEGIN_HEADER /* listed through a direct, single-linked list */ /* using its `next' field. */ /* */ - /* generic :: A typeless pointer which is unused by the */ - /* FreeType library or any of its drivers. It */ - /* can be used by client applications to link */ - /* their own data to each glyph slot object. */ + /* generic :: A typeless pointer unused by the FreeType */ + /* library or any of its drivers. It can be */ + /* used by client applications to link their own */ + /* data to each glyph slot object. */ /* */ /* metrics :: The metrics of the last loaded glyph in the */ /* slot. The returned values depend on the last */ @@ -1494,8 +1518,8 @@ FT_BEGIN_HEADER /* */ /* advance :: This shorthand is, depending on */ /* @FT_LOAD_IGNORE_TRANSFORM, the transformed */ - /* advance width for the glyph (in 26.6 */ - /* fractional pixel format). As specified with */ + /* (hinted) advance width for the glyph, in 26.6 */ + /* fractional pixel format. As specified with */ /* @FT_LOAD_VERTICAL_LAYOUT, it uses either the */ /* `horiAdvance' or the `vertAdvance' value of */ /* `metrics' field. */ @@ -1584,7 +1608,7 @@ FT_BEGIN_HEADER /* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */ /* */ /* */ - /* Here a small pseudo code fragment which shows how to use */ + /* Here a small pseudo code fragment that shows how to use */ /* `lsb_delta' and `rsb_delta': */ /* */ /* { */ @@ -1813,7 +1837,7 @@ FT_BEGIN_HEADER /* opening a new face. */ /* */ /* */ - /* The stream type is determined by the contents of `flags' which */ + /* The stream type is determined by the contents of `flags' that */ /* are tested in the following order by @FT_Open_Face: */ /* */ /* If the `FT_OPEN_MEMORY' bit is set, assume that this is a */ @@ -1894,7 +1918,7 @@ FT_BEGIN_HEADER /* FT_New_Memory_Face */ /* */ /* */ - /* This function calls @FT_Open_Face to open a font which has been */ + /* This function calls @FT_Open_Face to open a font that has been */ /* loaded into memory. */ /* */ /* */ @@ -1940,7 +1964,7 @@ FT_BEGIN_HEADER /* library :: A handle to the library resource. */ /* */ /* */ - /* args :: A pointer to an `FT_Open_Args' structure which must */ + /* args :: A pointer to an `FT_Open_Args' structure that must */ /* be filled by the caller. */ /* */ /* face_index :: The index of the face within the font. The first */ @@ -1956,7 +1980,7 @@ FT_BEGIN_HEADER /* */ /* */ /* Unlike FreeType 1.x, this function automatically creates a glyph */ - /* slot for the face object which can be accessed directly through */ + /* slot for the face object that can be accessed directly through */ /* `face->glyph'. */ /* */ /* FT_Open_Face can be used to quickly check whether the font */ @@ -1965,7 +1989,7 @@ FT_BEGIN_HEADER /* if the font format is recognized, or non-zero otherwise; */ /* the function returns a more or less empty face handle in `*aface' */ /* (if `aface' isn't NULL). The only useful field in this special */ - /* case is `face->num_faces' which gives the number of faces within */ + /* case is `face->num_faces' that gives the number of faces within */ /* the font file. After examination, the returned @FT_Face structure */ /* should be deallocated with a call to @FT_Done_Face. */ /* */ @@ -2023,7 +2047,7 @@ FT_BEGIN_HEADER /* face :: The target face object. */ /* */ /* */ - /* parameters :: A pointer to @FT_Open_Args which must be filled by */ + /* parameters :: A pointer to @FT_Open_Args that must be filled by */ /* the caller. */ /* */ /* */ @@ -2054,7 +2078,7 @@ FT_BEGIN_HEADER /* then only destroys a face if the counter is~1, otherwise it simply */ /* decrements the counter. */ /* */ - /* This function helps in managing life-cycles of structures which */ + /* This function helps in managing life-cycles of structures that */ /* reference @FT_Face objects. */ /* */ /* */ @@ -2361,7 +2385,7 @@ FT_BEGIN_HEADER /* the details. */ /* */ /* For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is */ - /* returned for invalid CID values (this is, for CID values which */ + /* returned for invalid CID values (this is, for CID values that */ /* don't have a corresponding glyph in the font). See the discussion */ /* of the @FT_FACE_FLAG_CID_KEYED flag for more details. */ /* */ @@ -2635,7 +2659,7 @@ FT_BEGIN_HEADER * `load_flags'. They can't be ORed. * * If @FT_LOAD_RENDER is also set, the glyph is rendered in the - * corresponding mode (i.e., the mode which matches the used algorithm + * corresponding mode (i.e., the mode that matches the used algorithm * best). An exeption is FT_LOAD_TARGET_MONO since it implies * @FT_LOAD_MONOCHROME. * @@ -3003,7 +3027,7 @@ FT_BEGIN_HEADER /* */ /* This function is not compiled within the library if the config */ /* macro `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is defined in */ - /* `include/freetype/config/ftoptions.h'. */ + /* `ftoptions.h'. */ /* */ FT_EXPORT( FT_Error ) FT_Get_Glyph_Name( FT_Face face, @@ -3059,8 +3083,8 @@ FT_BEGIN_HEADER /* */ /* Because many fonts contain more than a single cmap for Unicode */ /* encoding, this function has some special code to select the one */ - /* which covers Unicode best (`best' in the sense that a UCS-4 cmap */ - /* is preferred to a UCS-2 cmap). It is thus preferable to */ + /* that covers Unicode best (`best' in the sense that a UCS-4 cmap is */ + /* preferred to a UCS-2 cmap). It is thus preferable to */ /* @FT_Set_Charmap in this case. */ /* */ FT_EXPORT( FT_Error ) @@ -3414,7 +3438,7 @@ FT_BEGIN_HEADER /* */ /* */ /* Use this function rather than directly reading the `fs_type' field */ - /* in the @PS_FontInfoRec structure which is only guaranteed to */ + /* in the @PS_FontInfoRec structure, which is only guaranteed to */ /* return the correct results for Type~1 fonts. */ /* */ /* */ @@ -3594,7 +3618,7 @@ FT_BEGIN_HEADER /* The character codepoint in Unicode. */ /* */ /* */ - /* A pointer to an array of variant selector code points which are */ + /* A pointer to an array of variant selector code points that are */ /* active for the given character, or NULL if the corresponding list */ /* is empty. */ /* */ @@ -3628,7 +3652,7 @@ FT_BEGIN_HEADER /* The variant selector code point in Unicode. */ /* */ /* */ - /* A list of all the code points which are specified by this selector */ + /* A list of all the code points that are specified by this selector */ /* (both default and non-default codes are returned) or NULL if there */ /* is no valid cmap or the variant selector is invalid. */ /* */ @@ -3901,7 +3925,7 @@ FT_BEGIN_HEADER */ #define FREETYPE_MAJOR 2 #define FREETYPE_MINOR 5 -#define FREETYPE_PATCH 0 +#define FREETYPE_PATCH 2 /*************************************************************************/ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftcffdrv.h b/reactos/lib/3rdparty/freetype/include/freetype/ftcffdrv.h deleted file mode 100644 index ccbcbccaa86..00000000000 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftcffdrv.h +++ /dev/null @@ -1,151 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftcffdrv.h */ -/* */ -/* FreeType API for controlling the CFF driver (specification only). */ -/* */ -/* Copyright 2013 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTCFFDRV_H__ -#define __FTCFFDRV_H__ - -#include -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /************************************************************************** - * - * @section: - * cff_driver - * - * @title: - * The CFF driver - * - * @abstract: - * Controlling the CFF driver module. - * - * @description: - * While FreeType's CFF driver doesn't expose API functions by itself, - * it is possible to control its behaviour with @FT_Property_Set and - * @FT_Property_Get. The following lists the available properties - * together with the necessary macros and structures. - * - * The CFF driver's module name is `cff'. - * - */ - - - /************************************************************************** - * - * @property: - * hinting-engine - * - * @description: - * Thanks to Adobe, which contributed a new hinting (and parsing) - * engine, an application can select between `freetype' and `adobe' if - * compiled with CFF_CONFIG_OPTION_OLD_ENGINE. If this configuration - * macro isn't defined, `hinting-engine' does nothing. - * - * The default engine is `freetype' if CFF_CONFIG_OPTION_OLD_ENGINE is - * defined, and `adobe' otherwise. - * - * The following example code demonstrates how to select Adobe's hinting - * engine (omitting the error handling). - * - * { - * FT_Library library; - * FT_Face face; - * FT_UInt hinting_engine = FT_CFF_HINTING_ADOBE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "cff", - * "hinting-engine", &hinting_engine ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - */ - - - /************************************************************************** - * - * @enum: - * FT_CFF_HINTING_XXX - * - * @description: - * A list of constants used for the @hinting-engine property to select - * the hinting engine for CFF fonts. - * - * @values: - * FT_CFF_HINTING_FREETYPE :: - * Use the old FreeType hinting engine. - * - * FT_CFF_HINTING_ADOBE :: - * Use the hinting engine contributed by Adobe. - * - */ -#define FT_CFF_HINTING_FREETYPE 0 -#define FT_CFF_HINTING_ADOBE 1 - - - /************************************************************************** - * - * @property: - * no-stem-darkening - * - * @description: - * By default, the Adobe CFF engine darkens stems at smaller sizes, - * regardless of hinting, to enhance contrast. Setting this property, - * stem darkening gets switched off. - * - * Note that stem darkening is never applied if @FT_LOAD_NO_SCALE is set. - * - * { - * FT_Library library; - * FT_Face face; - * FT_Bool no_stem_darkening = TRUE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "cff", - * "no-stem-darkening", &no_stem_darkening ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - */ - - - /* */ - -FT_END_HEADER - - -#endif /* __FTCFFDRV_H__ */ - - -/* END */ diff --git a/reactos/lib/3rdparty/freetype/include/ft2build.h b/reactos/lib/3rdparty/freetype/include/ft2build.h index 923d887df6f..6f8eb7f3731 100644 --- a/reactos/lib/3rdparty/freetype/include/ft2build.h +++ b/reactos/lib/3rdparty/freetype/include/ft2build.h @@ -3,9 +3,8 @@ /* ft2build.h */ /* */ /* FreeType 2 build and setup macros. */ -/* (Generic version) */ /* */ -/* Copyright 1996-2001, 2006 by */ +/* Copyright 1996-2001, 2006, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,21 +18,25 @@ /*************************************************************************/ /* */ - /* This file corresponds to the default `ft2build.h' file for */ - /* FreeType 2. It uses the `freetype' include root. */ + /* This is the `entry point' for FreeType header file inclusions. It is */ + /* the only header file which should be included directly; all other */ + /* FreeType header files should be accessed with macro names (after */ + /* including `ft2build.h'). */ /* */ - /* Note that specific platforms might use a different configuration. */ - /* See builds/unix/ft2unix.h for an example. */ + /* A typical example is */ + /* */ + /* #include */ + /* #include FT_FREETYPE_H */ /* */ /*************************************************************************/ -#ifndef __FT2_BUILD_GENERIC_H__ -#define __FT2_BUILD_GENERIC_H__ +#ifndef __FT2BUILD_H__ +#define __FT2BUILD_H__ -#include +#include -#endif /* __FT2_BUILD_GENERIC_H__ */ +#endif /* __FT2BUILD_H__ */ /* END */ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftadvanc.h b/reactos/lib/3rdparty/freetype/include/ftadvanc.h similarity index 98% rename from reactos/lib/3rdparty/freetype/include/freetype/ftadvanc.h rename to reactos/lib/3rdparty/freetype/include/ftadvanc.h index 012b74b8122..8f7e2fce5ed 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftadvanc.h +++ b/reactos/lib/3rdparty/freetype/include/ftadvanc.h @@ -64,11 +64,11 @@ FT_BEGIN_HEADER /* corresponding hinting mode or font driver doesn't allow for very */ /* quick advance computation. */ /* */ - /* Typically, glyphs which are either unscaled, unhinted, bitmapped, */ + /* Typically, glyphs that are either unscaled, unhinted, bitmapped, */ /* or light-hinted can have their advance width computed very */ /* quickly. */ /* */ - /* Normal and bytecode hinted modes, which require loading, scaling, */ + /* Normal and bytecode hinted modes that require loading, scaling, */ /* and hinting of the glyph outline, are extremely slow by */ /* comparison. */ /* */ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftautoh.h b/reactos/lib/3rdparty/freetype/include/ftautoh.h similarity index 98% rename from reactos/lib/3rdparty/freetype/include/freetype/ftautoh.h rename to reactos/lib/3rdparty/freetype/include/ftautoh.h index 5e1153a1c1d..bf97b3f2404 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftautoh.h +++ b/reactos/lib/3rdparty/freetype/include/ftautoh.h @@ -79,7 +79,7 @@ FT_BEGIN_HEADER * sense, see the @FT_AUTOHINTER_SCRIPT_XXX values) is stored as an * array with `num_glyphs' elements, as found in the font's @FT_Face * structure. The `glyph-to-script-map' property returns a pointer to - * this array which can be modified as needed. Note that the + * this array, which can be modified as needed. Note that the * modification should happen before the first glyph gets processed by * the auto-hinter so that the global analysis of the font shapes * actually uses the modified mapping. @@ -282,7 +282,7 @@ FT_BEGIN_HEADER * This property can be used with @FT_Property_Get also. * * It's important to use the right timing for changing this value: The - * creation of the glyph-to-script map which eventually uses the + * creation of the glyph-to-script map that eventually uses the * fallback script value gets triggered either by setting or reading a * face-specific property like @glyph-to-script-map, or by auto-hinting * any glyph from that face. In particular, if you have already created diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftbbox.h b/reactos/lib/3rdparty/freetype/include/ftbbox.h similarity index 97% rename from reactos/lib/3rdparty/freetype/include/freetype/ftbbox.h rename to reactos/lib/3rdparty/freetype/include/ftbbox.h index 976691956f2..8938841a622 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftbbox.h +++ b/reactos/lib/3rdparty/freetype/include/ftbbox.h @@ -4,7 +4,7 @@ /* */ /* FreeType exact bbox computation (specification). */ /* */ -/* Copyright 1996-2001, 2003, 2007, 2011 by */ +/* Copyright 1996-2001, 2003, 2007, 2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -60,7 +60,7 @@ FT_BEGIN_HEADER /* */ /* Compute the exact bounding box of an outline. This is slower */ /* than computing the control box. However, it uses an advanced */ - /* algorithm which returns _very_ quickly when the two boxes */ + /* algorithm that returns _very_ quickly when the two boxes */ /* coincide. Otherwise, the outline Bézier arcs are traversed to */ /* extract their extrema. */ /* */ @@ -78,7 +78,7 @@ FT_BEGIN_HEADER /* @FT_LOAD_NO_SCALE, the resulting BBox is meaningless. To get */ /* reasonable values for the BBox it is necessary to load the glyph */ /* at a large ppem value (so that the hinting instructions can */ - /* properly shift and scale the subglyphs), then extracting the BBox */ + /* properly shift and scale the subglyphs), then extracting the BBox, */ /* which can be eventually converted back to font units. */ /* */ FT_EXPORT( FT_Error ) diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftbdf.h b/reactos/lib/3rdparty/freetype/include/ftbdf.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/ftbdf.h rename to reactos/lib/3rdparty/freetype/include/ftbdf.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftbitmap.h b/reactos/lib/3rdparty/freetype/include/ftbitmap.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/ftbitmap.h rename to reactos/lib/3rdparty/freetype/include/ftbitmap.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftbzip2.h b/reactos/lib/3rdparty/freetype/include/ftbzip2.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/ftbzip2.h rename to reactos/lib/3rdparty/freetype/include/ftbzip2.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftcache.h b/reactos/lib/3rdparty/freetype/include/ftcache.h similarity index 99% rename from reactos/lib/3rdparty/freetype/include/freetype/ftcache.h rename to reactos/lib/3rdparty/freetype/include/ftcache.h index 4ec9587cf6f..a5d7100a3fb 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftcache.h +++ b/reactos/lib/3rdparty/freetype/include/ftcache.h @@ -156,7 +156,7 @@ FT_BEGIN_HEADER * @note: * Never use NULL as a valid @FTC_FaceID. * - * Face IDs are passed by the client to the cache manager, which calls, + * Face IDs are passed by the client to the cache manager that calls, * when needed, the @FTC_Face_Requester to translate them into new * @FT_Face objects. * diff --git a/reactos/lib/3rdparty/freetype/include/ftcffdrv.h b/reactos/lib/3rdparty/freetype/include/ftcffdrv.h new file mode 100644 index 00000000000..e4d039d0214 --- /dev/null +++ b/reactos/lib/3rdparty/freetype/include/ftcffdrv.h @@ -0,0 +1,254 @@ +/***************************************************************************/ +/* */ +/* ftcffdrv.h */ +/* */ +/* FreeType API for controlling the CFF driver (specification only). */ +/* */ +/* Copyright 2013 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTCFFDRV_H__ +#define __FTCFFDRV_H__ + +#include +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * cff_driver + * + * @title: + * The CFF driver + * + * @abstract: + * Controlling the CFF driver module. + * + * @description: + * While FreeType's CFF driver doesn't expose API functions by itself, + * it is possible to control its behaviour with @FT_Property_Set and + * @FT_Property_Get. The list below gives the available properties + * together with the necessary macros and structures. + * + * The CFF driver's module name is `cff'. + * + * *Hinting* *and* *antialiasing* *principles* *of* *the* *new* *engine* + * + * The rasterizer is positioning horizontal features (e.g., ascender + * height & x-height, or crossbars) on the pixel grid and minimizing the + * amount of antialiasing applied to them, while placing vertical + * features (vertical stems) on the pixel grid without hinting, thus + * representing the stem position and weight accurately. Sometimes the + * vertical stems may be only partially black. In this context, + * `antialiasing' means that stems are not positioned exactly on pixel + * borders, causing a fuzzy appearance. + * + * There are two principles behind this approach. + * + * 1) No hinting in the horizontal direction: Unlike `superhinted' + * TrueType, which changes glyph widths to accommodate regular + * inter-glyph spacing, Adobe's approach is `faithful to the design' in + * representing both the glyph width and the inter-glyph spacing + * designed for the font. This makes the screen display as close as it + * can be to the result one would get with infinite resolution, while + * preserving what is considered the key characteristics of each glyph. + * Note that the distances between unhinted and grid-fitted positions at + * small sizes are comparable to kerning values and thus would be + * noticeable (and distracting) while reading if hinting were applied. + * + * One of the reasons to not hint horizontally is antialiasing for LCD + * screens: The pixel geometry of modern displays supplies three + * vertical sub-pixels as the eye moves horizontally across each visible + * pixel. On devices where we can be certain this characteristic is + * present a rasterizer can take advantage of the sub-pixels to add + * increments of weight. In Western writing systems this turns out to + * be the more critical direction anyway; the weights and spacing of + * vertical stems (see above) are central to Armenian, Cyrillic, Greek, + * and Latin type designs. Even when the rasterizer uses greyscale + * antialiasing instead of color (a necessary compromise when one + * doesn't know the screen characteristics), the unhinted vertical + * features preserve the design's weight and spacing much better than + * aliased type would. + * + * 2) Aligment in the vertical direction: Weights and spacing along the + * y~axis are less critical; what is much more important is the visual + * alignment of related features (like cap-height and x-height). The + * sense of alignment for these is enhanced by the sharpness of grid-fit + * edges, while the cruder vertical resolution (full pixels instead of + * 1/3 pixels) is less of a problem. + * + * On the technical side, horizontal alignment zones for ascender, + * x-height, and other important height values (traditionally called + * `blue zones') as defined in the font are positioned independently, + * each being rounded to the nearest pixel edge, taking care of + * overshoot suppression at small sizes, stem darkening, and scaling. + * + * Hstems (this is, hint values defined in the font to help align + * horizontal features) that fall within a blue zone are said to be + * `captured' and are aligned to that zone. Uncaptured stems are moved + * in one of four ways, top edge up or down, bottom edge up or down. + * Unless there are conflicting hstems, the smallest movement is taken + * to minimize distortion. + */ + + + /************************************************************************** + * + * @property: + * hinting-engine + * + * @description: + * Thanks to Adobe, which contributed a new hinting (and parsing) + * engine, an application can select between `freetype' and `adobe' if + * compiled with CFF_CONFIG_OPTION_OLD_ENGINE. If this configuration + * macro isn't defined, `hinting-engine' does nothing. + * + * The default engine is `freetype' if CFF_CONFIG_OPTION_OLD_ENGINE is + * defined, and `adobe' otherwise. + * + * The following example code demonstrates how to select Adobe's hinting + * engine (omitting the error handling). + * + * { + * FT_Library library; + * FT_UInt hinting_engine = FT_CFF_HINTING_ADOBE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "cff", + * "hinting-engine", &hinting_engine ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + */ + + + /************************************************************************** + * + * @enum: + * FT_CFF_HINTING_XXX + * + * @description: + * A list of constants used for the @hinting-engine property to select + * the hinting engine for CFF fonts. + * + * @values: + * FT_CFF_HINTING_FREETYPE :: + * Use the old FreeType hinting engine. + * + * FT_CFF_HINTING_ADOBE :: + * Use the hinting engine contributed by Adobe. + * + */ +#define FT_CFF_HINTING_FREETYPE 0 +#define FT_CFF_HINTING_ADOBE 1 + + + /************************************************************************** + * + * @property: + * no-stem-darkening + * + * @description: + * By default, the Adobe CFF engine darkens stems at smaller sizes, + * regardless of hinting, to enhance contrast. This feature requires + * a rendering system with proper gamma correction. Setting this + * property, stem darkening gets switched off. + * + * Note that stem darkening is never applied if @FT_LOAD_NO_SCALE is set. + * + * { + * FT_Library library; + * FT_Bool no_stem_darkening = TRUE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "cff", + * "no-stem-darkening", &no_stem_darkening ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + */ + + + /************************************************************************** + * + * @property: + * darkening-parameters + * + * @description: + * By default, the Adobe CFF engine darkens stems as follows (if the + * `no-stem-darkening' property isn't set): + * + * { + * stem width <= 0.5px: darkening amount = 0.4px + * stem width = 1px: darkening amount = 0.275px + * stem width = 1.667px: darkening amount = 0.275px + * stem width >= 2.333px: darkening amount = 0px + * } + * + * and piecewise linear in-between. Using the `darkening-parameters' + * property, these four control points can be changed, as the following + * example demonstrates. + * + * { + * FT_Library library; + * FT_Int darken_params[8] = { 500, 300, // x1, y1 + * 1000, 200, // x2, y2 + * 1500, 100, // x3, y3 + * 2000, 0 }; // x4, y4 + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "cff", + * "darkening-parameters", darken_params ); + * } + * + * The x~values give the stem width, and the y~values the darkening + * amount. The unit is 1000th of pixels. All coordinate values must be + * positive; the x~values must be monotonically increasing; the + * y~values must be monotonically decreasing and smaller than or + * equal to 500 (corresponding to half a pixel); the slope of each + * linear piece must be shallower than -1 (e.g., -.4). + * + * @note: + * This property can be used with @FT_Property_Get also. + * + */ + + + /* */ + +FT_END_HEADER + + +#endif /* __FTCFFDRV_H__ */ + + +/* END */ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftchapters.h b/reactos/lib/3rdparty/freetype/include/ftchapters.h similarity index 99% rename from reactos/lib/3rdparty/freetype/include/freetype/ftchapters.h rename to reactos/lib/3rdparty/freetype/include/ftchapters.h index c55670d1d23..4b1059a8592 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftchapters.h +++ b/reactos/lib/3rdparty/freetype/include/ftchapters.h @@ -1,7 +1,7 @@ /***************************************************************************/ /* */ /* This file defines the structure of the FreeType reference. */ -/* It is used by the python script which generates the HTML files. */ +/* It is used by the python script that generates the HTML files. */ /* */ /***************************************************************************/ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftcid.h b/reactos/lib/3rdparty/freetype/include/ftcid.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/ftcid.h rename to reactos/lib/3rdparty/freetype/include/ftcid.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/fterrdef.h b/reactos/lib/3rdparty/freetype/include/fterrdef.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/fterrdef.h rename to reactos/lib/3rdparty/freetype/include/fterrdef.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/fterrors.h b/reactos/lib/3rdparty/freetype/include/fterrors.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/fterrors.h rename to reactos/lib/3rdparty/freetype/include/fterrors.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftgasp.h b/reactos/lib/3rdparty/freetype/include/ftgasp.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/ftgasp.h rename to reactos/lib/3rdparty/freetype/include/ftgasp.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftglyph.h b/reactos/lib/3rdparty/freetype/include/ftglyph.h similarity index 99% rename from reactos/lib/3rdparty/freetype/include/freetype/ftglyph.h rename to reactos/lib/3rdparty/freetype/include/ftglyph.h index 31dc33187d7..2d30ed9de7b 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftglyph.h +++ b/reactos/lib/3rdparty/freetype/include/ftglyph.h @@ -4,7 +4,7 @@ /* */ /* FreeType convenience functions to handle glyphs (specification). */ /* */ -/* Copyright 1996-2003, 2006, 2008, 2009, 2011 by */ +/* Copyright 1996-2003, 2006, 2008, 2009, 2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -358,17 +358,17 @@ FT_BEGIN_HEADER /* outline's points, including Bézier control points. Though it */ /* coincides with the exact bounding box for most glyphs, it can be */ /* slightly larger in some situations (like when rotating an outline */ - /* which contains Bézier outside arcs). */ + /* that contains Bézier outside arcs). */ /* */ /* Computing the control box is very fast, while getting the bounding */ /* box can take much more time as it needs to walk over all segments */ /* and arcs in the outline. To get the latter, you can use the */ - /* `ftbbox' component which is dedicated to this single task. */ + /* `ftbbox' component, which is dedicated to this single task. */ /* */ /* */ /* glyph :: A handle to the source glyph object. */ /* */ - /* mode :: The mode which indicates how to interpret the returned */ + /* mode :: The mode that indicates how to interpret the returned */ /* bounding box values. */ /* */ /* */ @@ -388,7 +388,7 @@ FT_BEGIN_HEADER /* @FT_LOAD_NO_SCALE, the resulting CBox is meaningless. To get */ /* reasonable values for the CBox it is necessary to load the glyph */ /* at a large ppem value (so that the hinting instructions can */ - /* properly shift and scale the subglyphs), then extracting the CBox */ + /* properly shift and scale the subglyphs), then extracting the CBox, */ /* which can be eventually converted back to font units. */ /* */ /* Note that the maximum coordinates are exclusive, which means that */ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftgxval.h b/reactos/lib/3rdparty/freetype/include/ftgxval.h similarity index 98% rename from reactos/lib/3rdparty/freetype/include/freetype/ftgxval.h rename to reactos/lib/3rdparty/freetype/include/ftgxval.h index 497015c1011..6d38e327aa1 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftgxval.h +++ b/reactos/lib/3rdparty/freetype/include/ftgxval.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for validating TrueTypeGX/AAT tables (specification). */ /* */ -/* Copyright 2004, 2005, 2006 by */ +/* Copyright 2004-2006, 2013 by */ /* Masatake YAMATO, Redhat K.K, */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ @@ -180,7 +180,7 @@ FT_BEGIN_HEADER * * @description: * Validate various TrueTypeGX tables to assure that all offsets and - * indices are valid. The idea is that a higher-level library which + * indices are valid. The idea is that a higher-level library that * actually does the text layout can access those tables without * error checking (which can be quite time consuming). * @@ -189,7 +189,7 @@ FT_BEGIN_HEADER * A handle to the input face. * * validation_flags :: - * A bit field which specifies the tables to be validated. See + * A bit field that specifies the tables to be validated. See * @FT_VALIDATE_GXXXX for possible values. * * table_length :: @@ -286,7 +286,7 @@ FT_BEGIN_HEADER * * @description: * Validate classic (16-bit format) kern table to assure that the offsets - * and indices are valid. The idea is that a higher-level library which + * and indices are valid. The idea is that a higher-level library that * actually does the text layout can access those tables without error * checking (which can be quite time consuming). * @@ -299,7 +299,7 @@ FT_BEGIN_HEADER * A handle to the input face. * * validation_flags :: - * A bit field which specifies the dialect to be validated. See + * A bit field that specifies the dialect to be validated. See * @FT_VALIDATE_CKERNXXX for possible values. * * @output: diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftgzip.h b/reactos/lib/3rdparty/freetype/include/ftgzip.h similarity index 74% rename from reactos/lib/3rdparty/freetype/include/freetype/ftgzip.h rename to reactos/lib/3rdparty/freetype/include/ftgzip.h index acbc4f0327b..78e726999ac 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftgzip.h +++ b/reactos/lib/3rdparty/freetype/include/ftgzip.h @@ -4,7 +4,7 @@ /* */ /* Gzip-compressed stream support. */ /* */ -/* Copyright 2002, 2003, 2004, 2006 by */ +/* Copyright 2002-2004, 2006, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -91,6 +91,53 @@ FT_BEGIN_HEADER FT_Stream_OpenGzip( FT_Stream stream, FT_Stream source ); + + /************************************************************************ + * + * @function: + * FT_Gzip_Uncompress + * + * @description: + * Decompress a zipped input buffer into an output buffer. This function + * is modeled after zlib's `uncompress' function. + * + * @input: + * memory :: + * A FreeType memory handle. + * + * input :: + * The input buffer. + * + * input_len :: + * The length of the input buffer. + * + * @output: + * output:: + * The output buffer. + * + * @inout: + * output_len :: + * Before calling the function, this is the the total size of the + * output buffer, which must be large enough to hold the entire + * uncompressed data (so the size of the uncompressed data must be + * known in advance). After calling the function, `output_len' is the + * size of the used data in `output'. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function may return `FT_Err_Unimplemented_Feature' if your build + * of FreeType was not compiled with zlib support. + */ + FT_EXPORT( FT_Error ) + FT_Gzip_Uncompress( FT_Memory memory, + FT_Byte* output, + FT_ULong* output_len, + const FT_Byte* input, + FT_ULong input_len ); + + /* */ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftimage.h b/reactos/lib/3rdparty/freetype/include/ftimage.h similarity index 99% rename from reactos/lib/3rdparty/freetype/include/freetype/ftimage.h rename to reactos/lib/3rdparty/freetype/include/ftimage.h index 3b826b1d32f..ea71a78efb6 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftimage.h +++ b/reactos/lib/3rdparty/freetype/include/ftimage.h @@ -555,7 +555,7 @@ FT_BEGIN_HEADER /* */ /* to :: A pointer to the target point of the `move to'. */ /* */ - /* user :: A typeless pointer which is passed from the caller of the */ + /* user :: A typeless pointer, which is passed from the caller of the */ /* decomposition function. */ /* */ /* */ @@ -582,7 +582,7 @@ FT_BEGIN_HEADER /* */ /* to :: A pointer to the target point of the `line to'. */ /* */ - /* user :: A typeless pointer which is passed from the caller of the */ + /* user :: A typeless pointer, which is passed from the caller of the */ /* decomposition function. */ /* */ /* */ @@ -613,7 +613,7 @@ FT_BEGIN_HEADER /* */ /* to :: A pointer to the target end point of the conic arc. */ /* */ - /* user :: A typeless pointer which is passed from the caller of */ + /* user :: A typeless pointer, which is passed from the caller of */ /* the decomposition function. */ /* */ /* */ @@ -645,7 +645,7 @@ FT_BEGIN_HEADER /* */ /* to :: A pointer to the target end point. */ /* */ - /* user :: A typeless pointer which is passed from the caller of */ + /* user :: A typeless pointer, which is passed from the caller of */ /* the decomposition function. */ /* */ /* */ @@ -836,8 +836,8 @@ FT_BEGIN_HEADER /* a a bitmap. This section contains the public API for rasters. */ /* */ /* Note that in FreeType 2, all rasters are now encapsulated within */ - /* specific modules called `renderers'. See `freetype/ftrender.h' for */ - /* more details on renderers. */ + /* specific modules called `renderers'. See `ftrender.h' for more */ + /* details on renderers. */ /* */ /*************************************************************************/ @@ -891,8 +891,8 @@ FT_BEGIN_HEADER /* */ /* */ /* This structure is used by the span drawing callback type named */ - /* @FT_SpanFunc which takes the y~coordinate of the span as a */ - /* a parameter. */ + /* @FT_SpanFunc that takes the y~coordinate of the span as a */ + /* parameter. */ /* */ /* The coverage value is always between 0 and 255. If you want less */ /* gray values, the callback function has to reduce them. */ @@ -1265,7 +1265,7 @@ FT_BEGIN_HEADER /* XXX: For now, the standard raster doesn't support direct */ /* composition but this should change for the final release (see */ /* the files `demos/src/ftgrays.c' and `demos/src/ftgrays2.c' */ - /* for examples of distinct implementations which support direct */ + /* for examples of distinct implementations that support direct */ /* composition). */ /* */ typedef int diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftincrem.h b/reactos/lib/3rdparty/freetype/include/ftincrem.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/ftincrem.h rename to reactos/lib/3rdparty/freetype/include/ftincrem.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftlcdfil.h b/reactos/lib/3rdparty/freetype/include/ftlcdfil.h similarity index 97% rename from reactos/lib/3rdparty/freetype/include/freetype/ftlcdfil.h rename to reactos/lib/3rdparty/freetype/include/ftlcdfil.h index 8b253f118be..39206f01927 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftlcdfil.h +++ b/reactos/lib/3rdparty/freetype/include/ftlcdfil.h @@ -5,7 +5,7 @@ /* FreeType API for color filtering of subpixel bitmap glyphs */ /* (specification). */ /* */ -/* Copyright 2006, 2007, 2008, 2010 by */ +/* Copyright 2006-2008, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -45,9 +45,9 @@ FT_BEGIN_HEADER * * @description: * The @FT_Library_SetLcdFilter API can be used to specify a low-pass - * filter which is then applied to LCD-optimized bitmaps generated + * filter, which is then applied to LCD-optimized bitmaps generated * through @FT_Render_Glyph. This is useful to reduce color fringes - * which would occur with unfiltered rendering. + * that would occur with unfiltered rendering. * * Note that no filter is active by default, and that this function is * *not* implemented in default builds of the library. You need to diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftlist.h b/reactos/lib/3rdparty/freetype/include/ftlist.h similarity index 97% rename from reactos/lib/3rdparty/freetype/include/freetype/ftlist.h rename to reactos/lib/3rdparty/freetype/include/ftlist.h index bb6f7f119d3..241e21e555c 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftlist.h +++ b/reactos/lib/3rdparty/freetype/include/ftlist.h @@ -4,7 +4,7 @@ /* */ /* Generic list support for FreeType (specification). */ /* */ -/* Copyright 1996-2001, 2003, 2007, 2010 by */ +/* Copyright 1996-2001, 2003, 2007, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -173,7 +173,7 @@ FT_BEGIN_HEADER /* FT_List_Iterator */ /* */ /* */ - /* An FT_List iterator function which is called during a list parse */ + /* An FT_List iterator function that is called during a list parse */ /* by @FT_List_Iterate. */ /* */ /* */ @@ -200,7 +200,7 @@ FT_BEGIN_HEADER /* */ /* list :: A handle to the list. */ /* iterator :: An iterator function, called on each node of the list. */ - /* user :: A user-supplied field which is passed as the second */ + /* user :: A user-supplied field that is passed as the second */ /* argument to the iterator. */ /* */ /* */ @@ -218,7 +218,7 @@ FT_BEGIN_HEADER /* FT_List_Destructor */ /* */ /* */ - /* An @FT_List iterator function which is called during a list */ + /* An @FT_List iterator function that is called during a list */ /* finalization by @FT_List_Finalize to destroy all elements in a */ /* given list. */ /* */ @@ -250,9 +250,9 @@ FT_BEGIN_HEADER /* destroy :: A list destructor that will be applied to each element */ /* of the list. */ /* */ - /* memory :: The current memory object which handles deallocation. */ + /* memory :: The current memory object that handles deallocation. */ /* */ - /* user :: A user-supplied field which is passed as the last */ + /* user :: A user-supplied field that is passed as the last */ /* argument to the destructor. */ /* */ /* */ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftlzw.h b/reactos/lib/3rdparty/freetype/include/ftlzw.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/ftlzw.h rename to reactos/lib/3rdparty/freetype/include/ftlzw.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftmac.h b/reactos/lib/3rdparty/freetype/include/ftmac.h similarity index 98% rename from reactos/lib/3rdparty/freetype/include/freetype/ftmac.h rename to reactos/lib/3rdparty/freetype/include/ftmac.h index ab5bab5170c..42874fe6fc1 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftmac.h +++ b/reactos/lib/3rdparty/freetype/include/ftmac.h @@ -4,7 +4,7 @@ /* */ /* Additional Mac-specific API. */ /* */ -/* Copyright 1996-2001, 2004, 2006, 2007 by */ +/* Copyright 1996-2001, 2004, 2006, 2007, 2013 by */ /* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -18,7 +18,7 @@ /***************************************************************************/ /* */ -/* NOTE: Include this file after and after any */ +/* NOTE: Include this file after FT_FREETYPE_H and after any */ /* Mac-specific headers (because this header uses Mac types such as */ /* Handle, FSSpec, FSRef, etc.) */ /* */ @@ -168,7 +168,7 @@ FT_BEGIN_HEADER /* */ /* */ /* Return a pathname of the disk file and face index for given font */ - /* name which is handled by ATS framework. */ + /* name that is handled by ATS framework. */ /* */ /* */ /* fontName :: Mac OS name of the font in ATS framework. */ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftmm.h b/reactos/lib/3rdparty/freetype/include/ftmm.h similarity index 98% rename from reactos/lib/3rdparty/freetype/include/freetype/ftmm.h rename to reactos/lib/3rdparty/freetype/include/ftmm.h index 3aefb9e4f25..837975a0b5c 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftmm.h +++ b/reactos/lib/3rdparty/freetype/include/ftmm.h @@ -4,7 +4,7 @@ /* */ /* FreeType Multiple Master font interface (specification). */ /* */ -/* Copyright 1996-2001, 2003, 2004, 2006, 2009 by */ +/* Copyright 1996-2001, 2003, 2004, 2006, 2009, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -196,7 +196,7 @@ FT_BEGIN_HEADER /* number of designs). */ /* */ /* num_namedstyles :: The number of named styles; only meaningful for */ - /* GX which allows certain design coordinates to */ + /* GX that allows certain design coordinates to */ /* have a string ID (in the `name' table) */ /* associated with them. The font can tell the */ /* user that, for example, Weight=1.5 is `Bold'. */ @@ -258,8 +258,7 @@ FT_BEGIN_HEADER /* */ /* */ /* amaster :: The Multiple Masters/GX var descriptor. */ - /* Allocates a data structure, which the user must free */ - /* (a single call to FT_FREE will do it). */ + /* Allocates a data structure, which the user must free. */ /* */ /* */ /* FreeType error code. 0~means success. */ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftmodapi.h b/reactos/lib/3rdparty/freetype/include/ftmodapi.h similarity index 99% rename from reactos/lib/3rdparty/freetype/include/freetype/ftmodapi.h rename to reactos/lib/3rdparty/freetype/include/ftmodapi.h index 8abffb558f1..22878f8c6d7 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftmodapi.h +++ b/reactos/lib/3rdparty/freetype/include/ftmodapi.h @@ -298,7 +298,7 @@ FT_BEGIN_HEADER * Note that only a few modules have properties. * * value :: - * A generic pointer to a variable or structure which gives the new + * A generic pointer to a variable or structure that gives the new * value of the property. The exact definition of `value' is * dependent on the property; see the `Synopsis' subsection of the * module's documentation. @@ -364,7 +364,7 @@ FT_BEGIN_HEADER * * @inout: * value :: - * A generic pointer to a variable or structure which gives the + * A generic pointer to a variable or structure that gives the * value of the property. The exact definition of `value' is * dependent on the property; see the `Synopsis' subsection of the * module's documentation. @@ -418,7 +418,7 @@ FT_BEGIN_HEADER /* @FT_Done_Library then only destroys a library if the counter is~1, */ /* otherwise it simply decrements the counter. */ /* */ - /* This function helps in managing life-cycles of structures which */ + /* This function helps in managing life-cycles of structures that */ /* reference @FT_Library objects. */ /* */ /* */ @@ -584,7 +584,7 @@ FT_BEGIN_HEADER * The library implements a bytecode interpreter that doesn't * support the patented operations of the TrueType virtual machine. * - * Its main use is to load certain Asian fonts which position and + * Its main use is to load certain Asian fonts that position and * scale glyph components with bytecode instructions. It produces * bad output for most other fonts. * diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftmoderr.h b/reactos/lib/3rdparty/freetype/include/ftmoderr.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/ftmoderr.h rename to reactos/lib/3rdparty/freetype/include/ftmoderr.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftotval.h b/reactos/lib/3rdparty/freetype/include/ftotval.h similarity index 97% rename from reactos/lib/3rdparty/freetype/include/freetype/ftotval.h rename to reactos/lib/3rdparty/freetype/include/ftotval.h index 027f2e88657..bb52dc4a0d2 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftotval.h +++ b/reactos/lib/3rdparty/freetype/include/ftotval.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for validating OpenType tables (specification). */ /* */ -/* Copyright 2004, 2005, 2006, 2007 by */ +/* Copyright 2004-2007, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -116,7 +116,7 @@ FT_BEGIN_HEADER * * @description: * Validate various OpenType tables to assure that all offsets and - * indices are valid. The idea is that a higher-level library which + * indices are valid. The idea is that a higher-level library that * actually does the text layout can access those tables without * error checking (which can be quite time consuming). * @@ -125,7 +125,7 @@ FT_BEGIN_HEADER * A handle to the input face. * * validation_flags :: - * A bit field which specifies the tables to be validated. See + * A bit field that specifies the tables to be validated. See * @FT_VALIDATE_OTXXX for possible values. * * @output: diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftoutln.h b/reactos/lib/3rdparty/freetype/include/ftoutln.h similarity index 96% rename from reactos/lib/3rdparty/freetype/include/freetype/ftoutln.h rename to reactos/lib/3rdparty/freetype/include/ftoutln.h index fd69f282929..8c7c57d99eb 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftoutln.h +++ b/reactos/lib/3rdparty/freetype/include/ftoutln.h @@ -5,7 +5,7 @@ /* Support for the FT_Outline type used to store glyph shapes of */ /* most scalable font formats (specification). */ /* */ -/* Copyright 1996-2003, 2005-2012 by */ +/* Copyright 1996-2003, 2005-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -97,7 +97,7 @@ FT_BEGIN_HEADER /* operations. */ /* */ /* */ - /* user :: A typeless pointer which is passed to each */ + /* user :: A typeless pointer that is passed to each */ /* emitter during the decomposition. It can be */ /* used to store the state during the */ /* decomposition. */ @@ -105,6 +105,13 @@ FT_BEGIN_HEADER /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* A contour that contains a single point only is represented by a */ + /* `move to' operation followed by `line to' to the same point. In */ + /* most cases, it is best to filter this out before using the */ + /* outline for stroking purposes (otherwise it would result in a */ + /* visible dot when round caps are used). */ + /* */ FT_EXPORT( FT_Error ) FT_Outline_Decompose( FT_Outline* outline, const FT_Outline_Funcs* func_interface, @@ -217,12 +224,12 @@ FT_BEGIN_HEADER /* the outline's points, including Bézier control points. Though it */ /* coincides with the exact bounding box for most glyphs, it can be */ /* slightly larger in some situations (like when rotating an outline */ - /* which contains Bézier outside arcs). */ + /* that contains Bézier outside arcs). */ /* */ /* Computing the control box is very fast, while getting the bounding */ /* box can take much more time as it needs to walk over all segments */ /* and arcs in the outline. To get the latter, you can use the */ - /* `ftbbox' component which is dedicated to this single task. */ + /* `ftbbox' component, which is dedicated to this single task. */ /* */ /* */ /* outline :: A pointer to the source outline descriptor. */ @@ -525,9 +532,11 @@ FT_BEGIN_HEADER * * @description: * This function analyzes a glyph outline and tries to compute its - * fill orientation (see @FT_Orientation). This is done by computing - * the direction of each global horizontal and/or vertical extrema - * within the outline. + * fill orientation (see @FT_Orientation). This is done by integrating + * the total area covered by the outline. The positive integral + * corresponds to the clockwise orientation and @FT_ORIENTATION_POSTSCRIPT + * is returned. The negative integral corresponds to the counter-clockwise + * orientation and @FT_ORIENTATION_TRUETYPE is returned. * * Note that this will return @FT_ORIENTATION_TRUETYPE for empty * outlines. diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftpfr.h b/reactos/lib/3rdparty/freetype/include/ftpfr.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/ftpfr.h rename to reactos/lib/3rdparty/freetype/include/ftpfr.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftrender.h b/reactos/lib/3rdparty/freetype/include/ftrender.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/ftrender.h rename to reactos/lib/3rdparty/freetype/include/ftrender.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftsizes.h b/reactos/lib/3rdparty/freetype/include/ftsizes.h similarity index 98% rename from reactos/lib/3rdparty/freetype/include/freetype/ftsizes.h rename to reactos/lib/3rdparty/freetype/include/ftsizes.h index 3e548cc39f3..41670457014 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftsizes.h +++ b/reactos/lib/3rdparty/freetype/include/ftsizes.h @@ -4,7 +4,7 @@ /* */ /* FreeType size objects management (specification). */ /* */ -/* Copyright 1996-2001, 2003, 2004, 2006, 2009 by */ +/* Copyright 1996-2001, 2003, 2004, 2006, 2009, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -129,7 +129,7 @@ FT_BEGIN_HEADER /* */ /* Even though it is possible to create several size objects for a */ /* given face (see @FT_New_Size for details), functions like */ - /* @FT_Load_Glyph or @FT_Load_Char only use the one which has been */ + /* @FT_Load_Glyph or @FT_Load_Char only use the one that has been */ /* activated last to determine the `current character pixel size'. */ /* */ /* This function can be used to `activate' a previously created size */ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftsnames.h b/reactos/lib/3rdparty/freetype/include/ftsnames.h similarity index 98% rename from reactos/lib/3rdparty/freetype/include/freetype/ftsnames.h rename to reactos/lib/3rdparty/freetype/include/ftsnames.h index 485e4e162e7..88af440356c 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftsnames.h +++ b/reactos/lib/3rdparty/freetype/include/ftsnames.h @@ -7,7 +7,7 @@ /* */ /* This is _not_ used to retrieve glyph names! */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2006, 2009, 2010 by */ +/* Copyright 1996-2003, 2006, 2009, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -169,7 +169,7 @@ FT_BEGIN_HEADER * A constant used as the tag of @FT_Parameter structures to make * FT_Open_Face() ignore preferred family subfamily names in `name' * table since OpenType version 1.4. For backwards compatibility with - * legacy systems which has 4-face-per-family restriction. + * legacy systems that have a 4-face-per-family restriction. * */ #define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY FT_MAKE_TAG( 'i', 'g', 'p', 'f' ) @@ -184,7 +184,7 @@ FT_BEGIN_HEADER * A constant used as the tag of @FT_Parameter structures to make * FT_Open_Face() ignore preferred subfamily names in `name' table since * OpenType version 1.4. For backwards compatibility with legacy - * systems which has 4-face-per-family restriction. + * systems that have a 4-face-per-family restriction. * */ #define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY FT_MAKE_TAG( 'i', 'g', 'p', 's' ) diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftstroke.h b/reactos/lib/3rdparty/freetype/include/ftstroke.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/ftstroke.h rename to reactos/lib/3rdparty/freetype/include/ftstroke.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftsynth.h b/reactos/lib/3rdparty/freetype/include/ftsynth.h similarity index 96% rename from reactos/lib/3rdparty/freetype/include/freetype/ftsynth.h rename to reactos/lib/3rdparty/freetype/include/ftsynth.h index 2074503cf60..839ab5e4002 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftsynth.h +++ b/reactos/lib/3rdparty/freetype/include/ftsynth.h @@ -5,7 +5,7 @@ /* FreeType synthesizing code for emboldening and slanting */ /* (specification). */ /* */ -/* Copyright 2000-2001, 2003, 2006, 2008, 2012 by */ +/* Copyright 2000-2001, 2003, 2006, 2008, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -37,7 +37,7 @@ /* Main reason for not lifting the functions in this module to a */ /* `standard' API is that the used parameters for emboldening and */ /* slanting are not configurable. Consider the functions as a */ - /* code resource which should be copied into the application and */ + /* code resource that should be copied into the application and */ /* adapted to the particular needs. */ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftsystem.h b/reactos/lib/3rdparty/freetype/include/ftsystem.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/ftsystem.h rename to reactos/lib/3rdparty/freetype/include/ftsystem.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/fttrigon.h b/reactos/lib/3rdparty/freetype/include/fttrigon.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/fttrigon.h rename to reactos/lib/3rdparty/freetype/include/fttrigon.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftttdrv.h b/reactos/lib/3rdparty/freetype/include/ftttdrv.h similarity index 85% rename from reactos/lib/3rdparty/freetype/include/freetype/ftttdrv.h rename to reactos/lib/3rdparty/freetype/include/ftttdrv.h index d5d3f1ccc18..70ad3d583b3 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftttdrv.h +++ b/reactos/lib/3rdparty/freetype/include/ftttdrv.h @@ -61,7 +61,7 @@ FT_BEGIN_HEADER * interpreter-version * * @description: - * Currently, two versions are available which represent the bytecode + * Currently, two versions are available, representing the bytecode * interpreter with and without subpixel hinting support, * respectively. The default is subpixel support if * TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined, and no subpixel @@ -134,6 +134,26 @@ FT_BEGIN_HEADER * FT_CONFIG_OPTION_SUBPIXEL_HINTING, selecting version~38 causes an * `FT_Err_Unimplemented_Feature' error. * + * Depending on the graphics framework, Microsoft uses different + * bytecode engines. As a consequence, the version numbers returned by + * a call to the `GETINFO[1]' bytecode instruction are more convoluted + * than desired. + * + * { + * framework Windows version result of GETINFO[1] + * ---------------------------------------------------- + * GDI before XP 35 + * GDI XP and later 37 + * GDI+ old before Vista 37 + * GDI+ old Vista, 7 38 + * GDI+ after 7 40 + * DWrite before 8 39 + * DWrite 8 and later 40 + * } + * + * Since FreeType doesn't provide all capabilities of DWrite ClearType, + * using version~38 seems justified. + * */ #define TT_INTERPRETER_VERSION_35 35 #define TT_INTERPRETER_VERSION_38 38 diff --git a/reactos/lib/3rdparty/freetype/include/freetype/fttypes.h b/reactos/lib/3rdparty/freetype/include/fttypes.h similarity index 99% rename from reactos/lib/3rdparty/freetype/include/freetype/fttypes.h rename to reactos/lib/3rdparty/freetype/include/fttypes.h index 027e59ce115..bd944a4935f 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/fttypes.h +++ b/reactos/lib/3rdparty/freetype/include/fttypes.h @@ -418,7 +418,7 @@ FT_BEGIN_HEADER /* details of usage. */ /* */ /* */ - /* The address of the FreeType object which is under finalization. */ + /* The address of the FreeType object that is under finalization. */ /* Its client data is accessed through its `generic' field. */ /* */ typedef void (*FT_Generic_Finalizer)(void* object); @@ -466,8 +466,8 @@ FT_BEGIN_HEADER /* FT_MAKE_TAG */ /* */ /* */ - /* This macro converts four-letter tags which are used to label */ - /* TrueType tables into an unsigned long to be used within FreeType. */ + /* This macro converts four-letter tags that are used to label */ + /* TrueType tables into an unsigned long, to be used within FreeType. */ /* */ /* */ /* The produced values *must* be 32-bit integers. Don't redefine */ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftwinfnt.h b/reactos/lib/3rdparty/freetype/include/ftwinfnt.h similarity index 97% rename from reactos/lib/3rdparty/freetype/include/freetype/ftwinfnt.h rename to reactos/lib/3rdparty/freetype/include/ftwinfnt.h index ea33353536e..0b673517914 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftwinfnt.h +++ b/reactos/lib/3rdparty/freetype/include/ftwinfnt.h @@ -58,9 +58,10 @@ FT_BEGIN_HEADER * @description: * A list of valid values for the `charset' byte in * @FT_WinFNT_HeaderRec. Exact mapping tables for the various cpXXXX - * encodings (except for cp1361) can be found at ftp://ftp.unicode.org - * in the MAPPINGS/VENDORS/MICSFT/WINDOWS subdirectory. cp1361 is - * roughly a superset of MAPPINGS/OBSOLETE/EASTASIA/KSC/JOHAB.TXT. + * encodings (except for cp1361) can be found at + * ftp://ftp.unicode.org/public in the MAPPINGS/VENDORS/MICSFT/WINDOWS + * subdirectory. cp1361 is roughly a superset of + * MAPPINGS/OBSOLETE/EASTASIA/KSC/JOHAB.TXT. * * @values: * FT_WinFNT_ID_DEFAULT :: diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ftxf86.h b/reactos/lib/3rdparty/freetype/include/ftxf86.h similarity index 96% rename from reactos/lib/3rdparty/freetype/include/freetype/ftxf86.h rename to reactos/lib/3rdparty/freetype/include/ftxf86.h index 8c68afdcc58..493cccdd0a5 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ftxf86.h +++ b/reactos/lib/3rdparty/freetype/include/ftxf86.h @@ -4,7 +4,7 @@ /* */ /* Support functions for X11. */ /* */ -/* Copyright 2002, 2003, 2004, 2006, 2007 by */ +/* Copyright 2002-2004, 2006, 2007, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -62,7 +62,7 @@ FT_BEGIN_HEADER /* */ /* */ /* Return a string describing the format of a given face, using values */ - /* which can be used as an X11 FONT_PROPERTY. Possible values are */ + /* that can be used as an X11 FONT_PROPERTY. Possible values are */ /* `TrueType', `Type~1', `BDF', `PCF', `Type~42', `CID~Type~1', `CFF', */ /* `PFR', and `Windows~FNT'. */ /* */ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/autohint.h b/reactos/lib/3rdparty/freetype/include/internal/autohint.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/autohint.h rename to reactos/lib/3rdparty/freetype/include/internal/autohint.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/ftcalc.h b/reactos/lib/3rdparty/freetype/include/internal/ftcalc.h similarity index 98% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/ftcalc.h rename to reactos/lib/3rdparty/freetype/include/internal/ftcalc.h index faac3a38675..03bd68eb108 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/internal/ftcalc.h +++ b/reactos/lib/3rdparty/freetype/include/internal/ftcalc.h @@ -27,10 +27,12 @@ FT_BEGIN_HEADER +#if 0 + /*************************************************************************/ /* */ /* */ - /* FT_FixedSqrt */ + /* FT_SqrtFixed */ /* */ /* */ /* Computes the square root of a 16.16 fixed-point value. */ @@ -47,6 +49,8 @@ FT_BEGIN_HEADER FT_BASE( FT_Int32 ) FT_SqrtFixed( FT_Int32 x ); +#endif /* 0 */ + /*************************************************************************/ /* */ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/ftdebug.h b/reactos/lib/3rdparty/freetype/include/internal/ftdebug.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/ftdebug.h rename to reactos/lib/3rdparty/freetype/include/internal/ftdebug.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/ftdriver.h b/reactos/lib/3rdparty/freetype/include/internal/ftdriver.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/ftdriver.h rename to reactos/lib/3rdparty/freetype/include/internal/ftdriver.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/ftgloadr.h b/reactos/lib/3rdparty/freetype/include/internal/ftgloadr.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/ftgloadr.h rename to reactos/lib/3rdparty/freetype/include/internal/ftgloadr.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/ftmemory.h b/reactos/lib/3rdparty/freetype/include/internal/ftmemory.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/ftmemory.h rename to reactos/lib/3rdparty/freetype/include/internal/ftmemory.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/ftobjs.h b/reactos/lib/3rdparty/freetype/include/internal/ftobjs.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/ftobjs.h rename to reactos/lib/3rdparty/freetype/include/internal/ftobjs.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/ftpic.h b/reactos/lib/3rdparty/freetype/include/internal/ftpic.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/ftpic.h rename to reactos/lib/3rdparty/freetype/include/internal/ftpic.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/ftrfork.h b/reactos/lib/3rdparty/freetype/include/internal/ftrfork.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/ftrfork.h rename to reactos/lib/3rdparty/freetype/include/internal/ftrfork.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/ftserv.h b/reactos/lib/3rdparty/freetype/include/internal/ftserv.h similarity index 96% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/ftserv.h rename to reactos/lib/3rdparty/freetype/include/internal/ftserv.h index cd5fbd0fac6..1203ec8121a 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/internal/ftserv.h +++ b/reactos/lib/3rdparty/freetype/include/internal/ftserv.h @@ -734,24 +734,24 @@ FT_BEGIN_HEADER * The header files containing the services. */ -#define FT_SERVICE_BDF_H -#define FT_SERVICE_CID_H -#define FT_SERVICE_GLYPH_DICT_H -#define FT_SERVICE_GX_VALIDATE_H -#define FT_SERVICE_KERNING_H -#define FT_SERVICE_MULTIPLE_MASTERS_H -#define FT_SERVICE_OPENTYPE_VALIDATE_H -#define FT_SERVICE_PFR_H -#define FT_SERVICE_POSTSCRIPT_CMAPS_H -#define FT_SERVICE_POSTSCRIPT_INFO_H -#define FT_SERVICE_POSTSCRIPT_NAME_H -#define FT_SERVICE_PROPERTIES_H -#define FT_SERVICE_SFNT_H -#define FT_SERVICE_TRUETYPE_ENGINE_H -#define FT_SERVICE_TT_CMAP_H -#define FT_SERVICE_WINFNT_H -#define FT_SERVICE_XFREE86_NAME_H -#define FT_SERVICE_TRUETYPE_GLYF_H +#define FT_SERVICE_BDF_H +#define FT_SERVICE_CID_H +#define FT_SERVICE_GLYPH_DICT_H +#define FT_SERVICE_GX_VALIDATE_H +#define FT_SERVICE_KERNING_H +#define FT_SERVICE_MULTIPLE_MASTERS_H +#define FT_SERVICE_OPENTYPE_VALIDATE_H +#define FT_SERVICE_PFR_H +#define FT_SERVICE_POSTSCRIPT_CMAPS_H +#define FT_SERVICE_POSTSCRIPT_INFO_H +#define FT_SERVICE_POSTSCRIPT_NAME_H +#define FT_SERVICE_PROPERTIES_H +#define FT_SERVICE_SFNT_H +#define FT_SERVICE_TRUETYPE_ENGINE_H +#define FT_SERVICE_TT_CMAP_H +#define FT_SERVICE_WINFNT_H +#define FT_SERVICE_XFREE86_NAME_H +#define FT_SERVICE_TRUETYPE_GLYF_H /* */ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/ftstream.h b/reactos/lib/3rdparty/freetype/include/internal/ftstream.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/ftstream.h rename to reactos/lib/3rdparty/freetype/include/internal/ftstream.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/fttrace.h b/reactos/lib/3rdparty/freetype/include/internal/fttrace.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/fttrace.h rename to reactos/lib/3rdparty/freetype/include/internal/fttrace.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/ftvalid.h b/reactos/lib/3rdparty/freetype/include/internal/ftvalid.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/ftvalid.h rename to reactos/lib/3rdparty/freetype/include/internal/ftvalid.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/internal.h b/reactos/lib/3rdparty/freetype/include/internal/internal.h similarity index 61% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/internal.h rename to reactos/lib/3rdparty/freetype/include/internal/internal.h index 262afcfa8ae..e0ddb06b708 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/internal/internal.h +++ b/reactos/lib/3rdparty/freetype/include/internal/internal.h @@ -24,28 +24,28 @@ /*************************************************************************/ -#define FT_INTERNAL_OBJECTS_H -#define FT_INTERNAL_PIC_H -#define FT_INTERNAL_STREAM_H -#define FT_INTERNAL_MEMORY_H -#define FT_INTERNAL_DEBUG_H -#define FT_INTERNAL_CALC_H -#define FT_INTERNAL_DRIVER_H -#define FT_INTERNAL_TRACE_H -#define FT_INTERNAL_GLYPH_LOADER_H -#define FT_INTERNAL_SFNT_H -#define FT_INTERNAL_SERVICE_H -#define FT_INTERNAL_RFORK_H -#define FT_INTERNAL_VALIDATE_H +#define FT_INTERNAL_OBJECTS_H +#define FT_INTERNAL_PIC_H +#define FT_INTERNAL_STREAM_H +#define FT_INTERNAL_MEMORY_H +#define FT_INTERNAL_DEBUG_H +#define FT_INTERNAL_CALC_H +#define FT_INTERNAL_DRIVER_H +#define FT_INTERNAL_TRACE_H +#define FT_INTERNAL_GLYPH_LOADER_H +#define FT_INTERNAL_SFNT_H +#define FT_INTERNAL_SERVICE_H +#define FT_INTERNAL_RFORK_H +#define FT_INTERNAL_VALIDATE_H -#define FT_INTERNAL_TRUETYPE_TYPES_H -#define FT_INTERNAL_TYPE1_TYPES_H +#define FT_INTERNAL_TRUETYPE_TYPES_H +#define FT_INTERNAL_TYPE1_TYPES_H -#define FT_INTERNAL_POSTSCRIPT_AUX_H -#define FT_INTERNAL_POSTSCRIPT_HINTS_H -#define FT_INTERNAL_POSTSCRIPT_GLOBALS_H +#define FT_INTERNAL_POSTSCRIPT_AUX_H +#define FT_INTERNAL_POSTSCRIPT_HINTS_H +#define FT_INTERNAL_POSTSCRIPT_GLOBALS_H -#define FT_INTERNAL_AUTOHINT_H +#define FT_INTERNAL_AUTOHINT_H #if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/psaux.h b/reactos/lib/3rdparty/freetype/include/internal/psaux.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/psaux.h rename to reactos/lib/3rdparty/freetype/include/internal/psaux.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/pshints.h b/reactos/lib/3rdparty/freetype/include/internal/pshints.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/pshints.h rename to reactos/lib/3rdparty/freetype/include/internal/pshints.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svbdf.h b/reactos/lib/3rdparty/freetype/include/internal/services/svbdf.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/services/svbdf.h rename to reactos/lib/3rdparty/freetype/include/internal/services/svbdf.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svcid.h b/reactos/lib/3rdparty/freetype/include/internal/services/svcid.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/services/svcid.h rename to reactos/lib/3rdparty/freetype/include/internal/services/svcid.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svgldict.h b/reactos/lib/3rdparty/freetype/include/internal/services/svgldict.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/services/svgldict.h rename to reactos/lib/3rdparty/freetype/include/internal/services/svgldict.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svgxval.h b/reactos/lib/3rdparty/freetype/include/internal/services/svgxval.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/services/svgxval.h rename to reactos/lib/3rdparty/freetype/include/internal/services/svgxval.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svkern.h b/reactos/lib/3rdparty/freetype/include/internal/services/svkern.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/services/svkern.h rename to reactos/lib/3rdparty/freetype/include/internal/services/svkern.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svmm.h b/reactos/lib/3rdparty/freetype/include/internal/services/svmm.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/services/svmm.h rename to reactos/lib/3rdparty/freetype/include/internal/services/svmm.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svotval.h b/reactos/lib/3rdparty/freetype/include/internal/services/svotval.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/services/svotval.h rename to reactos/lib/3rdparty/freetype/include/internal/services/svotval.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svpfr.h b/reactos/lib/3rdparty/freetype/include/internal/services/svpfr.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/services/svpfr.h rename to reactos/lib/3rdparty/freetype/include/internal/services/svpfr.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svpostnm.h b/reactos/lib/3rdparty/freetype/include/internal/services/svpostnm.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/services/svpostnm.h rename to reactos/lib/3rdparty/freetype/include/internal/services/svpostnm.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svprop.h b/reactos/lib/3rdparty/freetype/include/internal/services/svprop.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/services/svprop.h rename to reactos/lib/3rdparty/freetype/include/internal/services/svprop.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svpscmap.h b/reactos/lib/3rdparty/freetype/include/internal/services/svpscmap.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/services/svpscmap.h rename to reactos/lib/3rdparty/freetype/include/internal/services/svpscmap.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svpsinfo.h b/reactos/lib/3rdparty/freetype/include/internal/services/svpsinfo.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/services/svpsinfo.h rename to reactos/lib/3rdparty/freetype/include/internal/services/svpsinfo.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svsfnt.h b/reactos/lib/3rdparty/freetype/include/internal/services/svsfnt.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/services/svsfnt.h rename to reactos/lib/3rdparty/freetype/include/internal/services/svsfnt.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svttcmap.h b/reactos/lib/3rdparty/freetype/include/internal/services/svttcmap.h similarity index 97% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/services/svttcmap.h rename to reactos/lib/3rdparty/freetype/include/internal/services/svttcmap.h index 83994aaf8ae..4370f4c2d82 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svttcmap.h +++ b/reactos/lib/3rdparty/freetype/include/internal/services/svttcmap.h @@ -7,7 +7,7 @@ /* Copyright 2003 by */ /* Masatake YAMATO, Redhat K.K. */ /* */ -/* Copyright 2003, 2008, 2009, 2012 by */ +/* Copyright 2003, 2008, 2009, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -47,7 +47,7 @@ FT_BEGIN_HEADER /* */ /* language :: */ /* The language ID used in Mac fonts. Definitions of values are in */ - /* freetype/ttnameid.h. */ + /* `ttnameid.h'. */ /* */ /* format :: */ /* The cmap format. OpenType 1.5 defines the formats 0 (byte */ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svtteng.h b/reactos/lib/3rdparty/freetype/include/internal/services/svtteng.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/services/svtteng.h rename to reactos/lib/3rdparty/freetype/include/internal/services/svtteng.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svttglyf.h b/reactos/lib/3rdparty/freetype/include/internal/services/svttglyf.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/services/svttglyf.h rename to reactos/lib/3rdparty/freetype/include/internal/services/svttglyf.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svwinfnt.h b/reactos/lib/3rdparty/freetype/include/internal/services/svwinfnt.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/services/svwinfnt.h rename to reactos/lib/3rdparty/freetype/include/internal/services/svwinfnt.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/services/svxf86nm.h b/reactos/lib/3rdparty/freetype/include/internal/services/svxf86nm.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/services/svxf86nm.h rename to reactos/lib/3rdparty/freetype/include/internal/services/svxf86nm.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/sfnt.h b/reactos/lib/3rdparty/freetype/include/internal/sfnt.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/sfnt.h rename to reactos/lib/3rdparty/freetype/include/internal/sfnt.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/t1types.h b/reactos/lib/3rdparty/freetype/include/internal/t1types.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/t1types.h rename to reactos/lib/3rdparty/freetype/include/internal/t1types.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/internal/tttypes.h b/reactos/lib/3rdparty/freetype/include/internal/tttypes.h similarity index 94% rename from reactos/lib/3rdparty/freetype/include/freetype/internal/tttypes.h rename to reactos/lib/3rdparty/freetype/include/internal/tttypes.h index 1bbfe499c5b..ad302b87c88 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/internal/tttypes.h +++ b/reactos/lib/3rdparty/freetype/include/internal/tttypes.h @@ -137,6 +137,75 @@ FT_BEGIN_HEADER } TT_TableRec, *TT_Table; + /*************************************************************************/ + /* */ + /* */ + /* WOFF_HeaderRec */ + /* */ + /* */ + /* WOFF file format header. */ + /* */ + /* */ + /* See */ + /* */ + /* http://www.w3.org/TR/WOFF/#WOFFHeader */ + /* */ + typedef struct WOFF_HeaderRec_ + { + FT_ULong signature; + FT_ULong flavor; + FT_ULong length; + FT_UShort num_tables; + FT_UShort reserved; + FT_ULong totalSfntSize; + FT_UShort majorVersion; + FT_UShort minorVersion; + FT_ULong metaOffset; + FT_ULong metaLength; + FT_ULong metaOrigLength; + FT_ULong privOffset; + FT_ULong privLength; + + } WOFF_HeaderRec, *WOFF_Header; + + + /*************************************************************************/ + /* */ + /* */ + /* WOFF_TableRec */ + /* */ + /* */ + /* This structure describes a given table of a WOFF font. */ + /* */ + /* */ + /* Tag :: A four-bytes tag describing the table. */ + /* */ + /* Offset :: The offset of the table from the start of the WOFF */ + /* font in its resource. */ + /* */ + /* CompLength :: Compressed table length (in bytes). */ + /* */ + /* OrigLength :: Unompressed table length (in bytes). */ + /* */ + /* CheckSum :: The table checksum. This value can be ignored. */ + /* */ + /* OrigOffset :: The uncompressed table file offset. This value gets */ + /* computed while constructing the (uncompressed) SFNT */ + /* header. It is not contained in the WOFF file. */ + /* */ + typedef struct WOFF_TableRec_ + { + FT_ULong Tag; /* table ID */ + FT_ULong Offset; /* table file offset */ + FT_ULong CompLength; /* compressed table length */ + FT_ULong OrigLength; /* uncompressed table length */ + FT_ULong CheckSum; /* uncompressed checksum */ + + FT_ULong OrigOffset; /* uncompressed table file offset */ + /* (not in the WOFF file) */ + } WOFF_TableRec, *WOFF_Table; + + /*************************************************************************/ /* */ /* */ @@ -353,16 +422,16 @@ FT_BEGIN_HEADER /* */ typedef struct TT_SBit_MetricsRec_ { - FT_Byte height; - FT_Byte width; + FT_UShort height; + FT_UShort width; - FT_Char horiBearingX; - FT_Char horiBearingY; - FT_Byte horiAdvance; + FT_Short horiBearingX; + FT_Short horiBearingY; + FT_UShort horiAdvance; - FT_Char vertBearingX; - FT_Char vertBearingY; - FT_Byte vertAdvance; + FT_Short vertBearingX; + FT_Short vertBearingY; + FT_UShort vertAdvance; } TT_SBit_MetricsRec, *TT_SBit_Metrics; @@ -979,6 +1048,20 @@ FT_BEGIN_HEADER (*TT_Loader_EndGlyphFunc)( TT_Loader loader ); + typedef enum TT_SbitTableType_ + { + TT_SBIT_TABLE_TYPE_NONE = 0, + TT_SBIT_TABLE_TYPE_EBLC, /* `EBLC' (Microsoft), */ + /* `bloc' (Apple) */ + TT_SBIT_TABLE_TYPE_CBLC, /* `CBLC' (Google) */ + TT_SBIT_TABLE_TYPE_SBIX, /* `sbix' (Apple) */ + + /* do not remove */ + TT_SBIT_TABLE_TYPE_MAX + + } TT_SbitTableType; + + /*************************************************************************/ /* */ /* TrueType Face Type */ @@ -1090,13 +1173,6 @@ FT_BEGIN_HEADER /* */ /* pclt :: The `pclt' SFNT table. */ /* */ - /* num_sbit_strikes :: The number of sbit strikes, i.e., bitmap */ - /* sizes, embedded in this font. */ - /* */ - /* sbit_strikes :: An array of sbit strikes embedded in this */ - /* font. This table is optional in a */ - /* TrueType/OpenType font. */ - /* */ /* num_sbit_scales :: The number of sbit scales for this font. */ /* */ /* sbit_scales :: Array of sbit scales embedded in this */ @@ -1302,6 +1378,7 @@ FT_BEGIN_HEADER FT_Byte* sbit_table; FT_ULong sbit_table_size; + TT_SbitTableType sbit_table_type; FT_UInt sbit_num_strikes; FT_Byte* kern_table; @@ -1402,7 +1479,6 @@ FT_BEGIN_HEADER FT_Int advance; FT_Int linear; FT_Bool linear_def; - FT_Bool preserve_pps; FT_Vector pp1; FT_Vector pp2; diff --git a/reactos/lib/3rdparty/freetype/include/freetype/t1tables.h b/reactos/lib/3rdparty/freetype/include/t1tables.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/t1tables.h rename to reactos/lib/3rdparty/freetype/include/t1tables.h diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ttnameid.h b/reactos/lib/3rdparty/freetype/include/ttnameid.h similarity index 99% rename from reactos/lib/3rdparty/freetype/include/freetype/ttnameid.h rename to reactos/lib/3rdparty/freetype/include/ttnameid.h index 173f88c9507..9711d1d9475 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/ttnameid.h +++ b/reactos/lib/3rdparty/freetype/include/ttnameid.h @@ -4,7 +4,7 @@ /* */ /* TrueType name ID definitions (specification only). */ /* */ -/* Copyright 1996-2004, 2006-2008, 2012 by */ +/* Copyright 1996-2004, 2006-2008, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -1208,7 +1208,7 @@ FT_BEGIN_HEADER /* */ /* Here some alias #defines in order to be clearer. */ /* */ - /* These are not always #defined to stay within the 31~character limit */ + /* These are not always #defined to stay within the 31~character limit, */ /* which some compilers have. */ /* */ /* Credits go to Dave Hoo for pointing out that modern */ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/tttables.h b/reactos/lib/3rdparty/freetype/include/tttables.h similarity index 97% rename from reactos/lib/3rdparty/freetype/include/freetype/tttables.h rename to reactos/lib/3rdparty/freetype/include/tttables.h index fe07117b0b4..bb49dc0dafd 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/tttables.h +++ b/reactos/lib/3rdparty/freetype/include/tttables.h @@ -5,7 +5,7 @@ /* Basic SFNT/TrueType tables definitions and interface */ /* (specification only). */ /* */ -/* Copyright 1996-2005, 2008-2012 by */ +/* Copyright 1996-2005, 2008-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -170,8 +170,8 @@ FT_BEGIN_HEADER /* */ /* */ /* IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should */ - /* be identical except for the names of their fields which */ - /* are different. */ + /* be identical except for the names of their fields, */ + /* which are different. */ /* */ /* This ensures that a single function in the `ttload' */ /* module is able to read both the horizontal and vertical */ @@ -296,8 +296,8 @@ FT_BEGIN_HEADER /* */ /* */ /* IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should */ - /* be identical except for the names of their fields which */ - /* are different. */ + /* be identical except for the names of their fields, */ + /* which are different. */ /* */ /* This ensures that a single function in the `ttload' */ /* module is able to read both the horizontal and vertical */ @@ -340,12 +340,11 @@ FT_BEGIN_HEADER /* TT_OS2 */ /* */ /* */ - /* A structure used to model a TrueType OS/2 table. This is the long */ - /* table version. All fields comply to the TrueType specification. */ + /* A structure used to model a TrueType OS/2 table. All fields */ + /* comply to the OpenType specification. */ /* */ - /* Note that we now support old Mac fonts which do not include an */ - /* OS/2 table. In this case, the `version' field is always set to */ - /* 0xFFFF. */ + /* Note that we now support old Mac fonts that do not include an OS/2 */ + /* table. In this case, the `version' field is always set to 0xFFFF. */ /* */ typedef struct TT_OS2_ { @@ -384,12 +383,12 @@ FT_BEGIN_HEADER FT_UShort usWinAscent; FT_UShort usWinDescent; - /* only version 1 tables: */ + /* only version 1 and higher: */ FT_ULong ulCodePageRange1; /* Bits 0-31 */ FT_ULong ulCodePageRange2; /* Bits 32-63 */ - /* only version 2 tables: */ + /* only version 2 and higher: */ FT_Short sxHeight; FT_Short sCapHeight; @@ -397,6 +396,11 @@ FT_BEGIN_HEADER FT_UShort usBreakChar; FT_UShort usMaxContext; + /* only version 5 and higher: */ + + FT_UShort usLowerOpticalPointSize; /* in twips (1/20th points) */ + FT_UShort usUpperOpticalPointSize; /* in twips (1/20th points) */ + } TT_OS2; @@ -465,7 +469,7 @@ FT_BEGIN_HEADER /* TT_MaxProfile */ /* */ /* */ - /* The maximum profile is a table containing many max values which */ + /* The maximum profile is a table containing many max values, which */ /* can be used to pre-allocate arrays. This ensures that no memory */ /* allocation occurs during a glyph load. */ /* */ @@ -672,6 +676,12 @@ FT_BEGIN_HEADER * error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length ); * if ( error ) { ... could not load table ... } * } + * + * Note that structures like @TT_Header or @TT_OS2 can't be used with + * this function; they are limited to @FT_Get_Sfnt_Table. Reason is that + * those structures depend on the processor architecture, with varying + * size (e.g. 32bit vs. 64bit) or order (big endian vs. little endian). + * */ FT_EXPORT( FT_Error ) FT_Load_Sfnt_Table( FT_Face face, @@ -730,7 +740,7 @@ FT_BEGIN_HEADER /* */ /* */ /* Return TrueType/sfnt specific cmap language ID. Definitions of */ - /* language ID values are in `freetype/ttnameid.h'. */ + /* language ID values are in `ttnameid.h'. */ /* */ /* */ /* charmap :: */ diff --git a/reactos/lib/3rdparty/freetype/include/freetype/tttags.h b/reactos/lib/3rdparty/freetype/include/tttags.h similarity index 97% rename from reactos/lib/3rdparty/freetype/include/freetype/tttags.h rename to reactos/lib/3rdparty/freetype/include/tttags.h index be8c524edb8..d59aa19a338 100644 --- a/reactos/lib/3rdparty/freetype/include/freetype/tttags.h +++ b/reactos/lib/3rdparty/freetype/include/tttags.h @@ -88,6 +88,7 @@ FT_BEGIN_HEADER #define TTAG_post FT_MAKE_TAG( 'p', 'o', 's', 't' ) #define TTAG_prep FT_MAKE_TAG( 'p', 'r', 'e', 'p' ) #define TTAG_prop FT_MAKE_TAG( 'p', 'r', 'o', 'p' ) +#define TTAG_sbix FT_MAKE_TAG( 's', 'b', 'i', 'x' ) #define TTAG_sfnt FT_MAKE_TAG( 's', 'f', 'n', 't' ) #define TTAG_SING FT_MAKE_TAG( 'S', 'I', 'N', 'G' ) #define TTAG_trak FT_MAKE_TAG( 't', 'r', 'a', 'k' ) @@ -99,6 +100,7 @@ FT_BEGIN_HEADER #define TTAG_VDMX FT_MAKE_TAG( 'V', 'D', 'M', 'X' ) #define TTAG_vhea FT_MAKE_TAG( 'v', 'h', 'e', 'a' ) #define TTAG_vmtx FT_MAKE_TAG( 'v', 'm', 't', 'x' ) +#define TTAG_wOFF FT_MAKE_TAG( 'w', 'O', 'F', 'F' ) FT_END_HEADER diff --git a/reactos/lib/3rdparty/freetype/include/freetype/ttunpat.h b/reactos/lib/3rdparty/freetype/include/ttunpat.h similarity index 100% rename from reactos/lib/3rdparty/freetype/include/freetype/ttunpat.h rename to reactos/lib/3rdparty/freetype/include/ttunpat.h diff --git a/reactos/lib/3rdparty/freetype/modules.cfg b/reactos/lib/3rdparty/freetype/modules.cfg index a85378ee7ce..4e5259445fb 100644 --- a/reactos/lib/3rdparty/freetype/modules.cfg +++ b/reactos/lib/3rdparty/freetype/modules.cfg @@ -1,6 +1,6 @@ # modules.cfg # -# Copyright 2005-2007, 2009-2011 by +# Copyright 2005-2007, 2009-2011, 2013 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -19,7 +19,7 @@ # activate a module, remove the comment character. # # Note that many modules and components are further controlled with macros -# in the file `include/freetype/config/ftoption.h'. +# in the file `include/config/ftoption.h'. #### @@ -85,7 +85,7 @@ HINTING_MODULES += autofit HINTING_MODULES += pshinter # The TrueType hinting engine doesn't have a module of its own but is -# controlled in file include/freetype/config/ftoption.h +# controlled in file include/config/ftoption.h # (TT_CONFIG_OPTION_BYTECODE_INTERPRETER and friends). @@ -106,7 +106,7 @@ RASTER_MODULES += smooth # FreeType's cache sub-system (quite stable but still in beta -- this means # that its public API is subject to change if necessary). See -# include/freetype/ftcache.h. Needs ftglyph.c. +# include/ftcache.h. Needs ftglyph.c. AUX_MODULES += cache # TrueType GX/AAT table validation. Needs ftgxval.c below. @@ -114,17 +114,17 @@ AUX_MODULES += cache # Support for streams compressed with gzip (files with suffix .gz). # -# See include/freetype/ftgzip.h for the API. +# See include/ftgzip.h for the API. AUX_MODULES += gzip # Support for streams compressed with LZW (files with suffix .Z). # -# See include/freetype/ftlzw.h for the API. +# See include/ftlzw.h for the API. AUX_MODULES += lzw # Support for streams compressed with bzip2 (files with suffix .bz2). # -# See include/freetype/ftbzip2.h for the API. +# See include/ftbzip2.h for the API. AUX_MODULES += bzip2 # OpenType table validation. Needs ftotval.c below. @@ -149,95 +149,95 @@ AUX_MODULES += psnames # Exact bounding box calculation. # -# See include/freetype/ftbbox.h for the API. +# See include/ftbbox.h for the API. BASE_EXTENSIONS += ftbbox.c # Access BDF-specific strings. Needs BDF font driver. # -# See include/freetype/ftbdf.h for the API. +# See include/ftbdf.h for the API. BASE_EXTENSIONS += ftbdf.c # Utility functions for converting 1bpp, 2bpp, 4bpp, and 8bpp bitmaps into # 8bpp format, and for emboldening of bitmap glyphs. # -# See include/freetype/ftbitmap.h for the API. +# See include/ftbitmap.h for the API. BASE_EXTENSIONS += ftbitmap.c # Access CID font information. # -# See include/freetype/ftcid.h for the API. +# See include/ftcid.h for the API. BASE_EXTENSIONS += ftcid.c # Access FSType information. Needs fttype1.c. # -# See include/freetype/freetype.h for the API. +# See include/freetype.h for the API. BASE_EXTENSIONS += ftfstype.c # Support for GASP table queries. # -# See include/freetype/ftgasp.h for the API. +# See include/ftgasp.h for the API. BASE_EXTENSIONS += ftgasp.c # Convenience functions to handle glyphs. Needs ftbitmap.c. # -# See include/freetype/ftglyph.h for the API. +# See include/ftglyph.h for the API. BASE_EXTENSIONS += ftglyph.c # Interface for gxvalid module. # -# See include/freetype/ftgxval.h for the API. +# See include/ftgxval.h for the API. BASE_EXTENSIONS += ftgxval.c # Support for LCD color filtering of subpixel bitmaps. # -# See include/freetype/ftlcdfil.h for the API. +# See include/ftlcdfil.h for the API. BASE_EXTENSIONS += ftlcdfil.c # Multiple Master font interface. # -# See include/freetype/ftmm.h for the API. +# See include/ftmm.h for the API. BASE_EXTENSIONS += ftmm.c # Interface for otvalid module. # -# See include/freetype/ftotval.h for the API. +# See include/ftotval.h for the API. BASE_EXTENSIONS += ftotval.c # Support for FT_Face_CheckTrueTypePatents. # -# See include/freetype/freetype.h for the API. +# See include/freetype.h for the API. BASE_EXTENSIONS += ftpatent.c # Interface for accessing PFR-specific data. Needs PFR font driver. # -# See include/freetype/ftpfr.h for the API. +# See include/ftpfr.h for the API. BASE_EXTENSIONS += ftpfr.c # Path stroker. Needs ftglyph.c. # -# See include/freetype/ftstroke.h for the API. +# See include/ftstroke.h for the API. BASE_EXTENSIONS += ftstroke.c # Support for synthetic embolding and slanting of fonts. Needs ftbitmap.c. # -# See include/freetype/ftsynth.h for the API. +# See include/ftsynth.h for the API. BASE_EXTENSIONS += ftsynth.c # Interface to access data specific to PostScript Type 1 and Type 2 (CFF) # fonts. # -# See include/freetype/t1tables.h for the API. +# See include/t1tables.h for the API. BASE_EXTENSIONS += fttype1.c # Interface for accessing data specific to Windows FNT files. Needs winfnt # driver. # -# See include/freetype/ftwinfnt.h for the API. +# See include/ftwinfnt.h for the API. BASE_EXTENSIONS += ftwinfnt.c # Support functions for X11. # -# See include/freetype/ftxf86.h for the API. +# See include/ftxf86.h for the API. BASE_EXTENSIONS += ftxf86.c #### diff --git a/reactos/lib/3rdparty/freetype/objs/README b/reactos/lib/3rdparty/freetype/objs/README new file mode 100644 index 00000000000..befb63e0492 --- /dev/null +++ b/reactos/lib/3rdparty/freetype/objs/README @@ -0,0 +1,2 @@ +This directory contains all the object files created when building the +library. diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afblue.c b/reactos/lib/3rdparty/freetype/src/autofit/afblue.c new file mode 100644 index 00000000000..22ef6d5a87e --- /dev/null +++ b/reactos/lib/3rdparty/freetype/src/autofit/afblue.c @@ -0,0 +1,166 @@ +/* This file has been generated by the Perl script `afblue.pl', */ +/* using data from file `afblue.dat'. */ + +/***************************************************************************/ +/* */ +/* afblue.c */ +/* */ +/* Auto-fitter data for blue strings (body). */ +/* */ +/* Copyright 2013 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#include "aftypes.h" + + + FT_LOCAL_ARRAY_DEF( char ) + af_blue_strings[] = + { + /* */ + 'T', 'H', 'E', 'Z', 'O', 'C', 'Q', 'S', /* THEZOCQS */ + '\0', + 'H', 'E', 'Z', 'L', 'O', 'C', 'U', 'S', /* HEZLOCUS */ + '\0', + 'f', 'i', 'j', 'k', 'd', 'b', 'h', /* fijkdbh */ + '\0', + 'x', 'z', 'r', 'o', 'e', 's', 'c', /* xzroesc */ + '\0', + 'p', 'q', 'g', 'j', 'y', /* pqgjy */ + '\0', + '\xCE', '\x93', '\xCE', '\x92', '\xCE', '\x95', '\xCE', '\x96', '\xCE', '\x98', '\xCE', '\x9F', '\xCE', '\xA9', /* ΓΒΕΖΘΟΩ */ + '\0', + '\xCE', '\x92', '\xCE', '\x94', '\xCE', '\x96', '\xCE', '\x9E', '\xCE', '\x98', '\xCE', '\x9F', /* ΒΔΖΞΘΟ */ + '\0', + '\xCE', '\xB2', '\xCE', '\xB8', '\xCE', '\xB4', '\xCE', '\xB6', '\xCE', '\xBB', '\xCE', '\xBE', /* βθδζλξ */ + '\0', + '\xCE', '\xB1', '\xCE', '\xB5', '\xCE', '\xB9', '\xCE', '\xBF', '\xCF', '\x80', '\xCF', '\x83', '\xCF', '\x84', '\xCF', '\x89', /* αειοπστω */ + '\0', + '\xCE', '\xB2', '\xCE', '\xB3', '\xCE', '\xB7', '\xCE', '\xBC', '\xCF', '\x81', '\xCF', '\x86', '\xCF', '\x87', '\xCF', '\x88', /* βγημρφχψ */ + '\0', + '\xD0', '\x91', '\xD0', '\x92', '\xD0', '\x95', '\xD0', '\x9F', '\xD0', '\x97', '\xD0', '\x9E', '\xD0', '\xA1', '\xD0', '\xAD', /* БВЕПЗОСЭ */ + '\0', + '\xD0', '\x91', '\xD0', '\x92', '\xD0', '\x95', '\xD0', '\xA8', '\xD0', '\x97', '\xD0', '\x9E', '\xD0', '\xA1', '\xD0', '\xAD', /* БВЕШЗОСЭ */ + '\0', + '\xD1', '\x85', '\xD0', '\xBF', '\xD0', '\xBD', '\xD1', '\x88', '\xD0', '\xB5', '\xD0', '\xB7', '\xD0', '\xBE', '\xD1', '\x81', /* хпншезос */ + '\0', + '\xD1', '\x80', '\xD1', '\x83', '\xD1', '\x84', /* руф */ + '\0', + '\xD7', '\x91', '\xD7', '\x93', '\xD7', '\x94', '\xD7', '\x97', '\xD7', '\x9A', '\xD7', '\x9B', '\xD7', '\x9D', '\xD7', '\xA1', /* בדהחךכםס */ + '\0', + '\xD7', '\x91', '\xD7', '\x98', '\xD7', '\x9B', '\xD7', '\x9D', '\xD7', '\xA1', '\xD7', '\xA6', /* בטכםסצ */ + '\0', + '\xD7', '\xA7', '\xD7', '\x9A', '\xD7', '\x9F', '\xD7', '\xA3', '\xD7', '\xA5', /* קךןףץ */ +#ifdef AF_CONFIG_OPTION_CJK + '\0', + '\xE4', '\xBB', '\x96', '\xE4', '\xBB', '\xAC', '\xE4', '\xBD', '\xA0', '\xE4', '\xBE', '\x86', '\xE5', '\x80', '\x91', '\xE5', '\x88', '\xB0', '\xE5', '\x92', '\x8C', '\xE5', '\x9C', '\xB0', /* 他们你來們到和地 */ + '\xE5', '\xAF', '\xB9', '\xE5', '\xB0', '\x8D', '\xE5', '\xB0', '\xB1', '\xE5', '\xB8', '\xAD', '\xE6', '\x88', '\x91', '\xE6', '\x97', '\xB6', '\xE6', '\x99', '\x82', '\xE6', '\x9C', '\x83', /* 对對就席我时時會 */ + '\xE6', '\x9D', '\xA5', '\xE7', '\x82', '\xBA', '\xE8', '\x83', '\xBD', '\xE8', '\x88', '\xB0', '\xE8', '\xAA', '\xAA', '\xE8', '\xAF', '\xB4', '\xE8', '\xBF', '\x99', '\xE9', '\x80', '\x99', /* 来為能舰說说这這 */ + '\xE9', '\xBD', '\x8A', /* 齊 */ + '\0', + '\xE5', '\x86', '\x9B', '\xE5', '\x90', '\x8C', '\xE5', '\xB7', '\xB2', '\xE6', '\x84', '\xBF', '\xE6', '\x97', '\xA2', '\xE6', '\x98', '\x9F', '\xE6', '\x98', '\xAF', '\xE6', '\x99', '\xAF', /* 军同已愿既星是景 */ + '\xE6', '\xB0', '\x91', '\xE7', '\x85', '\xA7', '\xE7', '\x8E', '\xB0', '\xE7', '\x8F', '\xBE', '\xE7', '\x90', '\x86', '\xE7', '\x94', '\xA8', '\xE7', '\xBD', '\xAE', '\xE8', '\xA6', '\x81', /* 民照现現理用置要 */ + '\xE8', '\xBB', '\x8D', '\xE9', '\x82', '\xA3', '\xE9', '\x85', '\x8D', '\xE9', '\x87', '\x8C', '\xE9', '\x96', '\x8B', '\xE9', '\x9B', '\xB7', '\xE9', '\x9C', '\xB2', '\xE9', '\x9D', '\xA2', /* 軍那配里開雷露面 */ + '\xE9', '\xA1', '\xBE', /* 顾 */ + '\0', + '\xE4', '\xB8', '\xAA', '\xE4', '\xB8', '\xBA', '\xE4', '\xBA', '\xBA', '\xE4', '\xBB', '\x96', '\xE4', '\xBB', '\xA5', '\xE4', '\xBB', '\xAC', '\xE4', '\xBD', '\xA0', '\xE4', '\xBE', '\x86', /* 个为人他以们你來 */ + '\xE5', '\x80', '\x8B', '\xE5', '\x80', '\x91', '\xE5', '\x88', '\xB0', '\xE5', '\x92', '\x8C', '\xE5', '\xA4', '\xA7', '\xE5', '\xAF', '\xB9', '\xE5', '\xB0', '\x8D', '\xE5', '\xB0', '\xB1', /* 個們到和大对對就 */ + '\xE6', '\x88', '\x91', '\xE6', '\x97', '\xB6', '\xE6', '\x99', '\x82', '\xE6', '\x9C', '\x89', '\xE6', '\x9D', '\xA5', '\xE7', '\x82', '\xBA', '\xE8', '\xA6', '\x81', '\xE8', '\xAA', '\xAA', /* 我时時有来為要說 */ + '\xE8', '\xAF', '\xB4', /* 说 */ + '\0', + '\xE4', '\xB8', '\xBB', '\xE4', '\xBA', '\x9B', '\xE5', '\x9B', '\xA0', '\xE5', '\xAE', '\x83', '\xE6', '\x83', '\xB3', '\xE6', '\x84', '\x8F', '\xE7', '\x90', '\x86', '\xE7', '\x94', '\x9F', /* 主些因它想意理生 */ + '\xE7', '\x95', '\xB6', '\xE7', '\x9C', '\x8B', '\xE7', '\x9D', '\x80', '\xE7', '\xBD', '\xAE', '\xE8', '\x80', '\x85', '\xE8', '\x87', '\xAA', '\xE8', '\x91', '\x97', '\xE8', '\xA3', '\xA1', /* 當看着置者自著裡 */ + '\xE8', '\xBF', '\x87', '\xE8', '\xBF', '\x98', '\xE8', '\xBF', '\x9B', '\xE9', '\x80', '\xB2', '\xE9', '\x81', '\x8E', '\xE9', '\x81', '\x93', '\xE9', '\x82', '\x84', '\xE9', '\x87', '\x8C', /* 过还进進過道還里 */ + '\xE9', '\x9D', '\xA2', /* 面 */ +#ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT + '\0', + '\xE4', '\xBA', '\x9B', '\xE4', '\xBB', '\xAC', '\xE4', '\xBD', '\xA0', '\xE4', '\xBE', '\x86', '\xE5', '\x80', '\x91', '\xE5', '\x88', '\xB0', '\xE5', '\x92', '\x8C', '\xE5', '\x9C', '\xB0', /* 些们你來們到和地 */ + '\xE5', '\xA5', '\xB9', '\xE5', '\xB0', '\x86', '\xE5', '\xB0', '\x87', '\xE5', '\xB0', '\xB1', '\xE5', '\xB9', '\xB4', '\xE5', '\xBE', '\x97', '\xE6', '\x83', '\x85', '\xE6', '\x9C', '\x80', /* 她将將就年得情最 */ + '\xE6', '\xA0', '\xB7', '\xE6', '\xA8', '\xA3', '\xE7', '\x90', '\x86', '\xE8', '\x83', '\xBD', '\xE8', '\xAA', '\xAA', '\xE8', '\xAF', '\xB4', '\xE8', '\xBF', '\x99', '\xE9', '\x80', '\x99', /* 样樣理能說说这這 */ + '\xE9', '\x80', '\x9A', /* 通 */ + '\0', + '\xE5', '\x8D', '\xB3', '\xE5', '\x90', '\x97', '\xE5', '\x90', '\xA7', '\xE5', '\x90', '\xAC', '\xE5', '\x91', '\xA2', '\xE5', '\x93', '\x81', '\xE5', '\x93', '\x8D', '\xE5', '\x97', '\x8E', /* 即吗吧听呢品响嗎 */ + '\xE5', '\xB8', '\x88', '\xE5', '\xB8', '\xAB', '\xE6', '\x94', '\xB6', '\xE6', '\x96', '\xAD', '\xE6', '\x96', '\xB7', '\xE6', '\x98', '\x8E', '\xE7', '\x9C', '\xBC', '\xE9', '\x96', '\x93', /* 师師收断斷明眼間 */ + '\xE9', '\x97', '\xB4', '\xE9', '\x99', '\x85', '\xE9', '\x99', '\x88', '\xE9', '\x99', '\x90', '\xE9', '\x99', '\xA4', '\xE9', '\x99', '\xB3', '\xE9', '\x9A', '\x8F', '\xE9', '\x9A', '\x9B', /* 间际陈限除陳随際 */ + '\xE9', '\x9A', '\xA8', /* 隨 */ + '\0', + '\xE4', '\xBA', '\x8B', '\xE5', '\x89', '\x8D', '\xE5', '\xAD', '\xB8', '\xE5', '\xB0', '\x86', '\xE5', '\xB0', '\x87', '\xE6', '\x83', '\x85', '\xE6', '\x83', '\xB3', '\xE6', '\x88', '\x96', /* 事前學将將情想或 */ + '\xE6', '\x94', '\xBF', '\xE6', '\x96', '\xAF', '\xE6', '\x96', '\xB0', '\xE6', '\xA0', '\xB7', '\xE6', '\xA8', '\xA3', '\xE6', '\xB0', '\x91', '\xE6', '\xB2', '\x92', '\xE6', '\xB2', '\xA1', /* 政斯新样樣民沒没 */ + '\xE7', '\x84', '\xB6', '\xE7', '\x89', '\xB9', '\xE7', '\x8E', '\xB0', '\xE7', '\x8F', '\xBE', '\xE7', '\x90', '\x83', '\xE7', '\xAC', '\xAC', '\xE7', '\xB6', '\x93', '\xE8', '\xB0', '\x81', /* 然特现現球第經谁 */ + '\xE8', '\xB5', '\xB7', /* 起 */ + '\0', + '\xE4', '\xBE', '\x8B', '\xE5', '\x88', '\xA5', '\xE5', '\x88', '\xAB', '\xE5', '\x88', '\xB6', '\xE5', '\x8A', '\xA8', '\xE5', '\x8B', '\x95', '\xE5', '\x90', '\x97', '\xE5', '\x97', '\x8E', /* 例別别制动動吗嗎 */ + '\xE5', '\xA2', '\x9E', '\xE6', '\x8C', '\x87', '\xE6', '\x98', '\x8E', '\xE6', '\x9C', '\x9D', '\xE6', '\x9C', '\x9F', '\xE6', '\x9E', '\x84', '\xE7', '\x89', '\xA9', '\xE7', '\xA1', '\xAE', /* 增指明朝期构物确 */ + '\xE7', '\xA7', '\x8D', '\xE8', '\xAA', '\xBF', '\xE8', '\xB0', '\x83', '\xE8', '\xB2', '\xBB', '\xE8', '\xB4', '\xB9', '\xE9', '\x82', '\xA3', '\xE9', '\x83', '\xBD', '\xE9', '\x96', '\x93', /* 种調调費费那都間 */ + '\xE9', '\x97', '\xB4', /* 间 */ +#endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */ +#endif /* AF_CONFIG_OPTION_CJK */ + '\0', + + }; + + + /* stringsets are specific to scripts */ + FT_LOCAL_ARRAY_DEF( AF_Blue_StringRec ) + af_blue_stringsets[] = + { + /* */ + { AF_BLUE_STRING_LATIN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM, 0 }, + { AF_BLUE_STRING_LATIN_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_LATIN_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_LATIN_SMALL, 0 }, + { AF_BLUE_STRING_LATIN_SMALL_DESCENDER, 0 }, + { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_GREEK_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM, 0 }, + { AF_BLUE_STRING_GREEK_SMALL_BETA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_GREEK_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_GREEK_SMALL, 0 }, + { AF_BLUE_STRING_GREEK_SMALL_DESCENDER, 0 }, + { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM, 0 }, + { AF_BLUE_STRING_CYRILLIC_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_CYRILLIC_SMALL, 0 }, + { AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER, 0 }, + { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_HEBREW_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_LONG }, + { AF_BLUE_STRING_HEBREW_BOTTOM, 0 }, + { AF_BLUE_STRING_HEBREW_DESCENDER, 0 }, + { AF_BLUE_STRING_MAX, 0 }, +#ifdef AF_CONFIG_OPTION_CJK + { AF_BLUE_STRING_CJK_TOP_FILL, AF_BLUE_PROPERTY_CJK_TOP | + AF_BLUE_PROPERTY_CJK_FILL }, + { AF_BLUE_STRING_CJK_TOP_UNFILL, AF_BLUE_PROPERTY_CJK_TOP }, + { AF_BLUE_STRING_CJK_BOTTOM_FILL, AF_BLUE_PROPERTY_CJK_FILL }, + { AF_BLUE_STRING_CJK_BOTTOM_UNFILL, 0 }, +#ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT + { AF_BLUE_STRING_CJK_LEFT_FILL, AF_BLUE_PROPERTY_CJK_HORIZ | + AF_BLUE_PROPERTY_CJK_FILL }, + { AF_BLUE_STRING_CJK_LEFT_UNFILL, AF_BLUE_PROPERTY_CJK_HORIZ }, + { AF_BLUE_STRING_CJK_RIGHT_FILL, AF_BLUE_PROPERTY_CJK_HORIZ | + AF_BLUE_PROPERTY_CJK_RIGHT | + AF_BLUE_PROPERTY_CJK_FILL }, + { AF_BLUE_STRING_CJK_RIGHT_UNFILL, AF_BLUE_PROPERTY_CJK_HORIZ | + AF_BLUE_PROPERTY_CJK_RIGHT }, +#endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */ + { AF_BLUE_STRING_MAX, 0 }, +#endif /* AF_CONFIG_OPTION_CJK */ + + }; + + +/* END */ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afblue.cin b/reactos/lib/3rdparty/freetype/src/autofit/afblue.cin new file mode 100644 index 00000000000..c693d89f701 --- /dev/null +++ b/reactos/lib/3rdparty/freetype/src/autofit/afblue.cin @@ -0,0 +1,39 @@ +/***************************************************************************/ +/* */ +/* afblue.c */ +/* */ +/* Auto-fitter data for blue strings (body). */ +/* */ +/* Copyright 2013 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#include "aftypes.h" + + + FT_LOCAL_ARRAY_DEF( char ) + af_blue_strings[] = + { + /* */ +@AF_BLUE_STRINGS_ARRAY@ + }; + + + /* stringsets are specific to scripts */ + FT_LOCAL_ARRAY_DEF( AF_Blue_StringRec ) + af_blue_stringsets[] = + { + /* */ +@AF_BLUE_STRINGSETS_ARRAY@ + }; + + +/* END */ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afblue.dat b/reactos/lib/3rdparty/freetype/src/autofit/afblue.dat new file mode 100644 index 00000000000..d488f3faea6 --- /dev/null +++ b/reactos/lib/3rdparty/freetype/src/autofit/afblue.dat @@ -0,0 +1,218 @@ +// afblue.dat +// +// Auto-fitter data for blue strings. +// +// Copyright 2013 by +// David Turner, Robert Wilhelm, and Werner Lemberg. +// +// This file is part of the FreeType project, and may only be used, +// modified, and distributed under the terms of the FreeType project +// license, LICENSE.TXT. By continuing to use, modify, or distribute +// this file you indicate that you have read the license and +// understand and accept it fully. + + +// This file contains data specific to blue zones. It gets processed by +// a script to simulate `jagged arrays', with enumeration values holding +// offsets into the arrays. +// +// The format of the file is rather simple: A section starts with three +// labels separated by whitespace and followed by a colon (everything in a +// single line); the first label gives the name of the enumeration template, +// the second the name of the array template, and the third the name of the +// `maximum' template, holding the size of the largest array element. The +// script then fills the corresponding templates (indicated by `@' +// characters around the name). +// +// A section contains one or more data records. Each data record consists +// of two or more lines. The first line holds the enumeration name, and the +// remaining lines the corresponding array data. +// +// There are two possible representations for array data. +// +// - A string of characters in UTF-8 encoding enclosed in double quotes, +// using C syntax. There can be only one string per line, thus the +// starting and ending double quote must be the first and last character +// in the line, respectively, ignoring whitespace before and after the +// string. If there are multiple strings (in multiple lines), they are +// concatenated to a single string. In the output, a string gets +// represented as a series of singles bytes, followed by a zero byte. The +// enumeration values simply hold byte offsets to the start of the +// corresponding strings. +// +// - Data blocks enclosed in balanced braces, which get copied verbatim and +// which can span multiple lines. The opening brace of a block must be +// the first character of a line (ignoring whitespace), and the closing +// brace the last (ignoring whitespace also). The script appends a comma +// character after each block and counts the number of blocks to set the +// enumeration values. +// +// A section can contain either strings only or data blocks only. +// +// A comment line starts with `//'; it gets removed. A preprocessor +// directive line (using the standard syntax of `cpp') starts with `#' and +// gets copied verbatim to both the enumeration and the array. Whitespace +// outside of a string is insignificant. +// +// Preprocessor directives are ignored while the script computes maximum +// values; this essentially means that the maximum values can easily be too +// large. Given that the purpose of those values is to create local +// fixed-size arrays at compile time for further processing of the blue zone +// data, this isn't a problem. Note the the final zero byte of a string is +// not counted. Note also that the count holds the number of UTF-8 encoded +// characters, not bytes. + + +AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: + + AF_BLUE_STRING_LATIN_CAPITAL_TOP + "THEZOCQS" + AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM + "HEZLOCUS" + AF_BLUE_STRING_LATIN_SMALL_F_TOP + "fijkdbh" + AF_BLUE_STRING_LATIN_SMALL + "xzroesc" + AF_BLUE_STRING_LATIN_SMALL_DESCENDER + "pqgjy" + + AF_BLUE_STRING_GREEK_CAPITAL_TOP + "ΓΒΕΖΘΟΩ" + AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM + "ΒΔΖΞΘΟ" + AF_BLUE_STRING_GREEK_SMALL_BETA_TOP + "βθδζλξ" + AF_BLUE_STRING_GREEK_SMALL + "αειοπστω" + AF_BLUE_STRING_GREEK_SMALL_DESCENDER + "βγημρφχψ" + + AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP + "БВЕПЗОСЭ" + AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM + "БВЕШЗОСЭ" + AF_BLUE_STRING_CYRILLIC_SMALL + "хпншезос" + AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER + "руф" + + AF_BLUE_STRING_HEBREW_TOP + "בדהחךכםס" + AF_BLUE_STRING_HEBREW_BOTTOM + "בטכםסצ" + AF_BLUE_STRING_HEBREW_DESCENDER + "קךןףץ" + +#ifdef AF_CONFIG_OPTION_CJK + + AF_BLUE_STRING_CJK_TOP_FILL + "他们你來們到和地" + "对對就席我时時會" + "来為能舰說说这這" + "齊" + AF_BLUE_STRING_CJK_TOP_UNFILL + "军同已愿既星是景" + "民照现現理用置要" + "軍那配里開雷露面" + "顾" + AF_BLUE_STRING_CJK_BOTTOM_FILL + "个为人他以们你來" + "個們到和大对對就" + "我时時有来為要說" + "说" + AF_BLUE_STRING_CJK_BOTTOM_UNFILL + "主些因它想意理生" + "當看着置者自著裡" + "过还进進過道還里" + "面" + +#ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT + + AF_BLUE_STRING_CJK_LEFT_FILL + "些们你來們到和地" + "她将將就年得情最" + "样樣理能說说这這" + "通" + AF_BLUE_STRING_CJK_LEFT_UNFILL + "即吗吧听呢品响嗎" + "师師收断斷明眼間" + "间际陈限除陳随際" + "隨" + AF_BLUE_STRING_CJK_RIGHT_FILL + "事前學将將情想或" + "政斯新样樣民沒没" + "然特现現球第經谁" + "起" + AF_BLUE_STRING_CJK_RIGHT_UNFILL + "例別别制动動吗嗎" + "增指明朝期构物确" + "种調调費费那都間" + "间" + +#endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */ + +#endif /* AF_CONFIG_OPTION_CJK */ + + +AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: + + AF_BLUE_STRINGSET_LATN + { AF_BLUE_STRING_LATIN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM, 0 } + { AF_BLUE_STRING_LATIN_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_LATIN_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_LATIN_SMALL, 0 } + { AF_BLUE_STRING_LATIN_SMALL_DESCENDER, 0 } + { AF_BLUE_STRING_MAX, 0 } + + AF_BLUE_STRINGSET_GREK + { AF_BLUE_STRING_GREEK_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM, 0 } + { AF_BLUE_STRING_GREEK_SMALL_BETA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_GREEK_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_GREEK_SMALL, 0 } + { AF_BLUE_STRING_GREEK_SMALL_DESCENDER, 0 } + { AF_BLUE_STRING_MAX, 0 } + + AF_BLUE_STRINGSET_CYRL + { AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM, 0 } + { AF_BLUE_STRING_CYRILLIC_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_CYRILLIC_SMALL, 0 } + { AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER, 0 } + { AF_BLUE_STRING_MAX, 0 } + + AF_BLUE_STRINGSET_HEBR + { AF_BLUE_STRING_HEBREW_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_LONG } + { AF_BLUE_STRING_HEBREW_BOTTOM, 0 } + { AF_BLUE_STRING_HEBREW_DESCENDER, 0 } + { AF_BLUE_STRING_MAX, 0 } + +#ifdef AF_CONFIG_OPTION_CJK + + AF_BLUE_STRINGSET_HANI + { AF_BLUE_STRING_CJK_TOP_FILL, AF_BLUE_PROPERTY_CJK_TOP | + AF_BLUE_PROPERTY_CJK_FILL } + { AF_BLUE_STRING_CJK_TOP_UNFILL, AF_BLUE_PROPERTY_CJK_TOP } + { AF_BLUE_STRING_CJK_BOTTOM_FILL, AF_BLUE_PROPERTY_CJK_FILL } + { AF_BLUE_STRING_CJK_BOTTOM_UNFILL, 0 } +#ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT + { AF_BLUE_STRING_CJK_LEFT_FILL, AF_BLUE_PROPERTY_CJK_HORIZ | + AF_BLUE_PROPERTY_CJK_FILL } + { AF_BLUE_STRING_CJK_LEFT_UNFILL, AF_BLUE_PROPERTY_CJK_HORIZ } + { AF_BLUE_STRING_CJK_RIGHT_FILL, AF_BLUE_PROPERTY_CJK_HORIZ | + AF_BLUE_PROPERTY_CJK_RIGHT | + AF_BLUE_PROPERTY_CJK_FILL } + { AF_BLUE_STRING_CJK_RIGHT_UNFILL, AF_BLUE_PROPERTY_CJK_HORIZ | + AF_BLUE_PROPERTY_CJK_RIGHT } +#endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */ + { AF_BLUE_STRING_MAX, 0 } + +#endif /* AF_CONFIG_OPTION_CJK */ + + +// END diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afblue.h b/reactos/lib/3rdparty/freetype/src/autofit/afblue.h new file mode 100644 index 00000000000..86a36491faf --- /dev/null +++ b/reactos/lib/3rdparty/freetype/src/autofit/afblue.h @@ -0,0 +1,199 @@ +/* This file has been generated by the Perl script `afblue.pl', */ +/* using data from file `afblue.dat'. */ + +/***************************************************************************/ +/* */ +/* afblue.h */ +/* */ +/* Auto-fitter data for blue strings (specification). */ +/* */ +/* Copyright 2013 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __AFBLUE_H__ +#define __AFBLUE_H__ + + +FT_BEGIN_HEADER + + + /* an auxiliary macro to decode a UTF-8 character -- since we only use */ + /* hard-coded, self-converted data, no error checking is performed */ +#define GET_UTF8_CHAR( ch, p ) \ + ch = (unsigned char)*p++; \ + if ( ch >= 0x80 ) \ + { \ + FT_UInt len; \ + \ + \ + if ( ch < 0xE0 ) \ + { \ + len = 1; \ + ch &= 0x1F; \ + } \ + else if ( ch < 0xF0 ) \ + { \ + len = 2; \ + ch &= 0x0F; \ + } \ + else \ + { \ + len = 3; \ + ch &= 0x07; \ + } \ + \ + for ( ; len > 0; len-- ) \ + ch = ( ch << 6 ) | ( *p++ & 0x3F ); \ + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** B L U E S T R I N G S *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* At the bottommost level, we define strings for finding blue zones. */ + + +#define AF_BLUE_STRING_MAX_LEN 25 + + /* The AF_Blue_String enumeration values are offsets into the */ + /* `af_blue_strings' array. */ + + typedef enum AF_Blue_String_ + { + AF_BLUE_STRING_LATIN_CAPITAL_TOP = 0, + AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 9, + AF_BLUE_STRING_LATIN_SMALL_F_TOP = 18, + AF_BLUE_STRING_LATIN_SMALL = 26, + AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 34, + AF_BLUE_STRING_GREEK_CAPITAL_TOP = 40, + AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 55, + AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 68, + AF_BLUE_STRING_GREEK_SMALL = 81, + AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 98, + AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 115, + AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 132, + AF_BLUE_STRING_CYRILLIC_SMALL = 149, + AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 166, + AF_BLUE_STRING_HEBREW_TOP = 173, + AF_BLUE_STRING_HEBREW_BOTTOM = 190, + AF_BLUE_STRING_HEBREW_DESCENDER = 203, + af_blue_1_1 = 213, +#ifdef AF_CONFIG_OPTION_CJK + AF_BLUE_STRING_CJK_TOP_FILL = af_blue_1_1 + 1, + AF_BLUE_STRING_CJK_TOP_UNFILL = af_blue_1_1 + 77, + AF_BLUE_STRING_CJK_BOTTOM_FILL = af_blue_1_1 + 153, + AF_BLUE_STRING_CJK_BOTTOM_UNFILL = af_blue_1_1 + 229, + af_blue_1_1_1 = af_blue_1_1 + 304, +#ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT + AF_BLUE_STRING_CJK_LEFT_FILL = af_blue_1_1_1 + 1, + AF_BLUE_STRING_CJK_LEFT_UNFILL = af_blue_1_1_1 + 77, + AF_BLUE_STRING_CJK_RIGHT_FILL = af_blue_1_1_1 + 153, + AF_BLUE_STRING_CJK_RIGHT_UNFILL = af_blue_1_1_1 + 229, + af_blue_1_2_1 = af_blue_1_1_1 + 304, +#else + af_blue_1_2_1 = af_blue_1_1_1 + 0, +#endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */ + af_blue_1_2 = af_blue_1_2_1 + 0, +#else + af_blue_1_2 = af_blue_1_2_1 + 0, +#endif /* AF_CONFIG_OPTION_CJK */ + + + AF_BLUE_STRING_MAX /* do not remove */ + + } AF_Blue_String; + + + FT_LOCAL_ARRAY( char ) + af_blue_strings[]; + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** B L U E S T R I N G S E T S *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* The next level is to group blue strings into script-specific sets. */ + + + /* Properties are specific to a writing system. We assume that a given */ + /* blue string can't be used in more than a single writing system, which */ + /* is a safe bet. */ +#define AF_BLUE_PROPERTY_LATIN_TOP ( 1 << 0 ) +#define AF_BLUE_PROPERTY_LATIN_X_HEIGHT ( 1 << 1 ) +#define AF_BLUE_PROPERTY_LATIN_LONG ( 1 << 2 ) + +#define AF_BLUE_PROPERTY_CJK_HORIZ ( 1 << 0 ) +#define AF_BLUE_PROPERTY_CJK_TOP ( 1 << 1 ) +#define AF_BLUE_PROPERTY_CJK_FILL ( 1 << 2 ) +#define AF_BLUE_PROPERTY_CJK_RIGHT AF_BLUE_PROPERTY_CJK_TOP + + +#define AF_BLUE_STRINGSET_MAX_LEN 9 + + /* The AF_Blue_Stringset enumeration values are offsets into the */ + /* `af_blue_stringsets' array. */ + + typedef enum AF_Blue_Stringset_ + { + AF_BLUE_STRINGSET_LATN = 0, + AF_BLUE_STRINGSET_GREK = 7, + AF_BLUE_STRINGSET_CYRL = 14, + AF_BLUE_STRINGSET_HEBR = 20, + af_blue_2_1 = 24, +#ifdef AF_CONFIG_OPTION_CJK + AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0, + af_blue_2_1_1 = af_blue_2_1 + 4, +#ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT + af_blue_2_2_1 = af_blue_2_1_1 + 4, +#else + af_blue_2_2_1 = af_blue_2_1_1 + 0, +#endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */ + af_blue_2_2 = af_blue_2_2_1 + 1, +#else + af_blue_2_2 = af_blue_2_2_1 + 0, +#endif /* AF_CONFIG_OPTION_CJK */ + + + AF_BLUE_STRINGSET_MAX /* do not remove */ + + } AF_Blue_Stringset; + + + typedef struct AF_Blue_StringRec_ + { + AF_Blue_String string; + FT_UShort properties; + + } AF_Blue_StringRec; + + + FT_LOCAL_ARRAY( AF_Blue_StringRec ) + af_blue_stringsets[]; + +/* */ + +FT_END_HEADER + + +#endif /* __AFBLUE_H__ */ + + +/* END */ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afblue.hin b/reactos/lib/3rdparty/freetype/src/autofit/afblue.hin new file mode 100644 index 00000000000..00282c3bad9 --- /dev/null +++ b/reactos/lib/3rdparty/freetype/src/autofit/afblue.hin @@ -0,0 +1,142 @@ +/***************************************************************************/ +/* */ +/* afblue.h */ +/* */ +/* Auto-fitter data for blue strings (specification). */ +/* */ +/* Copyright 2013 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __AFBLUE_H__ +#define __AFBLUE_H__ + + +FT_BEGIN_HEADER + + + /* an auxiliary macro to decode a UTF-8 character -- since we only use */ + /* hard-coded, self-converted data, no error checking is performed */ +#define GET_UTF8_CHAR( ch, p ) \ + ch = (unsigned char)*p++; \ + if ( ch >= 0x80 ) \ + { \ + FT_UInt len; \ + \ + \ + if ( ch < 0xE0 ) \ + { \ + len = 1; \ + ch &= 0x1F; \ + } \ + else if ( ch < 0xF0 ) \ + { \ + len = 2; \ + ch &= 0x0F; \ + } \ + else \ + { \ + len = 3; \ + ch &= 0x07; \ + } \ + \ + for ( ; len > 0; len-- ) \ + ch = ( ch << 6 ) | ( *p++ & 0x3F ); \ + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** B L U E S T R I N G S *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* At the bottommost level, we define strings for finding blue zones. */ + + +#define AF_BLUE_STRING_MAX_LEN @AF_BLUE_STRING_MAX_LEN@ + + /* The AF_Blue_String enumeration values are offsets into the */ + /* `af_blue_strings' array. */ + + typedef enum AF_Blue_String_ + { +@AF_BLUE_STRING_ENUM@ + + AF_BLUE_STRING_MAX /* do not remove */ + + } AF_Blue_String; + + + FT_LOCAL_ARRAY( char ) + af_blue_strings[]; + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** B L U E S T R I N G S E T S *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* The next level is to group blue strings into script-specific sets. */ + + + /* Properties are specific to a writing system. We assume that a given */ + /* blue string can't be used in more than a single writing system, which */ + /* is a safe bet. */ +#define AF_BLUE_PROPERTY_LATIN_TOP ( 1 << 0 ) +#define AF_BLUE_PROPERTY_LATIN_X_HEIGHT ( 1 << 1 ) +#define AF_BLUE_PROPERTY_LATIN_LONG ( 1 << 2 ) + +#define AF_BLUE_PROPERTY_CJK_HORIZ ( 1 << 0 ) +#define AF_BLUE_PROPERTY_CJK_TOP ( 1 << 1 ) +#define AF_BLUE_PROPERTY_CJK_FILL ( 1 << 2 ) +#define AF_BLUE_PROPERTY_CJK_RIGHT AF_BLUE_PROPERTY_CJK_TOP + + +#define AF_BLUE_STRINGSET_MAX_LEN @AF_BLUE_STRINGSET_MAX_LEN@ + + /* The AF_Blue_Stringset enumeration values are offsets into the */ + /* `af_blue_stringsets' array. */ + + typedef enum AF_Blue_Stringset_ + { +@AF_BLUE_STRINGSET_ENUM@ + + AF_BLUE_STRINGSET_MAX /* do not remove */ + + } AF_Blue_Stringset; + + + typedef struct AF_Blue_StringRec_ + { + AF_Blue_String string; + FT_UShort properties; + + } AF_Blue_StringRec; + + + FT_LOCAL_ARRAY( AF_Blue_StringRec ) + af_blue_stringsets[]; + +/* */ + +FT_END_HEADER + + +#endif /* __AFBLUE_H__ */ + + +/* END */ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afcjk.c b/reactos/lib/3rdparty/freetype/src/autofit/afcjk.c index f69a528e3b7..7a6f835516c 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afcjk.c +++ b/reactos/lib/3rdparty/freetype/src/autofit/afcjk.c @@ -26,7 +26,7 @@ #include FT_ADVANCES_H #include FT_INTERNAL_DEBUG_H -#include "aftypes.h" +#include "afglobal.h" #include "aflatin.h" @@ -73,6 +73,12 @@ AF_GlyphHintsRec hints[1]; + FT_TRACE5(( "\n" + "cjk standard widths computation (script `%s')\n" + "===============================================\n" + "\n", + af_script_names[metrics->root.script_class->script] )); + af_glyph_hints_init( hints, face->memory ); metrics->axis[AF_DIMENSION_HORZ].width_count = 0; @@ -86,11 +92,15 @@ AF_Scaler scaler = &dummy->root.scaler; - glyph_index = FT_Get_Char_Index( face, - metrics->root.clazz->standard_char ); + glyph_index = FT_Get_Char_Index( + face, + metrics->root.script_class->standard_char ); if ( glyph_index == 0 ) goto Exit; + FT_TRACE5(( "standard character: U+%04lX (glyph index %d)\n", + metrics->root.script_class->standard_char, glyph_index )); + error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); if ( error || face->glyph->outline.n_points <= 0 ) goto Exit; @@ -122,11 +132,13 @@ FT_UInt num_widths = 0; - error = af_latin_hints_compute_segments( hints, (AF_Dimension)dim ); + error = af_latin_hints_compute_segments( hints, + (AF_Dimension)dim ); if ( error ) goto Exit; - af_latin_hints_link_segments( hints, (AF_Dimension)dim ); + af_latin_hints_link_segments( hints, + (AF_Dimension)dim ); seg = axhints->segments; limit = seg + axhints->num_segments; @@ -151,7 +163,7 @@ } /* this also replaces multiple almost identical stem widths */ - /* with a single one (the value 100 is heuristic) */ + /* with a single one (the value 100 is heuristic) */ af_sort_and_quantize_widths( &num_widths, axis->widths, dummy->units_per_em / 100 ); axis->width_count = num_widths; @@ -171,263 +183,201 @@ axis->edge_distance_threshold = stdw / 5; axis->standard_width = stdw; axis->extra_light = 0; + +#ifdef FT_DEBUG_LEVEL_TRACE + { + FT_UInt i; + + + FT_TRACE5(( "%s widths:\n", + dim == AF_DIMENSION_VERT ? "horizontal" + : "vertical" )); + + FT_TRACE5(( " %d (standard)", axis->standard_width )); + for ( i = 1; i < axis->width_count; i++ ) + FT_TRACE5(( " %d", axis->widths[i].org )); + + FT_TRACE5(( "\n" )); + } +#endif } } + FT_TRACE5(( "\n" )); + af_glyph_hints_done( hints ); } -#define AF_CJK_MAX_TEST_CHARACTERS 32 - - - /* Each blue zone has two types of fill and unfill, this is, */ - /* filling the entire glyph square or not. */ - - enum - { - AF_CJK_BLUE_TYPE_FILL, - AF_CJK_BLUE_TYPE_UNFILL, - AF_CJK_BLUE_TYPE_MAX - }; - - - /* Put some common and representative Han Ideographs characters here. */ - static const FT_ULong af_cjk_hani_blue_chars[AF_CJK_BLUE_MAX] - [AF_CJK_BLUE_TYPE_MAX] - [AF_CJK_MAX_TEST_CHARACTERS] = - { - { - { - 0x4ED6, 0x4EEC, 0x4F60, 0x4F86, 0x5011, 0x5230, 0x548C, 0x5730, - 0x5BF9, 0x5C0D, 0x5C31, 0x5E2D, 0x6211, 0x65F6, 0x6642, 0x6703, - 0x6765, 0x70BA, 0x80FD, 0x8230, 0x8AAA, 0x8BF4, 0x8FD9, 0x9019, - 0x9F4A /* top fill */ - }, - { - 0x519B, 0x540C, 0x5DF2, 0x613F, 0x65E2, 0x661F, 0x662F, 0x666F, - 0x6C11, 0x7167, 0x73B0, 0x73FE, 0x7406, 0x7528, 0x7F6E, 0x8981, - 0x8ECD, 0x90A3, 0x914D, 0x91CC, 0x958B, 0x96F7, 0x9732, 0x9762, - 0x987E /* top unfill */ - } - }, - { - { - 0x4E2A, 0x4E3A, 0x4EBA, 0x4ED6, 0x4EE5, 0x4EEC, 0x4F60, 0x4F86, - 0x500B, 0x5011, 0x5230, 0x548C, 0x5927, 0x5BF9, 0x5C0D, 0x5C31, - 0x6211, 0x65F6, 0x6642, 0x6709, 0x6765, 0x70BA, 0x8981, 0x8AAA, - 0x8BF4 /* bottom fill */ - }, - { - 0x4E3B, 0x4E9B, 0x56E0, 0x5B83, 0x60F3, 0x610F, 0x7406, 0x751F, - 0x7576, 0x770B, 0x7740, 0x7F6E, 0x8005, 0x81EA, 0x8457, 0x88E1, - 0x8FC7, 0x8FD8, 0x8FDB, 0x9032, 0x904E, 0x9053, 0x9084, 0x91CC, - 0x9762 /* bottom unfill */ - } - }, -#ifndef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT - { {0x0000}, {0x0000} }, - { {0x0000}, {0x0000} } -#else - { - { - 0x4E9B, 0x4EEC, 0x4F60, 0x4F86, 0x5011, 0x5230, 0x548C, 0x5730, - 0x5979, 0x5C06, 0x5C07, 0x5C31, 0x5E74, 0x5F97, 0x60C5, 0x6700, - 0x6837, 0x6A23, 0x7406, 0x80FD, 0x8AAA, 0x8BF4, 0x8FD9, 0x9019, - 0x901A /* left fill */ - }, - { - 0x5373, 0x5417, 0x5427, 0x542C, 0x5462, 0x54C1, 0x54CD, 0x55CE, - 0x5E08, 0x5E2B, 0x6536, 0x65AD, 0x65B7, 0x660E, 0x773C, 0x9593, - 0x95F4, 0x9645, 0x9648, 0x9650, 0x9664, 0x9673, 0x968F, 0x969B, - 0x96A8 /* left unfill */ - } - }, - { - { - 0x4E8B, 0x524D, 0x5B78, 0x5C06, 0x5C07, 0x60C5, 0x60F3, 0x6216, - 0x653F, 0x65AF, 0x65B0, 0x6837, 0x6A23, 0x6C11, 0x6C92, 0x6CA1, - 0x7136, 0x7279, 0x73B0, 0x73FE, 0x7403, 0x7B2C, 0x7D93, 0x8C01, - 0x8D77 /* right fill */ - }, - { - 0x4F8B, 0x5225, 0x522B, 0x5236, 0x52A8, 0x52D5, 0x5417, 0x55CE, - 0x589E, 0x6307, 0x660E, 0x671D, 0x671F, 0x6784, 0x7269, 0x786E, - 0x79CD, 0x8ABF, 0x8C03, 0x8CBB, 0x8D39, 0x90A3, 0x90FD, 0x9593, - 0x95F4 /* right unfill */ - } - } -#endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */ - }; - - - /* Calculate blue zones for all the CJK_BLUE_XXX's. */ + /* Find all blue zones. */ static void - af_cjk_metrics_init_blues( AF_CJKMetrics metrics, - FT_Face face, - const FT_ULong blue_chars - [AF_CJK_BLUE_MAX] - [AF_CJK_BLUE_TYPE_MAX] - [AF_CJK_MAX_TEST_CHARACTERS] ) + af_cjk_metrics_init_blues( AF_CJKMetrics metrics, + FT_Face face ) { - FT_Pos fills[AF_CJK_MAX_TEST_CHARACTERS]; - FT_Pos flats[AF_CJK_MAX_TEST_CHARACTERS]; + FT_Pos fills[AF_BLUE_STRING_MAX_LEN]; + FT_Pos flats[AF_BLUE_STRING_MAX_LEN]; - FT_Int num_fills; - FT_Int num_flats; + FT_Int num_fills; + FT_Int num_flats; - FT_Int bb; - AF_CJKBlue blue; - FT_Error error; - AF_CJKAxis axis; - FT_GlyphSlot glyph = face->glyph; + AF_CJKBlue blue; + FT_Error error; + AF_CJKAxis axis; + FT_Outline outline; + + AF_Blue_Stringset bss = metrics->root.script_class->blue_stringset; + const AF_Blue_StringRec* bs = &af_blue_stringsets[bss]; #ifdef FT_DEBUG_LEVEL_TRACE - FT_String* cjk_blue_name[AF_CJK_BLUE_MAX] = { - (FT_String*)"top", - (FT_String*)"bottom", - (FT_String*)"left", - (FT_String*)"right" + FT_String* cjk_blue_name[4] = + { + (FT_String*)"bottom", /* -- , -- */ + (FT_String*)"top", /* -- , TOP */ + (FT_String*)"left", /* HORIZ, -- */ + (FT_String*)"right" /* HORIZ, TOP */ }; - FT_String* cjk_blue_type_name[AF_CJK_BLUE_TYPE_MAX] = { - (FT_String*)"filled", - (FT_String*)"unfilled" + + FT_String* cjk_blue_type_name[2] = + { + (FT_String*)"unfilled", /* -- */ + (FT_String*)"filled" /* FILL */ }; #endif - /* We compute the blues simply by loading each character from the */ - /* `blue_chars[blues]' string, then computing its extreme points */ - /* (depending blue zone type etc.). */ + /* we walk over the blue character strings as specified in the */ + /* script's entry in the `af_blue_stringset' array, computing its */ + /* extremum points (depending on the string properties) */ - FT_TRACE5(( "cjk blue zones computation\n" )); - FT_TRACE5(( "------------------------------------------------\n" )); + FT_TRACE5(( "cjk blue zones computation\n" + "==========================\n" + "\n" )); - for ( bb = 0; bb < AF_CJK_BLUE_MAX; bb++ ) + for ( ; bs->string != AF_BLUE_STRING_MAX; bs++ ) { - FT_Int fill_type; - FT_Pos* blue_ref; - FT_Pos* blue_shoot; + const char* p = &af_blue_strings[bs->string]; + FT_Pos* blue_ref; + FT_Pos* blue_shoot; + if ( AF_CJK_IS_HORIZ_BLUE( bs ) ) + axis = &metrics->axis[AF_DIMENSION_HORZ]; + else + axis = &metrics->axis[AF_DIMENSION_VERT]; + + FT_TRACE5(( "blue zone %d:\n", axis->blue_count )); + num_fills = 0; num_flats = 0; - for ( fill_type = 0; fill_type < AF_CJK_BLUE_TYPE_MAX; fill_type++ ) + FT_TRACE5(( " cjk blue %s/%s\n", + cjk_blue_name[AF_CJK_IS_HORIZ_BLUE( bs ) | + AF_CJK_IS_TOP_BLUE( bs ) ], + cjk_blue_type_name[!!AF_CJK_IS_FILLED_BLUE( bs )] )); + + while ( *p ) { - const FT_ULong* p = blue_chars[bb][fill_type]; - const FT_ULong* limit = p + AF_CJK_MAX_TEST_CHARACTERS; - FT_Bool fill = FT_BOOL( - fill_type == AF_CJK_BLUE_TYPE_FILL ); + FT_ULong ch; + FT_UInt glyph_index; + FT_Pos best_pos; /* same as points.y or points.x, resp. */ + FT_Int best_point; + FT_Vector* points; - FT_TRACE5(( "cjk blue %s/%s\n", cjk_blue_name[bb], - cjk_blue_type_name[fill_type] )); + GET_UTF8_CHAR( ch, p ); - - for ( ; p < limit && *p; p++ ) + /* load the character in the face -- skip unknown or empty ones */ + glyph_index = FT_Get_Char_Index( face, ch ); + if ( glyph_index == 0 ) { - FT_UInt glyph_index; - FT_Pos best_pos; /* same as points.y */ - FT_Int best_point; - FT_Vector* points; + FT_TRACE5(( " U+%04lX unavailable\n", ch )); + continue; + } + + error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); + outline = face->glyph->outline; + if ( error || outline.n_points <= 0 ) + { + FT_TRACE5(( " U+%04lX contains no outlines\n", ch )); + continue; + } + + /* now compute min or max point indices and coordinates */ + points = outline.points; + best_point = -1; + best_pos = 0; /* make compiler happy */ + + { + FT_Int nn; + FT_Int first = 0; + FT_Int last = -1; - FT_TRACE5(( " U+%lX...", *p )); - - /* load the character in the face -- skip unknown or empty ones */ - glyph_index = FT_Get_Char_Index( face, *p ); - if ( glyph_index == 0 ) + for ( nn = 0; nn < outline.n_contours; first = last + 1, nn++ ) { - FT_TRACE5(( "unavailable\n" )); - continue; - } - - error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); - if ( error || glyph->outline.n_points <= 0 ) - { - FT_TRACE5(( "no outline\n" )); - continue; - } - - /* now compute min or max point indices and coordinates */ - points = glyph->outline.points; - best_point = -1; - best_pos = 0; /* make compiler happy */ - - { - FT_Int nn; - FT_Int first = 0; - FT_Int last = -1; + FT_Int pp; - for ( nn = 0; - nn < glyph->outline.n_contours; - first = last + 1, nn++ ) + last = outline.contours[nn]; + + /* Avoid single-point contours since they are never rasterized. */ + /* In some fonts, they correspond to mark attachment points */ + /* which are way outside of the glyph's real outline. */ + if ( last <= first ) + continue; + + if ( AF_CJK_IS_HORIZ_BLUE( bs ) ) { - FT_Int pp; - - - last = glyph->outline.contours[nn]; - - /* Avoid single-point contours since they are never */ - /* rasterized. In some fonts, they correspond to mark */ - /* attachment points which are way outside of the glyph's */ - /* real outline. */ - if ( last <= first ) - continue; - - switch ( bb ) + if ( AF_CJK_IS_RIGHT_BLUE( bs ) ) { - case AF_CJK_BLUE_TOP: - for ( pp = first; pp <= last; pp++ ) - if ( best_point < 0 || points[pp].y > best_pos ) - { - best_point = pp; - best_pos = points[pp].y; - } - break; - - case AF_CJK_BLUE_BOTTOM: - for ( pp = first; pp <= last; pp++ ) - if ( best_point < 0 || points[pp].y < best_pos ) - { - best_point = pp; - best_pos = points[pp].y; - } - break; - - case AF_CJK_BLUE_LEFT: - for ( pp = first; pp <= last; pp++ ) - if ( best_point < 0 || points[pp].x < best_pos ) - { - best_point = pp; - best_pos = points[pp].x; - } - break; - - case AF_CJK_BLUE_RIGHT: for ( pp = first; pp <= last; pp++ ) if ( best_point < 0 || points[pp].x > best_pos ) { best_point = pp; best_pos = points[pp].x; } - break; - - default: - ; + } + else + { + for ( pp = first; pp <= last; pp++ ) + if ( best_point < 0 || points[pp].x < best_pos ) + { + best_point = pp; + best_pos = points[pp].x; + } + } + } + else + { + if ( AF_CJK_IS_TOP_BLUE( bs ) ) + { + for ( pp = first; pp <= last; pp++ ) + if ( best_point < 0 || points[pp].y > best_pos ) + { + best_point = pp; + best_pos = points[pp].y; + } + } + else + { + for ( pp = first; pp <= last; pp++ ) + if ( best_point < 0 || points[pp].y < best_pos ) + { + best_point = pp; + best_pos = points[pp].y; + } } } - FT_TRACE5(( "best_pos=%5ld\n", best_pos )); } - if ( fill ) - fills[num_fills++] = best_pos; - else - flats[num_flats++] = best_pos; + FT_TRACE5(( " U+%04lX: best_pos = %5ld\n", ch, best_pos )); } + + if ( AF_CJK_IS_FILLED_BLUE( bs ) ) + fills[num_fills++] = best_pos; + else + flats[num_flats++] = best_pos; } if ( num_flats == 0 && num_fills == 0 ) @@ -436,34 +386,30 @@ * we couldn't find a single glyph to compute this blue zone, * we will simply ignore it then */ - FT_TRACE5(( "empty\n" )); + FT_TRACE5(( " empty\n" )); continue; } /* we have computed the contents of the `fill' and `flats' tables, */ - /* now determine the reference position of the blue -- */ + /* now determine the reference position of the blue zone -- */ /* we simply take the median value after a simple sort */ af_sort_pos( num_flats, flats ); af_sort_pos( num_fills, fills ); - if ( AF_CJK_BLUE_TOP == bb || AF_CJK_BLUE_BOTTOM == bb ) - axis = &metrics->axis[AF_DIMENSION_VERT]; - else - axis = &metrics->axis[AF_DIMENSION_HORZ]; - - blue = & axis->blues[axis->blue_count]; - blue_ref = & blue->ref.org; - blue_shoot = & blue->shoot.org; + blue = &axis->blues[axis->blue_count]; + blue_ref = &blue->ref.org; + blue_shoot = &blue->shoot.org; axis->blue_count++; + if ( num_flats == 0 ) { - *blue_ref = fills[num_fills / 2]; + *blue_ref = *blue_shoot = fills[num_fills / 2]; } else if ( num_fills == 0 ) { - *blue_ref = flats[num_flats / 2]; + *blue_ref = *blue_shoot = flats[num_flats / 2]; } else @@ -481,26 +427,34 @@ FT_Bool under_ref = FT_BOOL( shoot < ref ); - if ( ( AF_CJK_BLUE_TOP == bb || - AF_CJK_BLUE_RIGHT == bb ) ^ under_ref ) - *blue_shoot = *blue_ref = ( shoot + ref ) / 2; + /* AF_CJK_IS_TOP_BLUE covers `right' and `top' */ + if ( AF_CJK_IS_TOP_BLUE( bs ) ^ under_ref ) + { + *blue_ref = + *blue_shoot = ( shoot + ref ) / 2; + + FT_TRACE5(( " [overshoot smaller than reference," + " taking mean value]\n" )); + } } blue->flags = 0; - if ( AF_CJK_BLUE_TOP == bb ) - blue->flags |= AF_CJK_BLUE_IS_TOP; - else if ( AF_CJK_BLUE_RIGHT == bb ) - blue->flags |= AF_CJK_BLUE_IS_RIGHT; + if ( AF_CJK_IS_TOP_BLUE( bs ) ) + blue->flags |= AF_CJK_BLUE_TOP; - FT_TRACE5(( "-- cjk %s bluezone ref = %ld shoot = %ld\n", - cjk_blue_name[bb], *blue_ref, *blue_shoot )); + FT_TRACE5(( " -> reference = %ld\n" + " overshoot = %ld\n", + *blue_ref, *blue_shoot )); } + FT_TRACE5(( "\n" )); + return; } /* Basically the Latin version with type AF_CJKMetrics for metrics. */ + FT_LOCAL_DEF( void ) af_cjk_metrics_check_digits( AF_CJKMetrics metrics, FT_Face face ) @@ -510,8 +464,7 @@ FT_Fixed advance, old_advance = 0; - /* check whether all ASCII digits have the same advance width; */ - /* digit `0' is 0x30 in all supported charmaps */ + /* digit `0' is 0x30 in all supported charmaps */ for ( i = 0x30; i <= 0x39; i++ ) { FT_UInt glyph_index; @@ -547,6 +500,8 @@ } + /* Initialize global metrics. */ + FT_LOCAL_DEF( FT_Error ) af_cjk_metrics_init( AF_CJKMetrics metrics, FT_Face face ) @@ -556,21 +511,21 @@ metrics->units_per_em = face->units_per_EM; - if ( FT_Select_Charmap( face, FT_ENCODING_UNICODE ) ) - face->charmap = NULL; - else + if ( !FT_Select_Charmap( face, FT_ENCODING_UNICODE ) ) { af_cjk_metrics_init_widths( metrics, face ); - af_cjk_metrics_init_blues( metrics, face, af_cjk_hani_blue_chars ); + af_cjk_metrics_init_blues( metrics, face ); af_cjk_metrics_check_digits( metrics, face ); } FT_Set_Charmap( face, oldmap ); - return FT_Err_Ok; } + /* Adjust scaling value, then scale and shift widths */ + /* and blue zones (if applicable) for given dimension. */ + static void af_cjk_metrics_scale_dim( AF_CJKMetrics metrics, AF_Scaler scaler, @@ -582,8 +537,6 @@ FT_UInt nn; - axis = &metrics->axis[dim]; - if ( dim == AF_DIMENSION_HORZ ) { scale = scaler->x_scale; @@ -595,6 +548,8 @@ delta = scaler->y_delta; } + axis = &metrics->axis[dim]; + if ( axis->org_scale == scale && axis->org_delta == delta ) return; @@ -650,12 +605,13 @@ blue->shoot.fit = blue->ref.fit - delta2; - FT_TRACE5(( ">> active cjk blue zone %c%d[%ld/%ld]: " - "ref: cur=%.2f fit=%.2f shoot: cur=%.2f fit=%.2f\n", - ( dim == AF_DIMENSION_HORZ ) ? 'H' : 'V', - nn, blue->ref.org, blue->shoot.org, - blue->ref.cur / 64.0, blue->ref.fit / 64.0, - blue->shoot.cur / 64.0, blue->shoot.fit / 64.0 )); + FT_TRACE5(( ">> active cjk blue zone %c%d[%ld/%ld]:\n" + " ref: cur=%.2f fit=%.2f\n" + " shoot: cur=%.2f fit=%.2f\n", + ( dim == AF_DIMENSION_HORZ ) ? 'H' : 'V', + nn, blue->ref.org, blue->shoot.org, + blue->ref.cur / 64.0, blue->ref.fit / 64.0, + blue->shoot.cur / 64.0, blue->shoot.fit / 64.0 )); blue->flags |= AF_CJK_BLUE_ACTIVE; } @@ -663,10 +619,14 @@ } + /* Scale global values in both directions. */ + FT_LOCAL_DEF( void ) af_cjk_metrics_scale( AF_CJKMetrics metrics, AF_Scaler scaler ) { + /* we copy the whole structure since the x and y scaling values */ + /* are not modified, contrary to e.g. the `latin' auto-hinter */ metrics->root.scaler = *scaler; af_cjk_metrics_scale_dim( metrics, scaler, AF_DIMENSION_HORZ ); @@ -682,6 +642,9 @@ /*************************************************************************/ /*************************************************************************/ + + /* Walk over all contours and compute its segments. */ + static FT_Error af_cjk_hints_compute_segments( AF_GlyphHints hints, AF_Dimension dim ) @@ -938,7 +901,7 @@ for ( seg = segments; seg < segment_limit; seg++ ) { - AF_Edge found = 0; + AF_Edge found = NULL; FT_Pos best = 0xFFFFU; FT_Int ee; @@ -1026,25 +989,26 @@ } } - /*********************************************************************/ - /* */ - /* Good, we now compute each edge's properties according to segments */ - /* found on its position. Basically, these are as follows. */ - /* */ - /* - edge's main direction */ - /* - stem edge, serif edge or both (which defaults to stem then) */ - /* - rounded edge, straight or both (which defaults to straight) */ - /* - link for edge */ - /* */ - /*********************************************************************/ + /******************************************************************/ + /* */ + /* Good, we now compute each edge's properties according to the */ + /* segments found on its position. Basically, these are */ + /* */ + /* - the edge's main direction */ + /* - stem edge, serif edge or both (which defaults to stem then) */ + /* - rounded edge, straight or both (which defaults to straight) */ + /* - link for edge */ + /* */ + /******************************************************************/ - /* first of all, set the `edge' field in each segment -- this is */ - /* required in order to compute edge links */ - /* */ - /* Note that removing this loop and setting the `edge' field of each */ - /* segment directly in the code above slows down execution speed for */ - /* some reasons on platforms like the Sun. */ + /* first of all, set the `edge' field in each segment -- this is */ + /* required in order to compute edge links */ + /* + * Note that removing this loop and setting the `edge' field of each + * segment directly in the code above slows down execution speed for + * some reasons on platforms like the Sun. + */ { AF_Edge edges = axis->edges; AF_Edge edge_limit = edges + axis->num_edges; @@ -1153,6 +1117,8 @@ } + /* Detect segments and edges for given dimension. */ + static FT_Error af_cjk_hints_detect_features( AF_GlyphHints hints, AF_Dimension dim ) @@ -1171,6 +1137,8 @@ } + /* Compute all edges which lie within blue zones. */ + FT_LOCAL_DEF( void ) af_cjk_hints_compute_blue_edges( AF_GlyphHints hints, AF_CJKMetrics metrics, @@ -1218,10 +1186,8 @@ /* zone, check for left edges */ /* */ /* of course, that's for TrueType */ - is_top_right_blue = - FT_BOOL( ( ( blue->flags & AF_CJK_BLUE_IS_TOP ) != 0 ) || - ( ( blue->flags & AF_CJK_BLUE_IS_RIGHT ) != 0 ) ); - is_major_dir = FT_BOOL( edge->dir == axis->major_dir ); + is_top_right_blue = FT_BOOL( blue->flags & AF_CJK_BLUE_TOP ); + is_major_dir = FT_BOOL( edge->dir == axis->major_dir ); /* if it is a top zone, the edge must be against the major */ /* direction; if it is a bottom zone, it must be in the major */ @@ -1258,6 +1224,8 @@ } + /* Initalize hinting engine. */ + FT_LOCAL_DEF( FT_Error ) af_cjk_hints_init( AF_GlyphHints hints, AF_CJKMetrics metrics ) @@ -1316,7 +1284,7 @@ hints->scaler_flags = scaler_flags; hints->other_flags = other_flags; - return 0; + return FT_Err_Ok; } @@ -1328,8 +1296,8 @@ /*************************************************************************/ /*************************************************************************/ - /* snap a given width in scaled coordinates to one of the */ - /* current standard widths */ + /* Snap a given width in scaled coordinates to one of the */ + /* current standard widths. */ static FT_Pos af_cjk_snap_width( AF_Width widths, @@ -1376,7 +1344,9 @@ } - /* compute the snapped width of a given stem */ + /* Compute the snapped width of a given stem. */ + /* There is a lot of voodoo in this function; changing the hard-coded */ + /* parameters influence the whole hinting process. */ static FT_Pos af_cjk_compute_stem_width( AF_GlyphHints hints, @@ -1385,8 +1355,8 @@ AF_Edge_Flags base_flags, AF_Edge_Flags stem_flags ) { - AF_CJKMetrics metrics = (AF_CJKMetrics) hints->metrics; - AF_CJKAxis axis = & metrics->axis[dim]; + AF_CJKMetrics metrics = (AF_CJKMetrics)hints->metrics; + AF_CJKAxis axis = &metrics->axis[dim]; FT_Pos dist = width; FT_Int sign = 0; FT_Bool vertical = FT_BOOL( dim == AF_DIMENSION_VERT ); @@ -1497,7 +1467,7 @@ } - /* align one stem edge relative to the previous stem edge */ + /* Align one stem edge relative to the previous stem edge. */ static void af_cjk_align_linked_edge( AF_GlyphHints hints, @@ -1517,6 +1487,9 @@ } + /* Shift the coordinates of the `serif' edge by the same amount */ + /* as the corresponding `base' edge has been moved already. */ + static void af_cjk_align_serif_edge( AF_GlyphHints hints, AF_Edge base, @@ -1670,6 +1643,8 @@ } + /* The main grid-fitting routine. */ + static void af_cjk_hint_edges( AF_GlyphHints hints, AF_Dimension dim ) @@ -1685,10 +1660,16 @@ FT_Bool has_last_stem = FALSE; FT_Pos last_stem_pos = 0; +#ifdef FT_DEBUG_LEVEL_TRACE + FT_UInt num_actions = 0; +#endif + + + FT_TRACE5(( "cjk %s edge hinting (script `%s')\n", + dim == AF_DIMENSION_VERT ? "horizontal" : "vertical", + af_script_names[hints->metrics->script_class->script] )); /* we begin by aligning all stems relative to the blue zone */ - FT_TRACE5(( "==== cjk hinting %s edges =====\n", - dim == AF_DIMENSION_HORZ ? "vertical" : "horizontal" )); if ( AF_HINTS_DO_BLUES( hints ) ) { @@ -1719,10 +1700,14 @@ if ( !edge1 ) continue; - FT_TRACE5(( "CJKBLUE: edge %d @%d (opos=%.2f) snapped to (%.2f), " - "was (%.2f)\n", - edge1-edges, edge1->fpos, edge1->opos / 64.0, blue->fit / 64.0, - edge1->pos / 64.0 )); +#ifdef FT_DEBUG_LEVEL_TRACE + FT_TRACE5(( " CJKBLUE: edge %d @%d (opos=%.2f) snapped to %.2f," + " was %.2f\n", + edge1 - edges, edge1->fpos, edge1->opos / 64.0, + blue->fit / 64.0, edge1->pos / 64.0 )); + + num_actions++; +#endif edge1->pos = blue->fit; edge1->flags |= AF_EDGE_DONE; @@ -1731,6 +1716,10 @@ { af_cjk_align_linked_edge( hints, dim, edge1, edge2 ); edge2->flags |= AF_EDGE_DONE; + +#ifdef FT_DEBUG_LEVEL_TRACE + num_actions++; +#endif } if ( !anchor ) @@ -1772,6 +1761,7 @@ } /* now align the stem */ + /* this should not happen, but it's better to be safe */ if ( edge2->blue_edge ) { @@ -1779,6 +1769,11 @@ af_cjk_align_linked_edge( hints, dim, edge2, edge ); edge->flags |= AF_EDGE_DONE; + +#ifdef FT_DEBUG_LEVEL_TRACE + num_actions++; +#endif + continue; } @@ -1786,6 +1781,11 @@ { af_cjk_align_linked_edge( hints, dim, edge2, edge ); edge->flags |= AF_EDGE_DONE; + +#ifdef FT_DEBUG_LEVEL_TRACE + num_actions++; +#endif + /* We rarely reaches here it seems; * usually the two edges belonging * to one stem are marked as DONE together @@ -1953,7 +1953,7 @@ } if ( !skipped ) - return; + goto Exit; /* * now hint the remaining edges (serifs and single) in order @@ -1973,7 +1973,7 @@ } if ( !skipped ) - return; + goto Exit; for ( edge = edges; edge < edge_limit; edge++ ) { @@ -2011,6 +2011,16 @@ } } } + + Exit: + +#ifdef FT_DEBUG_LEVEL_TRACE + if ( !num_actions ) + FT_TRACE5(( " (none)\n" )); + FT_TRACE5(( "\n" )); +#endif + + return; } @@ -2104,6 +2114,8 @@ } + /* Apply the complete hinting algorithm to a CJK glyph. */ + FT_LOCAL_DEF( FT_Error ) af_cjk_hints_apply( AF_GlyphHints hints, FT_Outline* outline, @@ -2191,9 +2203,28 @@ /*************************************************************************/ + AF_DEFINE_WRITING_SYSTEM_CLASS( + af_cjk_writing_system_class, + + AF_WRITING_SYSTEM_CJK, + + sizeof ( AF_CJKMetricsRec ), + + (AF_Script_InitMetricsFunc) af_cjk_metrics_init, + (AF_Script_ScaleMetricsFunc)af_cjk_metrics_scale, + (AF_Script_DoneMetricsFunc) NULL, + + (AF_Script_InitHintsFunc) af_cjk_hints_init, + (AF_Script_ApplyHintsFunc) af_cjk_hints_apply + ) + + /* this corresponds to Unicode 6.0 */ - static const AF_Script_UniRangeRec af_cjk_uniranges[] = + /* XXX: this should probably fine tuned to differentiate better between */ + /* scripts... */ + + static const AF_Script_UniRangeRec af_hani_uniranges[] = { AF_UNIRANGE_REC( 0x1100UL, 0x11FFUL ), /* Hangul Jamo */ AF_UNIRANGE_REC( 0x2E80UL, 0x2EFFUL ), /* CJK Radicals Supplement */ @@ -2231,33 +2262,12 @@ }; - AF_DEFINE_SCRIPT_CLASS( af_cjk_script_class, - AF_SCRIPT_CJK, - af_cjk_uniranges, - 0x7530, /* 田 */ - - sizeof ( AF_CJKMetricsRec ), - - (AF_Script_InitMetricsFunc) af_cjk_metrics_init, - (AF_Script_ScaleMetricsFunc)af_cjk_metrics_scale, - (AF_Script_DoneMetricsFunc) NULL, - - (AF_Script_InitHintsFunc) af_cjk_hints_init, - (AF_Script_ApplyHintsFunc) af_cjk_hints_apply - ) - #else /* !AF_CONFIG_OPTION_CJK */ - static const AF_Script_UniRangeRec af_cjk_uniranges[] = - { - AF_UNIRANGE_REC( 0UL, 0UL ) - }; + AF_DEFINE_WRITING_SYSTEM_CLASS( + af_cjk_writing_system_class, - - AF_DEFINE_SCRIPT_CLASS( af_cjk_script_class, - AF_SCRIPT_CJK, - af_cjk_uniranges, - 0, + AF_WRITING_SYSTEM_CJK, sizeof ( AF_CJKMetricsRec ), @@ -2269,7 +2279,25 @@ (AF_Script_ApplyHintsFunc) NULL ) + + static const AF_Script_UniRangeRec af_hani_uniranges[] = + { + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + #endif /* !AF_CONFIG_OPTION_CJK */ + AF_DEFINE_SCRIPT_CLASS( + af_hani_script_class, + + AF_SCRIPT_HANI, + AF_BLUE_STRINGSET_HANI, + AF_WRITING_SYSTEM_CJK, + + af_hani_uniranges, + 0x7530 /* 田 */ + ) + + /* END */ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afcjk.h b/reactos/lib/3rdparty/freetype/src/autofit/afcjk.h index ab816f20b1e..6f5bdc53d99 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afcjk.h +++ b/reactos/lib/3rdparty/freetype/src/autofit/afcjk.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for CJK script (specification). */ /* */ -/* Copyright 2006, 2007, 2011, 2012 by */ +/* Copyright 2006, 2007, 2011-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -26,39 +26,48 @@ FT_BEGIN_HEADER - /* the CJK-specific script class */ + /* the CJK-specific writing system */ - AF_DECLARE_SCRIPT_CLASS( af_cjk_script_class ) + AF_DECLARE_WRITING_SYSTEM_CLASS( af_cjk_writing_system_class ) + + + /* the CJK-specific script classes */ + + AF_DECLARE_SCRIPT_CLASS( af_hani_script_class ) + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** C J K G L O B A L M E T R I C S *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ - /* CJK (global) metrics management */ /* * CJK glyphs tend to fill the square. So we have both vertical and * horizontal blue zones. But some glyphs have flat bounding strokes that * leave some space between neighbour glyphs. */ - enum - { - AF_CJK_BLUE_TOP, - AF_CJK_BLUE_BOTTOM, - AF_CJK_BLUE_LEFT, - AF_CJK_BLUE_RIGHT, - - AF_CJK_BLUE_MAX - }; +#define AF_CJK_IS_TOP_BLUE( b ) \ + ( (b)->properties & AF_BLUE_PROPERTY_CJK_TOP ) +#define AF_CJK_IS_HORIZ_BLUE( b ) \ + ( (b)->properties & AF_BLUE_PROPERTY_CJK_HORIZ ) +#define AF_CJK_IS_FILLED_BLUE( b ) \ + ( (b)->properties & AF_BLUE_PROPERTY_CJK_FILL ) +#define AF_CJK_IS_RIGHT_BLUE AF_CJK_IS_TOP_BLUE #define AF_CJK_MAX_WIDTHS 16 -#define AF_CJK_MAX_BLUES AF_CJK_BLUE_MAX enum { - AF_CJK_BLUE_ACTIVE = 1 << 0, - AF_CJK_BLUE_IS_TOP = 1 << 1, - AF_CJK_BLUE_IS_RIGHT = 1 << 2, - AF_CJK_BLUE_ADJUSTMENT = 1 << 3, /* used for scale adjustment */ - /* optimization */ + AF_CJK_BLUE_ACTIVE = 1 << 0, /* set if zone height is <= 3/4px */ + AF_CJK_BLUE_TOP = 1 << 1, /* result of AF_CJK_IS_TOP_BLUE */ + AF_CJK_BLUE_ADJUSTMENT = 1 << 2, /* used for scale adjustment */ + /* optimization */ AF_CJK_BLUE_FLAG_MAX }; @@ -77,16 +86,16 @@ FT_BEGIN_HEADER FT_Fixed scale; FT_Pos delta; - FT_UInt width_count; - AF_WidthRec widths[AF_CJK_MAX_WIDTHS]; - FT_Pos edge_distance_threshold; - FT_Pos standard_width; - FT_Bool extra_light; + FT_UInt width_count; /* number of used widths */ + AF_WidthRec widths[AF_CJK_MAX_WIDTHS]; /* widths array */ + FT_Pos edge_distance_threshold; /* used for creating edges */ + FT_Pos standard_width; /* the default stem thickness */ + FT_Bool extra_light; /* is standard width very light? */ /* used for horizontal metrics too for CJK */ FT_Bool control_overshoot; FT_UInt blue_count; - AF_CJKBlueRec blues[AF_CJK_BLUE_MAX]; + AF_CJKBlueRec blues[AF_BLUE_STRINGSET_MAX]; FT_Fixed org_scale; FT_Pos org_delta; diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afdummy.c b/reactos/lib/3rdparty/freetype/src/autofit/afdummy.c index 22944559da0..aaa034d9f92 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afdummy.c +++ b/reactos/lib/3rdparty/freetype/src/autofit/afdummy.c @@ -26,8 +26,13 @@ af_dummy_hints_init( AF_GlyphHints hints, AF_ScriptMetrics metrics ) { - af_glyph_hints_rescale( hints, - metrics ); + af_glyph_hints_rescale( hints, metrics ); + + hints->x_scale = metrics->scaler.x_scale; + hints->y_scale = metrics->scaler.y_scale; + hints->x_delta = metrics->scaler.x_delta; + hints->y_delta = metrics->scaler.y_delta; + return FT_Err_Ok; } @@ -36,17 +41,21 @@ af_dummy_hints_apply( AF_GlyphHints hints, FT_Outline* outline ) { - FT_UNUSED( hints ); - FT_UNUSED( outline ); + FT_Error error; - return FT_Err_Ok; + + error = af_glyph_hints_reload( hints, outline ); + if ( !error ) + af_glyph_hints_save( hints, outline ); + + return error; } - AF_DEFINE_SCRIPT_CLASS( af_dummy_script_class, - AF_SCRIPT_DUMMY, - NULL, - 0, + AF_DEFINE_WRITING_SYSTEM_CLASS( + af_dummy_writing_system_class, + + AF_WRITING_SYSTEM_DUMMY, sizeof ( AF_ScriptMetricsRec ), @@ -59,4 +68,16 @@ ) + AF_DEFINE_SCRIPT_CLASS( + af_dflt_script_class, + + AF_SCRIPT_DFLT, + (AF_Blue_Stringset)0, + AF_WRITING_SYSTEM_DUMMY, + + NULL, + '\0' + ) + + /* END */ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afdummy.h b/reactos/lib/3rdparty/freetype/src/autofit/afdummy.h index 95d8f8cf190..bc34dddaf90 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afdummy.h +++ b/reactos/lib/3rdparty/freetype/src/autofit/afdummy.h @@ -5,7 +5,7 @@ /* Auto-fitter dummy routines to be used if no hinting should be */ /* performed (specification). */ /* */ -/* Copyright 2003-2005, 2011 by */ +/* Copyright 2003-2005, 2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -25,11 +25,13 @@ FT_BEGIN_HEADER - /* A dummy script metrics class used when no hinting should - * be performed. This is the default for non-latin glyphs! + /* A dummy writing system and script class used when no hinting should be + * performed. */ - AF_DECLARE_SCRIPT_CLASS( af_dummy_script_class ) + AF_DECLARE_WRITING_SYSTEM_CLASS( af_dummy_writing_system_class ) + + AF_DECLARE_SCRIPT_CLASS( af_dflt_script_class ) /* */ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afglobal.c b/reactos/lib/3rdparty/freetype/src/autofit/afglobal.c index 3e41465756b..dc62bd7a1f5 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afglobal.c +++ b/reactos/lib/3rdparty/freetype/src/autofit/afglobal.c @@ -17,39 +17,64 @@ #include "afglobal.h" -#include "afdummy.h" -#include "aflatin.h" -#include "afcjk.h" -#include "afindic.h" -#include "afpic.h" + + /* get writing system specific header files */ +#undef WRITING_SYSTEM +#define WRITING_SYSTEM( ws, WS ) /* empty */ +#include "afwrtsys.h" #include "aferrors.h" +#include "afpic.h" -#ifdef FT_OPTION_AUTOFIT2 -#include "aflatin2.h" -#endif #ifndef FT_CONFIG_OPTION_PIC - /* when updating this table, don't forget to update */ - /* AF_SCRIPT_CLASSES_COUNT and autofit_module_class_pic_init */ +#undef WRITING_SYSTEM +#define WRITING_SYSTEM( ws, WS ) \ + &af_ ## ws ## _writing_system_class, - /* populate this list when you add new scripts */ - static AF_ScriptClass const af_script_classes[] = + FT_LOCAL_ARRAY_DEF( AF_WritingSystemClass ) + af_writing_system_classes[] = { - &af_dummy_script_class, -#ifdef FT_OPTION_AUTOFIT2 - &af_latin2_script_class, -#endif - &af_latin_script_class, - &af_cjk_script_class, - &af_indic_script_class, + +#include "afwrtsys.h" + + NULL /* do not remove */ + }; + + +#undef SCRIPT +#define SCRIPT( s, S, d ) \ + &af_ ## s ## _script_class, + + FT_LOCAL_ARRAY_DEF( AF_ScriptClass ) + af_script_classes[] = + { + +#include "afscript.h" + NULL /* do not remove */ }; #endif /* !FT_CONFIG_OPTION_PIC */ +#ifdef FT_DEBUG_LEVEL_TRACE + +#undef SCRIPT +#define SCRIPT( s, S, d ) #s, + + FT_LOCAL_ARRAY_DEF( char* ) + af_script_names[] = + { + +#include "afscript.h" + + }; + +#endif /* FT_DEBUG_LEVEL_TRACE */ + + /* Compute the script index of each glyph within a given face. */ static FT_Error @@ -82,18 +107,20 @@ /* scan each script in a Unicode charmap */ for ( ss = 0; AF_SCRIPT_CLASSES_GET[ss]; ss++ ) { - AF_ScriptClass clazz = AF_SCRIPT_CLASSES_GET[ss]; + AF_ScriptClass script_class = AF_SCRIPT_CLASSES_GET[ss]; AF_Script_UniRange range; - if ( clazz->script_uni_ranges == NULL ) + if ( script_class->script_uni_ranges == NULL ) continue; /* * Scan all Unicode points in the range and set the corresponding * glyph script index. */ - for ( range = clazz->script_uni_ranges; range->first != 0; range++ ) + for ( range = script_class->script_uni_ranges; + range->first != 0; + range++ ) { FT_ULong charcode = range->first; FT_UInt gindex; @@ -204,13 +231,14 @@ { if ( globals->metrics[nn] ) { - AF_ScriptClass clazz = AF_SCRIPT_CLASSES_GET[nn]; + AF_ScriptClass script_class = + AF_SCRIPT_CLASSES_GET[nn]; + AF_WritingSystemClass writing_system_class = + AF_WRITING_SYSTEM_CLASSES_GET[script_class->writing_system]; - FT_ASSERT( globals->metrics[nn]->clazz == clazz ); - - if ( clazz->script_metrics_done ) - clazz->script_metrics_done( globals->metrics[nn] ); + if ( writing_system_class->script_metrics_done ) + writing_system_class->script_metrics_done( globals->metrics[nn] ); FT_FREE( globals->metrics[nn] ); } @@ -232,12 +260,12 @@ AF_ScriptMetrics *ametrics ) { AF_ScriptMetrics metrics = NULL; - FT_UInt gidx; - AF_ScriptClass clazz; - FT_UInt script = options & 15; - const FT_Offset script_max = sizeof ( AF_SCRIPT_CLASSES_GET ) / - sizeof ( AF_SCRIPT_CLASSES_GET[0] ); - FT_Error error = FT_Err_Ok; + + AF_Script script = (AF_Script)( options & 15 ); + AF_WritingSystemClass writing_system_class; + AF_ScriptClass script_class; + + FT_Error error = FT_Err_Ok; if ( gindex >= (FT_ULong)globals->glyph_count ) @@ -246,41 +274,43 @@ goto Exit; } - gidx = script; - if ( gidx == 0 || gidx + 1 >= script_max ) - gidx = globals->glyph_scripts[gindex] & AF_SCRIPT_NONE; + /* if we have a forced script (via `options'), use it, */ + /* otherwise look into `glyph_scripts' array */ + if ( script == AF_SCRIPT_DFLT || script + 1 >= AF_SCRIPT_MAX ) + script = (AF_Script)( globals->glyph_scripts[gindex] & AF_SCRIPT_NONE ); - clazz = AF_SCRIPT_CLASSES_GET[gidx]; - if ( script == 0 ) - script = clazz->script; + script_class = AF_SCRIPT_CLASSES_GET[script]; + writing_system_class = AF_WRITING_SYSTEM_CLASSES_GET + [script_class->writing_system]; - metrics = globals->metrics[clazz->script]; + metrics = globals->metrics[script]; if ( metrics == NULL ) { /* create the global metrics object if necessary */ FT_Memory memory = globals->face->memory; - if ( FT_ALLOC( metrics, clazz->script_metrics_size ) ) + if ( FT_ALLOC( metrics, writing_system_class->script_metrics_size ) ) goto Exit; - metrics->clazz = clazz; - metrics->globals = globals; + metrics->script_class = script_class; + metrics->globals = globals; - if ( clazz->script_metrics_init ) + if ( writing_system_class->script_metrics_init ) { - error = clazz->script_metrics_init( metrics, globals->face ); + error = writing_system_class->script_metrics_init( metrics, + globals->face ); if ( error ) { - if ( clazz->script_metrics_done ) - clazz->script_metrics_done( metrics ); + if ( writing_system_class->script_metrics_done ) + writing_system_class->script_metrics_done( metrics ); FT_FREE( metrics ); goto Exit; } } - globals->metrics[clazz->script] = metrics; + globals->metrics[script] = metrics; } Exit: diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afglobal.h b/reactos/lib/3rdparty/freetype/src/autofit/afglobal.h index 2e249008224..227eee752ad 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afglobal.h +++ b/reactos/lib/3rdparty/freetype/src/autofit/afglobal.h @@ -5,7 +5,7 @@ /* Auto-fitter routines to compute global hinting values */ /* (specification). */ /* */ -/* Copyright 2003-2005, 2007, 2009, 2011-2012 by */ +/* Copyright 2003-2005, 2007, 2009, 2011-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -28,13 +28,28 @@ FT_BEGIN_HEADER + FT_LOCAL_ARRAY( AF_WritingSystemClass ) + af_writing_system_classes[]; + + FT_LOCAL_ARRAY( AF_ScriptClass ) + af_script_classes[]; + +#ifdef FT_DEBUG_LEVEL_TRACE + FT_LOCAL_ARRAY( char* ) + af_script_names[]; +#endif + /* * Default values and flags for both autofitter globals (found in * AF_ModuleRec) and face globals (in AF_FaceGlobalsRec). */ /* index of fallback script in `af_script_classes' */ -#define AF_SCRIPT_FALLBACK 2 +#ifdef AF_CONFIG_OPTION_CJK +#define AF_SCRIPT_FALLBACK AF_SCRIPT_HANI +#else +#define AF_SCRIPT_FALLBACK AF_SCRIPT_DFLT +#endif /* a bit mask indicating an uncovered glyph */ #define AF_SCRIPT_NONE 0x7F /* if this flag is set, we have an ASCII digit */ @@ -55,8 +70,8 @@ FT_BEGIN_HEADER /* - * Note that glyph_scripts[] is used to map each glyph into - * an index into the `af_script_classes' array. + * Note that glyph_scripts[] maps each glyph to an index into the + * `af_script_classes' array. * */ typedef struct AF_FaceGlobalsRec_ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afhints.c b/reactos/lib/3rdparty/freetype/src/autofit/afhints.c index e8defaa88db..ce504cccac2 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afhints.c +++ b/reactos/lib/3rdparty/freetype/src/autofit/afhints.c @@ -144,6 +144,17 @@ #include FT_CONFIG_STANDARD_LIBRARY_H + /* The dump functions are used in the `ftgrid' demo program, too. */ +#define AF_DUMP( varformat ) \ + do \ + { \ + if ( to_stdout ) \ + printf varformat; \ + else \ + FT_TRACE7( varformat ); \ + } while ( 0 ) + + static const char* af_dir_str( AF_Direction dir ) { @@ -179,34 +190,35 @@ extern "C" { #endif void - af_glyph_hints_dump_points( AF_GlyphHints hints ) + af_glyph_hints_dump_points( AF_GlyphHints hints, + FT_Bool to_stdout ) { AF_Point points = hints->points; AF_Point limit = points + hints->num_points; AF_Point point; - FT_TRACE7(( "Table of points:\n" - " [ index | xorg | yorg | xscale | yscale" - " | xfit | yfit | flags ]\n" )); + AF_DUMP(( "Table of points:\n" + " [ index | xorg | yorg | xscale | yscale" + " | xfit | yfit | flags ]\n" )); for ( point = points; point < limit; point++ ) - FT_TRACE7(( " [ %5d | %5d | %5d | %6.2f | %6.2f" - " | %5.2f | %5.2f | %c%c%c%c%c%c ]\n", - point - points, - point->fx, - point->fy, - point->ox / 64.0, - point->oy / 64.0, - point->x / 64.0, - point->y / 64.0, - ( point->flags & AF_FLAG_WEAK_INTERPOLATION ) ? 'w' : ' ', - ( point->flags & AF_FLAG_INFLECTION ) ? 'i' : ' ', - ( point->flags & AF_FLAG_EXTREMA_X ) ? '<' : ' ', - ( point->flags & AF_FLAG_EXTREMA_Y ) ? 'v' : ' ', - ( point->flags & AF_FLAG_ROUND_X ) ? '(' : ' ', - ( point->flags & AF_FLAG_ROUND_Y ) ? 'u' : ' ')); - FT_TRACE7(( "\n" )); + AF_DUMP(( " [ %5d | %5d | %5d | %6.2f | %6.2f" + " | %5.2f | %5.2f | %c%c%c%c%c%c ]\n", + point - points, + point->fx, + point->fy, + point->ox / 64.0, + point->oy / 64.0, + point->x / 64.0, + point->y / 64.0, + ( point->flags & AF_FLAG_WEAK_INTERPOLATION ) ? 'w' : ' ', + ( point->flags & AF_FLAG_INFLECTION ) ? 'i' : ' ', + ( point->flags & AF_FLAG_EXTREMA_X ) ? '<' : ' ', + ( point->flags & AF_FLAG_EXTREMA_Y ) ? 'v' : ' ', + ( point->flags & AF_FLAG_ROUND_X ) ? '(' : ' ', + ( point->flags & AF_FLAG_ROUND_Y ) ? 'u' : ' ')); + AF_DUMP(( "\n" )); } #ifdef __cplusplus } @@ -247,7 +259,8 @@ extern "C" { #endif void - af_glyph_hints_dump_segments( AF_GlyphHints hints ) + af_glyph_hints_dump_segments( AF_GlyphHints hints, + FT_Bool to_stdout ) { FT_Int dimension; @@ -262,34 +275,34 @@ AF_Segment seg; - FT_TRACE7(( "Table of %s segments:\n", - dimension == AF_DIMENSION_HORZ ? "vertical" - : "horizontal" )); + AF_DUMP(( "Table of %s segments:\n", + dimension == AF_DIMENSION_HORZ ? "vertical" + : "horizontal" )); if ( axis->num_segments ) - FT_TRACE7(( " [ index | pos | dir | from" - " | to | link | serif | edge" - " | height | extra | flags ]\n" )); + AF_DUMP(( " [ index | pos | dir | from" + " | to | link | serif | edge" + " | height | extra | flags ]\n" )); else - FT_TRACE7(( " (none)\n" )); + AF_DUMP(( " (none)\n" )); for ( seg = segments; seg < limit; seg++ ) - FT_TRACE7(( " [ %5d | %5.2g | %5s | %4d" - " | %4d | %4d | %5d | %4d" - " | %6d | %5d | %11s ]\n", - seg - segments, - dimension == AF_DIMENSION_HORZ - ? (int)seg->first->ox / 64.0 - : (int)seg->first->oy / 64.0, - af_dir_str( (AF_Direction)seg->dir ), - AF_INDEX_NUM( seg->first, points ), - AF_INDEX_NUM( seg->last, points ), - AF_INDEX_NUM( seg->link, segments ), - AF_INDEX_NUM( seg->serif, segments ), - AF_INDEX_NUM( seg->edge, edges ), - seg->height, - seg->height - ( seg->max_coord - seg->min_coord ), - af_edge_flags_to_string( (AF_Edge_Flags)seg->flags ) )); - FT_TRACE7(( "\n" )); + AF_DUMP(( " [ %5d | %5.2g | %5s | %4d" + " | %4d | %4d | %5d | %4d" + " | %6d | %5d | %11s ]\n", + seg - segments, + dimension == AF_DIMENSION_HORZ + ? (int)seg->first->ox / 64.0 + : (int)seg->first->oy / 64.0, + af_dir_str( (AF_Direction)seg->dir ), + AF_INDEX_NUM( seg->first, points ), + AF_INDEX_NUM( seg->last, points ), + AF_INDEX_NUM( seg->link, segments ), + AF_INDEX_NUM( seg->serif, segments ), + AF_INDEX_NUM( seg->edge, edges ), + seg->height, + seg->height - ( seg->max_coord - seg->min_coord ), + af_edge_flags_to_string( (AF_Edge_Flags)seg->flags ) )); + AF_DUMP(( "\n" )); } } #ifdef __cplusplus @@ -366,7 +379,8 @@ extern "C" { #endif void - af_glyph_hints_dump_edges( AF_GlyphHints hints ) + af_glyph_hints_dump_edges( AF_GlyphHints hints, + FT_Bool to_stdout ) { FT_Int dimension; @@ -383,94 +397,35 @@ * note: AF_DIMENSION_HORZ corresponds to _vertical_ edges * since they have a constant X coordinate. */ - FT_TRACE7(( "Table of %s edges:\n", - dimension == AF_DIMENSION_HORZ ? "vertical" - : "horizontal" )); + AF_DUMP(( "Table of %s edges:\n", + dimension == AF_DIMENSION_HORZ ? "vertical" + : "horizontal" )); if ( axis->num_edges ) - FT_TRACE7(( " [ index | pos | dir | link" - " | serif | blue | opos | pos | flags ]\n" )); + AF_DUMP(( " [ index | pos | dir | link" + " | serif | blue | opos | pos | flags ]\n" )); else - FT_TRACE7(( " (none)\n" )); + AF_DUMP(( " (none)\n" )); for ( edge = edges; edge < limit; edge++ ) - FT_TRACE7(( " [ %5d | %5.2g | %5s | %4d" - " | %5d | %c | %5.2f | %5.2f | %11s ]\n", - edge - edges, - (int)edge->opos / 64.0, - af_dir_str( (AF_Direction)edge->dir ), - AF_INDEX_NUM( edge->link, edges ), - AF_INDEX_NUM( edge->serif, edges ), - edge->blue_edge ? 'y' : 'n', - edge->opos / 64.0, - edge->pos / 64.0, - af_edge_flags_to_string( (AF_Edge_Flags)edge->flags ) )); - FT_TRACE7(( "\n" )); + AF_DUMP(( " [ %5d | %5.2g | %5s | %4d" + " | %5d | %c | %5.2f | %5.2f | %11s ]\n", + edge - edges, + (int)edge->opos / 64.0, + af_dir_str( (AF_Direction)edge->dir ), + AF_INDEX_NUM( edge->link, edges ), + AF_INDEX_NUM( edge->serif, edges ), + edge->blue_edge ? 'y' : 'n', + edge->opos / 64.0, + edge->pos / 64.0, + af_edge_flags_to_string( (AF_Edge_Flags)edge->flags ) )); + AF_DUMP(( "\n" )); } } #ifdef __cplusplus } #endif -#else /* !FT_DEBUG_AUTOFIT */ - - /* these empty stubs are only used to link the `ftgrid' test program */ - /* if debugging is disabled */ - -#ifdef __cplusplus - extern "C" { -#endif - - void - af_glyph_hints_dump_points( AF_GlyphHints hints ) - { - FT_UNUSED( hints ); - } - - - void - af_glyph_hints_dump_segments( AF_GlyphHints hints ) - { - FT_UNUSED( hints ); - } - - - FT_Error - af_glyph_hints_get_num_segments( AF_GlyphHints hints, - FT_Int dimension, - FT_Int* num_segments ) - { - FT_UNUSED( hints ); - FT_UNUSED( dimension ); - FT_UNUSED( num_segments ); - - return 0; - } - - - FT_Error - af_glyph_hints_get_segment_offset( AF_GlyphHints hints, - FT_Int dimension, - FT_Int idx, - FT_Pos* offset ) - { - FT_UNUSED( hints ); - FT_UNUSED( dimension ); - FT_UNUSED( idx ); - FT_UNUSED( offset ); - - return 0; - } - - - void - af_glyph_hints_dump_edges( AF_GlyphHints hints ) - { - FT_UNUSED( hints ); - } - -#ifdef __cplusplus - } -#endif +#undef AF_DUMP #endif /* !FT_DEBUG_AUTOFIT */ @@ -740,6 +695,12 @@ FT_Pos in_y = 0; AF_Direction in_dir = AF_DIR_NONE; + FT_Pos last_good_in_x = 0; + FT_Pos last_good_in_y = 0; + + FT_UInt units_per_em = hints->metrics->scaler.face->units_per_EM; + FT_Int near_limit = 20 * units_per_em / 2048; + for ( point = points; point < point_limit; point++ ) { @@ -749,15 +710,59 @@ if ( point == first ) { - prev = first->prev; - in_x = first->fx - prev->fx; - in_y = first->fy - prev->fy; + prev = first->prev; + + in_x = first->fx - prev->fx; + in_y = first->fy - prev->fy; + + last_good_in_x = in_x; + last_good_in_y = in_y; + + if ( FT_ABS( in_x ) + FT_ABS( in_y ) < near_limit ) + { + /* search first non-near point to get a good `in_dir' value */ + + AF_Point point_ = prev; + + + while ( point_ != first ) + { + AF_Point prev_ = point_->prev; + + FT_Pos in_x_ = point_->fx - prev_->fx; + FT_Pos in_y_ = point_->fy - prev_->fy; + + + if ( FT_ABS( in_x_ ) + FT_ABS( in_y_ ) >= near_limit ) + { + last_good_in_x = in_x_; + last_good_in_y = in_y_; + + break; + } + + point_ = prev_; + } + } + in_dir = af_direction_compute( in_x, in_y ); first = prev + 1; } point->in_dir = (FT_Char)in_dir; + /* check whether the current point is near to the previous one */ + /* (value 20 in `near_limit' is heuristic; we use Taxicab */ + /* metrics for the test) */ + + if ( FT_ABS( in_x ) + FT_ABS( in_y ) < near_limit ) + point->flags |= AF_FLAG_NEAR; + else + { + last_good_in_x = in_x; + last_good_in_y = in_y; + } + next = point->next; out_x = next->fx - point->fx; out_y = next->fy - point->fy; @@ -765,23 +770,43 @@ in_dir = af_direction_compute( out_x, out_y ); point->out_dir = (FT_Char)in_dir; - /* check for weak points */ + /* Check for weak points. The remaining points not collected */ + /* in edges are then implicitly classified as strong points. */ if ( point->flags & AF_FLAG_CONTROL ) { + /* control points are always weak */ Is_Weak_Point: point->flags |= AF_FLAG_WEAK_INTERPOLATION; } else if ( point->out_dir == point->in_dir ) { if ( point->out_dir != AF_DIR_NONE ) + { + /* current point lies on a horizontal or */ + /* vertical segment (but doesn't start or end it) */ goto Is_Weak_Point; + } - if ( ft_corner_is_flat( in_x, in_y, out_x, out_y ) ) + /* test whether `in' and `out' direction is approximately */ + /* the same (and use the last good `in' vector in case */ + /* the current point is near to the previous one) */ + if ( ft_corner_is_flat( + point->flags & AF_FLAG_NEAR ? last_good_in_x : in_x, + point->flags & AF_FLAG_NEAR ? last_good_in_y : in_y, + out_x, + out_y ) ) + { + /* current point lies on a straight, diagonal line */ + /* (more or less) */ goto Is_Weak_Point; + } } else if ( point->in_dir == -point->out_dir ) + { + /* current point forms a spike */ goto Is_Weak_Point; + } in_x = out_x; in_y = out_y; diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afhints.h b/reactos/lib/3rdparty/freetype/src/autofit/afhints.h index 776b3c844eb..ce5232545cc 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afhints.h +++ b/reactos/lib/3rdparty/freetype/src/autofit/afhints.h @@ -62,15 +62,19 @@ FT_BEGIN_HEADER * * by David Turner and Werner Lemberg * - * http://www.tug.org/TUGboat/Articles/tb24-3/lemberg.pdf + * http://www.tug.org/TUGboat/Articles/tb24-3/lemberg.pdf + * + * with appropriate updates. * * * Segments * * `af_{cjk,latin,...}_hints_compute_segments' are the functions to - * find segments in an outline. A segment is a series of consecutive - * points that are approximately aligned along a coordinate axis. The - * analysis to do so is specific to a script. + * find segments in an outline. + * + * A segment is a series of consecutive points that are approximately + * aligned along a coordinate axis. The analysis to do so is specific + * to a writing system. * * A segment must have at least two points, except in the case of * `fake' segments that are generated to hint metrics appropriately, @@ -79,16 +83,17 @@ FT_BEGIN_HEADER * * Edges * + * `af_{cjk,latin,...}_hints_compute_edges' are the functions to find + * edges. + * * As soon as segments are defined, the auto-hinter groups them into * edges. An edge corresponds to a single position on the main * dimension that collects one or more segments (allowing for a small * threshold). * - * The auto-hinter first tries to grid fit edges, then to align - * segments on the edges unless it detects that they form a serif. - * - * `af_{cjk,latin,...}_hints_compute_edges' are the functions to find - * edges; they are specific to a script. + * As an example, the `latin' writing system first tries to grid-fit + * edges, then to align segments on the edges unless it detects that + * they form a serif. * * * A H @@ -107,6 +112,8 @@ FT_BEGIN_HEADER * * Stems * + * Stems are detected by `af_{cjk,latin,...}_hint_edges'. + * * Segments need to be `linked' to other ones in order to detect stems. * A stem is made of two segments that face each other in opposite * directions and that are sufficiently close to each other. Using @@ -127,17 +134,21 @@ FT_BEGIN_HEADER * The best candidate is stored in field `link' in structure * `AF_Segment'. * - * Stems are detected by `af_{cjk,latin,...}_hint_edges'. - * * In the above ASCII drawing, the best candidate for both AB and CD is * GH, while the best candidate for GH is AB. Similarly, the best * candidate for EF and GH is AB, while the best candidate for AB is * GH. * + * The detection and handling of stems is dependent on the writing + * system. + * * * Serifs * - * On the opposite, a serif has + * Serifs are detected by `af_{cjk,latin,...}_hint_edges'. + * + * In comparison to a stem, a serif (as handled by the auto-hinter + * module which takes care of the `latin' writing system) has * * best segment_1 = segment_2 && best segment_2 != segment_1 * @@ -147,8 +158,6 @@ FT_BEGIN_HEADER * The best candidate is stored in field `serif' in structure * `AF_Segment' (and `link' is set to NULL). * - * Serifs are detected by `af_{cjk,latin,...}_hint_edges'. - * * * Touched points * @@ -178,7 +187,8 @@ FT_BEGIN_HEADER * differ greatly) * * - inflection points (i.e., where the `in' and `out' angles are the - * same, but the curvature changes sign) + * same, but the curvature changes sign) [currently, such points + * aren't handled in the auto-hinter] * * `af_glyph_hints_align_strong_points' is the function which takes * care of such situations; it is equivalent to the TrueType `IP' @@ -226,7 +236,10 @@ FT_BEGIN_HEADER AF_FLAG_WEAK_INTERPOLATION = 1 << 8, /* all inflection points in the outline have this flag set */ - AF_FLAG_INFLECTION = 1 << 9 + AF_FLAG_INFLECTION = 1 << 9, + + /* the current point is very near to another one */ + AF_FLAG_NEAR = 1 << 10 } AF_Flags; diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afindic.c b/reactos/lib/3rdparty/freetype/src/autofit/afindic.c index 8c249725988..ef8299f89df 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afindic.c +++ b/reactos/lib/3rdparty/freetype/src/autofit/afindic.c @@ -97,26 +97,10 @@ /*************************************************************************/ - static const AF_Script_UniRangeRec af_indic_uniranges[] = - { -#if 0 - AF_UNIRANGE_REC( 0x0100UL, 0xFFFFUL ), /* why this? */ -#endif - AF_UNIRANGE_REC( 0x0900UL, 0x0DFFUL), /* Indic Range */ - AF_UNIRANGE_REC( 0x0F00UL, 0x0FFFUL), /* Tibetan */ - AF_UNIRANGE_REC( 0x1900UL, 0x194FUL), /* Limbu */ - AF_UNIRANGE_REC( 0x1B80UL, 0x1BBFUL), /* Sundanese */ - AF_UNIRANGE_REC( 0x1C80UL, 0x1CDFUL), /* Meetei Mayak */ - AF_UNIRANGE_REC( 0xA800UL, 0xA82FUL), /* Syloti Nagri */ - AF_UNIRANGE_REC( 0x11800UL, 0x118DFUL), /* Sharada */ - AF_UNIRANGE_REC( 0UL, 0UL) - }; + AF_DEFINE_WRITING_SYSTEM_CLASS( + af_indic_writing_system_class, - - AF_DEFINE_SCRIPT_CLASS( af_indic_script_class, - AF_SCRIPT_INDIC, - af_indic_uniranges, - 'o', /* XXX */ + AF_WRITING_SYSTEM_INDIC, sizeof ( AF_CJKMetricsRec ), @@ -128,18 +112,28 @@ (AF_Script_ApplyHintsFunc) af_indic_hints_apply ) -#else /* !AF_CONFIG_OPTION_INDIC */ + /* XXX: this should probably fine tuned to differentiate better between */ + /* scripts... */ - static const AF_Script_UniRangeRec af_indic_uniranges[] = + static const AF_Script_UniRangeRec af_deva_uniranges[] = { - { 0, 0 } + AF_UNIRANGE_REC( 0x0900UL, 0x0DFFUL ), /* Indic Range */ + AF_UNIRANGE_REC( 0x0F00UL, 0x0FFFUL ), /* Tibetan */ + AF_UNIRANGE_REC( 0x1900UL, 0x194FUL ), /* Limbu */ + AF_UNIRANGE_REC( 0x1B80UL, 0x1BBFUL ), /* Sundanese */ + AF_UNIRANGE_REC( 0x1C80UL, 0x1CDFUL ), /* Meetei Mayak */ + AF_UNIRANGE_REC( 0xA800UL, 0xA82FUL ), /* Syloti Nagri */ + AF_UNIRANGE_REC( 0x11800UL, 0x118DFUL ), /* Sharada */ + AF_UNIRANGE_REC( 0UL, 0UL ) }; - AF_DEFINE_SCRIPT_CLASS( af_indic_script_class, - AF_SCRIPT_INDIC, - af_indic_uniranges, - 0, +#else /* !AF_CONFIG_OPTION_INDIC */ + + AF_DEFINE_WRITING_SYSTEM_CLASS( + af_indic_writing_system_class, + + AF_WRITING_SYSTEM_INDIC, sizeof ( AF_CJKMetricsRec ), @@ -151,7 +145,25 @@ (AF_Script_ApplyHintsFunc) NULL ) + + static const AF_Script_UniRangeRec af_deva_uniranges[] = + { + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + #endif /* !AF_CONFIG_OPTION_INDIC */ + AF_DEFINE_SCRIPT_CLASS( + af_deva_script_class, + + AF_SCRIPT_DEVA, + (AF_Blue_Stringset)0, /* XXX */ + AF_WRITING_SYSTEM_INDIC, + + af_deva_uniranges, + 'o' /* XXX */ + ) + + /* END */ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afindic.h b/reactos/lib/3rdparty/freetype/src/autofit/afindic.h index c252cf20da6..db38e9674f4 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afindic.h +++ b/reactos/lib/3rdparty/freetype/src/autofit/afindic.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for Indic scripts (specification). */ /* */ -/* Copyright 2007, 2012 by */ +/* Copyright 2007, 2012, 2013 by */ /* Rahul Bhalerao , . */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -25,9 +25,14 @@ FT_BEGIN_HEADER - /* the Indic-specific script class */ + /* the `indic' writing system */ - AF_DECLARE_SCRIPT_CLASS( af_indic_script_class ) + AF_DECLARE_WRITING_SYSTEM_CLASS( af_indic_writing_system_class ) + + + /* the indic-specific script classes */ + + AF_DECLARE_SCRIPT_CLASS( af_deva_script_class ) /* */ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/aflatin.c b/reactos/lib/3rdparty/freetype/src/autofit/aflatin.c index ef0157a13ee..15a241e523a 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/aflatin.c +++ b/reactos/lib/3rdparty/freetype/src/autofit/aflatin.c @@ -60,8 +60,11 @@ AF_GlyphHintsRec hints[1]; - FT_TRACE5(( "standard widths computation\n" - "===========================\n\n" )); + FT_TRACE5(( "\n" + "latin standard widths computation (script `%s')\n" + "=================================================\n" + "\n", + af_script_names[metrics->root.script_class->script] )); af_glyph_hints_init( hints, face->memory ); @@ -76,13 +79,14 @@ AF_Scaler scaler = &dummy->root.scaler; - glyph_index = FT_Get_Char_Index( face, - metrics->root.clazz->standard_char ); + glyph_index = FT_Get_Char_Index( + face, + metrics->root.script_class->standard_char ); if ( glyph_index == 0 ) goto Exit; - FT_TRACE5(( "standard character: 0x%X (glyph index %d)\n", - metrics->root.clazz->standard_char, glyph_index )); + FT_TRACE5(( "standard character: U+%04lX (glyph index %d)\n", + metrics->root.script_class->standard_char, glyph_index )); error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); if ( error || face->glyph->outline.n_points <= 0 ) @@ -146,22 +150,21 @@ } /* this also replaces multiple almost identical stem widths */ - /* with a single one (the value 100 is heuristic) */ + /* with a single one (the value 100 is heuristic) */ af_sort_and_quantize_widths( &num_widths, axis->widths, dummy->units_per_em / 100 ); axis->width_count = num_widths; } - Exit: + Exit: for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) { AF_LatinAxis axis = &metrics->axis[dim]; FT_Pos stdw; - stdw = ( axis->width_count > 0 ) - ? axis->widths[0].org - : AF_LATIN_CONSTANT( metrics, 50 ); + stdw = ( axis->width_count > 0 ) ? axis->widths[0].org + : AF_LATIN_CONSTANT( metrics, 50 ); /* let's try 20% of the smallest width */ axis->edge_distance_threshold = stdw / 5; @@ -193,22 +196,6 @@ } - -#define AF_LATIN_MAX_TEST_CHARACTERS 12 - - - static const char af_latin_blue_chars[AF_LATIN_MAX_BLUES] - [AF_LATIN_MAX_TEST_CHARACTERS + 1] = - { - "THEZOCQS", - "HEZLOCUS", - "fijkdbh", - "xzroesc", - "xzroesc", - "pqgjy" - }; - - /* Find all blue zones. Flat segments give the reference points, */ /* round segments the overshoot positions. */ @@ -216,39 +203,80 @@ af_latin_metrics_init_blues( AF_LatinMetrics metrics, FT_Face face ) { - FT_Pos flats [AF_LATIN_MAX_TEST_CHARACTERS]; - FT_Pos rounds[AF_LATIN_MAX_TEST_CHARACTERS]; + FT_Pos flats [AF_BLUE_STRING_MAX_LEN]; + FT_Pos rounds[AF_BLUE_STRING_MAX_LEN]; + FT_Int num_flats; FT_Int num_rounds; - FT_Int bb; + AF_LatinBlue blue; FT_Error error; - AF_LatinAxis axis = &metrics->axis[AF_DIMENSION_VERT]; + AF_LatinAxis axis = &metrics->axis[AF_DIMENSION_VERT]; FT_Outline outline; + AF_Blue_Stringset bss = metrics->root.script_class->blue_stringset; + const AF_Blue_StringRec* bs = &af_blue_stringsets[bss]; - /* we compute the blues simply by loading each character from the */ - /* `af_latin_blue_chars[blues]' string, then finding its top-most or */ - /* bottom-most points (depending on `AF_IS_TOP_BLUE') */ - FT_TRACE5(( "blue zones computation\n" - "======================\n\n" )); + /* we walk over the blue character strings as specified in the */ + /* script's entry in the `af_blue_stringset' array */ - for ( bb = 0; bb < AF_LATIN_BLUE_MAX; bb++ ) + FT_TRACE5(( "latin blue zones computation\n" + "============================\n" + "\n" )); + + for ( ; bs->string != AF_BLUE_STRING_MAX; bs++ ) { - const char* p = af_latin_blue_chars[bb]; - const char* limit = p + AF_LATIN_MAX_TEST_CHARACTERS; + const char* p = &af_blue_strings[bs->string]; FT_Pos* blue_ref; FT_Pos* blue_shoot; - FT_TRACE5(( "blue zone %d:\n", bb )); +#ifdef FT_DEBUG_LEVEL_TRACE + { + FT_Bool have_flag = 0; + + + FT_TRACE5(( "blue zone %d", axis->blue_count )); + + if ( bs->properties ) + { + FT_TRACE5(( " (" )); + + if ( AF_LATIN_IS_TOP_BLUE( bs ) ) + { + FT_TRACE5(( "top" )); + have_flag = 1; + } + + if ( AF_LATIN_IS_X_HEIGHT_BLUE( bs ) ) + { + if ( have_flag ) + FT_TRACE5(( ", " )); + FT_TRACE5(( "small top" )); + have_flag = 1; + } + + if ( AF_LATIN_IS_LONG_BLUE( bs ) ) + { + if ( have_flag ) + FT_TRACE5(( ", " )); + FT_TRACE5(( "long" )); + } + + FT_TRACE5(( ")" )); + } + + FT_TRACE5(( ":\n" )); + } +#endif /* FT_DEBUG_LEVEL_TRACE */ num_flats = 0; num_rounds = 0; - for ( ; p < limit && *p; p++ ) + while ( *p ) { + FT_ULong ch; FT_UInt glyph_index; FT_Pos best_y; /* same as points.y */ FT_Int best_point, best_contour_first, best_contour_last; @@ -256,15 +284,23 @@ FT_Bool round = 0; + GET_UTF8_CHAR( ch, p ); + /* load the character in the face -- skip unknown or empty ones */ - glyph_index = FT_Get_Char_Index( face, (FT_UInt)*p ); + glyph_index = FT_Get_Char_Index( face, ch ); if ( glyph_index == 0 ) + { + FT_TRACE5(( " U+%04lX unavailable\n", ch )); continue; + } error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); outline = face->glyph->outline; if ( error || outline.n_points <= 0 ) + { + FT_TRACE5(( " U+%04lX contains no outlines\n", ch )); continue; + } /* now compute min or max point indices and coordinates */ points = outline.points; @@ -289,11 +325,11 @@ /* Avoid single-point contours since they are never rasterized. */ /* In some fonts, they correspond to mark attachment points */ - /* which are way outside of the glyph's real outline. */ + /* that are way outside of the glyph's real outline. */ if ( last <= first ) continue; - if ( AF_LATIN_IS_TOP_BLUE( bb ) ) + if ( AF_LATIN_IS_TOP_BLUE( bs ) ) { for ( pp = first; pp <= last; pp++ ) if ( best_point < 0 || points[pp].y > best_y ) @@ -318,7 +354,6 @@ best_contour_last = last; } } - FT_TRACE5(( " %c %ld", *p, best_y )); } /* now check whether the point belongs to a straight or round */ @@ -328,10 +363,14 @@ { FT_Pos best_x = points[best_point].x; FT_Int prev, next; + FT_Int best_segment_first, best_segment_last; FT_Int best_on_point_first, best_on_point_last; FT_Pos dist; + best_segment_first = best_point; + best_segment_last = best_point; + if ( FT_CURVE_TAG( outline.tags[best_point] ) == FT_CURVE_TAG_ON ) { best_on_point_first = best_point; @@ -343,8 +382,9 @@ best_on_point_last = -1; } - /* look for the previous and next points that are not on the */ - /* same Y coordinate, then threshold the `closeness'... */ + /* look for the previous and next points on the contour */ + /* that are not on the same Y coordinate, then threshold */ + /* the `closeness'... */ prev = best_point; next = prev; @@ -362,6 +402,8 @@ if ( FT_ABS( points[prev].x - best_x ) <= 20 * dist ) break; + best_segment_first = prev; + if ( FT_CURVE_TAG( outline.tags[prev] ) == FT_CURVE_TAG_ON ) { best_on_point_first = prev; @@ -383,6 +425,8 @@ if ( FT_ABS( points[next].x - best_x ) <= 20 * dist ) break; + best_segment_last = next; + if ( FT_CURVE_TAG( outline.tags[next] ) == FT_CURVE_TAG_ON ) { best_on_point_last = next; @@ -392,8 +436,186 @@ } while ( next != best_point ); - /* now set the `round' flag depending on the segment's kind */ - /* (value 8 is heuristic) */ + if ( AF_LATIN_IS_LONG_BLUE( bs ) ) + { + /* If this flag is set, we have an additional constraint to */ + /* get the blue zone distance: Find a segment of the topmost */ + /* (or bottommost) contour that is longer than a heuristic */ + /* threshold. This ensures that small bumps in the outline */ + /* are ignored (for example, the `vertical serifs' found in */ + /* many Hebrew glyph designs). */ + + /* If this segment is long enough, we are done. Otherwise, */ + /* search the segment next to the extremum that is long */ + /* enough, has the same direction, and a not too large */ + /* vertical distance from the extremum. Note that the */ + /* algorithm doesn't check whether the found segment is */ + /* actually the one (vertically) nearest to the extremum. */ + + /* heuristic threshold value */ + FT_Pos length_threshold = metrics->units_per_em / 25; + + + dist = FT_ABS( points[best_segment_last].x - + points[best_segment_first].x ); + + if ( dist < length_threshold && + best_segment_last - best_segment_first + 2 <= + best_contour_last - best_contour_first ) + { + /* heuristic threshold value */ + FT_Pos height_threshold = metrics->units_per_em / 4; + + FT_Int first; + FT_Int last; + FT_Bool hit; + + FT_Bool left2right; + + + /* compute direction */ + prev = best_point; + + do + { + if ( prev > best_contour_first ) + prev--; + else + prev = best_contour_last; + + if ( points[prev].x != best_x ) + break; + + } while ( prev != best_point ); + + /* skip glyph for the degenerate case */ + if ( prev == best_point ) + continue; + + left2right = FT_BOOL( points[prev].x < points[best_point].x ); + + first = best_segment_last; + last = first; + hit = 0; + + do + { + FT_Bool l2r; + FT_Pos d; + FT_Int p_first, p_last; + + + if ( !hit ) + { + /* no hit; adjust first point */ + first = last; + + /* also adjust first and last on point */ + if ( FT_CURVE_TAG( outline.tags[first] ) == + FT_CURVE_TAG_ON ) + { + p_first = first; + p_last = first; + } + else + { + p_first = -1; + p_last = -1; + } + + hit = 1; + } + + if ( last < best_contour_last ) + last++; + else + last = best_contour_first; + + if ( FT_ABS( best_y - points[first].y ) > height_threshold ) + { + /* vertical distance too large */ + hit = 0; + continue; + } + + /* same test as above */ + dist = FT_ABS( points[last].y - points[first].y ); + if ( dist > 5 ) + if ( FT_ABS( points[last].x - points[first].x ) <= + 20 * dist ) + { + hit = 0; + continue; + } + + if ( FT_CURVE_TAG( outline.tags[last] ) == FT_CURVE_TAG_ON ) + { + p_last = last; + if ( p_first < 0 ) + p_first = last; + } + + l2r = FT_BOOL( points[first].x < points[last].x ); + d = FT_ABS( points[last].x - points[first].x ); + + if ( l2r == left2right && + d >= length_threshold ) + { + /* all constraints are met; update segment after finding */ + /* its end */ + do + { + if ( last < best_contour_last ) + last++; + else + last = best_contour_first; + + d = FT_ABS( points[last].y - points[first].y ); + if ( d > 5 ) + if ( FT_ABS( points[next].x - points[first].x ) <= + 20 * dist ) + { + last--; + break; + } + + p_last = last; + + if ( FT_CURVE_TAG( outline.tags[last] ) == + FT_CURVE_TAG_ON ) + { + p_last = last; + if ( p_first < 0 ) + p_first = last; + } + + } while ( last != best_segment_first ); + + best_y = points[first].y; + + best_segment_first = first; + best_segment_last = last; + + best_on_point_first = p_first; + best_on_point_last = p_last; + + break; + } + + } while ( last != best_segment_first ); + } + } + + FT_TRACE5(( " U+%04lX: best_y = %5ld", ch, best_y )); + + /* now set the `round' flag depending on the segment's kind: */ + /* */ + /* - if the horizontal distance between the first and last */ + /* `on' point is larger than upem/8 (value 8 is heuristic) */ + /* we have a flat segment */ + /* - if either the first or the last point of the segment is */ + /* an `off' point, the segment is round, otherwise it is */ + /* flat */ if ( best_on_point_first >= 0 && best_on_point_last >= 0 && (FT_UInt)( FT_ABS( points[best_on_point_last].x - @@ -402,8 +624,10 @@ round = 0; else round = FT_BOOL( - FT_CURVE_TAG( outline.tags[prev] ) != FT_CURVE_TAG_ON || - FT_CURVE_TAG( outline.tags[next] ) != FT_CURVE_TAG_ON ); + FT_CURVE_TAG( outline.tags[best_segment_first] ) != + FT_CURVE_TAG_ON || + FT_CURVE_TAG( outline.tags[best_segment_last] ) != + FT_CURVE_TAG_ON ); FT_TRACE5(( " (%s)\n", round ? "round" : "flat" )); } @@ -448,7 +672,7 @@ } else { - *blue_ref = flats[num_flats / 2]; + *blue_ref = flats [num_flats / 2]; *blue_shoot = rounds[num_rounds / 2]; } @@ -462,7 +686,7 @@ FT_Bool over_ref = FT_BOOL( shoot > ref ); - if ( AF_LATIN_IS_TOP_BLUE( bb ) ^ over_ref ) + if ( AF_LATIN_IS_TOP_BLUE( bs ) ^ over_ref ) { *blue_ref = *blue_shoot = ( shoot + ref ) / 2; @@ -473,7 +697,7 @@ } blue->flags = 0; - if ( AF_LATIN_IS_TOP_BLUE( bb ) ) + if ( AF_LATIN_IS_TOP_BLUE( bs ) ) blue->flags |= AF_LATIN_BLUE_TOP; /* @@ -481,7 +705,7 @@ * in order to optimize the pixel grid alignment of the top of small * letters. */ - if ( bb == AF_LATIN_BLUE_SMALL_TOP ) + if ( AF_LATIN_IS_X_HEIGHT_BLUE( bs ) ) blue->flags |= AF_LATIN_BLUE_ADJUSTMENT; FT_TRACE5(( " -> reference = %ld\n" @@ -650,7 +874,20 @@ else #endif if ( dim == AF_DIMENSION_VERT ) + { scale = FT_MulDiv( scale, fitted, scaled ); + + FT_TRACE5(( + "af_latin_metrics_scale_dim:" + " x height alignment (script `%s'):\n" + " " + " vertical scaling changed from %.4f to %.4f (by %d%%)\n" + "\n", + af_script_names[metrics->root.script_class->script], + axis->org_scale / 65536.0, + scale / 65536.0, + ( fitted - scaled ) * 100 / scaled )); + } } } } @@ -669,6 +906,10 @@ metrics->root.scaler.y_delta = delta; } + FT_TRACE5(( "%s widths (script `%s')\n", + dim == AF_DIMENSION_HORZ ? "horizontal" : "vertical", + af_script_names[metrics->root.script_class->script] )); + /* scale the widths */ for ( nn = 0; nn < axis->width_count; nn++ ) { @@ -677,15 +918,31 @@ width->cur = FT_MulFix( width->org, scale ); width->fit = width->cur; + + FT_TRACE5(( " %d scaled to %.2f\n", + width->org, + width->cur / 64.0 )); } + FT_TRACE5(( "\n" )); + /* an extra-light axis corresponds to a standard width that is */ /* smaller than 5/8 pixels */ axis->extra_light = (FT_Bool)( FT_MulFix( axis->standard_width, scale ) < 32 + 8 ); +#ifdef FT_DEBUG_LEVEL_TRACE + if ( axis->extra_light ) + FT_TRACE5(( "`%s' script is extra light (at current resolution)\n" + "\n", + af_script_names[metrics->root.script_class->script] )); +#endif + if ( dim == AF_DIMENSION_VERT ) { + FT_TRACE5(( "blue zones (script `%s')\n", + af_script_names[metrics->root.script_class->script] )); + /* scale the blue zones */ for ( nn = 0; nn < axis->blue_count; nn++ ) { @@ -757,6 +1014,19 @@ #endif blue->flags |= AF_LATIN_BLUE_ACTIVE; + + FT_TRACE5(( " reference %d: %d scaled to %.2f%s\n" + " overshoot %d: %d scaled to %.2f%s\n", + nn, + blue->ref.org, + blue->ref.fit / 64.0, + blue->flags & AF_LATIN_BLUE_ACTIVE ? "" + : " (inactive)", + nn, + blue->shoot.org, + blue->shoot.fit / 64.0, + blue->flags & AF_LATIN_BLUE_ACTIVE ? "" + : " (inactive)" )); } } } @@ -1654,8 +1924,8 @@ AF_Edge_Flags base_flags, AF_Edge_Flags stem_flags ) { - AF_LatinMetrics metrics = (AF_LatinMetrics) hints->metrics; - AF_LatinAxis axis = & metrics->axis[dim]; + AF_LatinMetrics metrics = (AF_LatinMetrics)hints->metrics; + AF_LatinAxis axis = &metrics->axis[dim]; FT_Pos dist = width; FT_Int sign = 0; FT_Int vertical = ( dim == AF_DIMENSION_VERT ); @@ -1878,8 +2148,9 @@ #endif - FT_TRACE5(( "%s edge hinting\n", - dim == AF_DIMENSION_VERT ? "horizontal" : "vertical" )); + FT_TRACE5(( "latin %s edge hinting (script `%s')\n", + dim == AF_DIMENSION_VERT ? "horizontal" : "vertical", + af_script_names[hints->metrics->script_class->script] )); /* we begin by aligning all stems relative to the blue zone */ /* if needed -- that's only for horizontal edges */ @@ -2414,6 +2685,7 @@ af_glyph_hints_align_weak_points( hints, (AF_Dimension)dim ); } } + af_glyph_hints_save( hints, outline ); Exit: @@ -2430,47 +2702,10 @@ /*************************************************************************/ - /* XXX: this should probably fine tuned to differentiate better between */ - /* scripts... */ + AF_DEFINE_WRITING_SYSTEM_CLASS( + af_latin_writing_system_class, - static const AF_Script_UniRangeRec af_latin_uniranges[] = - { - AF_UNIRANGE_REC( 0x0020UL, 0x007FUL ), /* Basic Latin (no control chars) */ - AF_UNIRANGE_REC( 0x00A0UL, 0x00FFUL ), /* Latin-1 Supplement (no control chars) */ - AF_UNIRANGE_REC( 0x0100UL, 0x017FUL ), /* Latin Extended-A */ - AF_UNIRANGE_REC( 0x0180UL, 0x024FUL ), /* Latin Extended-B */ - AF_UNIRANGE_REC( 0x0250UL, 0x02AFUL ), /* IPA Extensions */ - AF_UNIRANGE_REC( 0x02B0UL, 0x02FFUL ), /* Spacing Modifier Letters */ - AF_UNIRANGE_REC( 0x0300UL, 0x036FUL ), /* Combining Diacritical Marks */ - AF_UNIRANGE_REC( 0x0370UL, 0x03FFUL ), /* Greek and Coptic */ - AF_UNIRANGE_REC( 0x0400UL, 0x04FFUL ), /* Cyrillic */ - AF_UNIRANGE_REC( 0x0500UL, 0x052FUL ), /* Cyrillic Supplement */ - AF_UNIRANGE_REC( 0x1D00UL, 0x1D7FUL ), /* Phonetic Extensions */ - AF_UNIRANGE_REC( 0x1D80UL, 0x1DBFUL ), /* Phonetic Extensions Supplement */ - AF_UNIRANGE_REC( 0x1DC0UL, 0x1DFFUL ), /* Combining Diacritical Marks Supplement */ - AF_UNIRANGE_REC( 0x1E00UL, 0x1EFFUL ), /* Latin Extended Additional */ - AF_UNIRANGE_REC( 0x1F00UL, 0x1FFFUL ), /* Greek Extended */ - AF_UNIRANGE_REC( 0x2000UL, 0x206FUL ), /* General Punctuation */ - AF_UNIRANGE_REC( 0x2070UL, 0x209FUL ), /* Superscripts and Subscripts */ - AF_UNIRANGE_REC( 0x20A0UL, 0x20CFUL ), /* Currency Symbols */ - AF_UNIRANGE_REC( 0x2150UL, 0x218FUL ), /* Number Forms */ - AF_UNIRANGE_REC( 0x2460UL, 0x24FFUL ), /* Enclosed Alphanumerics */ - AF_UNIRANGE_REC( 0x2C60UL, 0x2C7FUL ), /* Latin Extended-C */ - AF_UNIRANGE_REC( 0x2DE0UL, 0x2DFFUL ), /* Cyrillic Extended-A */ - AF_UNIRANGE_REC( 0x2E00UL, 0x2E7FUL ), /* Supplemental Punctuation */ - AF_UNIRANGE_REC( 0xA640UL, 0xA69FUL ), /* Cyrillic Extended-B */ - AF_UNIRANGE_REC( 0xA720UL, 0xA7FFUL ), /* Latin Extended-D */ - AF_UNIRANGE_REC( 0xFB00UL, 0xFB06UL ), /* Alphab. Present. Forms (Latin Ligs) */ - AF_UNIRANGE_REC( 0x1D400UL, 0x1D7FFUL ), /* Mathematical Alphanumeric Symbols */ - AF_UNIRANGE_REC( 0x1F100UL, 0x1F1FFUL ), /* Enclosed Alphanumeric Supplement */ - AF_UNIRANGE_REC( 0UL, 0UL ) - }; - - - AF_DEFINE_SCRIPT_CLASS( af_latin_script_class, - AF_SCRIPT_LATIN, - af_latin_uniranges, - 'o', + AF_WRITING_SYSTEM_LATIN, sizeof ( AF_LatinMetricsRec ), @@ -2483,4 +2718,103 @@ ) + /* XXX: this should probably fine tuned to differentiate better between */ + /* scripts... */ + + static const AF_Script_UniRangeRec af_latn_uniranges[] = + { + AF_UNIRANGE_REC( 0x0020UL, 0x007FUL ), /* Basic Latin (no control chars) */ + AF_UNIRANGE_REC( 0x00A0UL, 0x00FFUL ), /* Latin-1 Supplement (no control chars) */ + AF_UNIRANGE_REC( 0x0100UL, 0x017FUL ), /* Latin Extended-A */ + AF_UNIRANGE_REC( 0x0180UL, 0x024FUL ), /* Latin Extended-B */ + AF_UNIRANGE_REC( 0x0250UL, 0x02AFUL ), /* IPA Extensions */ + AF_UNIRANGE_REC( 0x02B0UL, 0x02FFUL ), /* Spacing Modifier Letters */ + AF_UNIRANGE_REC( 0x0300UL, 0x036FUL ), /* Combining Diacritical Marks */ + AF_UNIRANGE_REC( 0x1D00UL, 0x1D7FUL ), /* Phonetic Extensions */ + AF_UNIRANGE_REC( 0x1D80UL, 0x1DBFUL ), /* Phonetic Extensions Supplement */ + AF_UNIRANGE_REC( 0x1DC0UL, 0x1DFFUL ), /* Combining Diacritical Marks Supplement */ + AF_UNIRANGE_REC( 0x1E00UL, 0x1EFFUL ), /* Latin Extended Additional */ + AF_UNIRANGE_REC( 0x2000UL, 0x206FUL ), /* General Punctuation */ + AF_UNIRANGE_REC( 0x2070UL, 0x209FUL ), /* Superscripts and Subscripts */ + AF_UNIRANGE_REC( 0x20A0UL, 0x20CFUL ), /* Currency Symbols */ + AF_UNIRANGE_REC( 0x2150UL, 0x218FUL ), /* Number Forms */ + AF_UNIRANGE_REC( 0x2460UL, 0x24FFUL ), /* Enclosed Alphanumerics */ + AF_UNIRANGE_REC( 0x2C60UL, 0x2C7FUL ), /* Latin Extended-C */ + AF_UNIRANGE_REC( 0x2E00UL, 0x2E7FUL ), /* Supplemental Punctuation */ + AF_UNIRANGE_REC( 0xA720UL, 0xA7FFUL ), /* Latin Extended-D */ + AF_UNIRANGE_REC( 0xFB00UL, 0xFB06UL ), /* Alphab. Present. Forms (Latin Ligs) */ + AF_UNIRANGE_REC( 0x1D400UL, 0x1D7FFUL ), /* Mathematical Alphanumeric Symbols */ + AF_UNIRANGE_REC( 0x1F100UL, 0x1F1FFUL ), /* Enclosed Alphanumeric Supplement */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + static const AF_Script_UniRangeRec af_grek_uniranges[] = + { + AF_UNIRANGE_REC( 0x0370UL, 0x03FFUL ), /* Greek and Coptic */ + AF_UNIRANGE_REC( 0x1F00UL, 0x1FFFUL ), /* Greek Extended */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + static const AF_Script_UniRangeRec af_cyrl_uniranges[] = + { + AF_UNIRANGE_REC( 0x0400UL, 0x04FFUL ), /* Cyrillic */ + AF_UNIRANGE_REC( 0x0500UL, 0x052FUL ), /* Cyrillic Supplement */ + AF_UNIRANGE_REC( 0x2DE0UL, 0x2DFFUL ), /* Cyrillic Extended-A */ + AF_UNIRANGE_REC( 0xA640UL, 0xA69FUL ), /* Cyrillic Extended-B */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + static const AF_Script_UniRangeRec af_hebr_uniranges[] = + { + AF_UNIRANGE_REC( 0x0590UL, 0x05FFUL ), /* Hebrew */ + AF_UNIRANGE_REC( 0xFB1DUL, 0xFB4FUL ), /* Alphab. Present. Forms (Hebrew) */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + + AF_DEFINE_SCRIPT_CLASS( + af_latn_script_class, + + AF_SCRIPT_LATN, + AF_BLUE_STRINGSET_LATN, + AF_WRITING_SYSTEM_LATIN, + + af_latn_uniranges, + 'o' + ) + + AF_DEFINE_SCRIPT_CLASS( + af_grek_script_class, + + AF_SCRIPT_GREK, + AF_BLUE_STRINGSET_GREK, + AF_WRITING_SYSTEM_LATIN, + + af_grek_uniranges, + 0x3BF /* ο */ + ) + + AF_DEFINE_SCRIPT_CLASS( + af_cyrl_script_class, + + AF_SCRIPT_CYRL, + AF_BLUE_STRINGSET_CYRL, + AF_WRITING_SYSTEM_LATIN, + + af_cyrl_uniranges, + 0x43E /* о */ + ) + + AF_DEFINE_SCRIPT_CLASS( + af_hebr_script_class, + + AF_SCRIPT_HEBR, + AF_BLUE_STRINGSET_HEBR, + AF_WRITING_SYSTEM_LATIN, + + af_hebr_uniranges, + 0x5DD /* ם */ + ) + + /* END */ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/aflatin.h b/reactos/lib/3rdparty/freetype/src/autofit/aflatin.h index d9170b3dcc6..c06cbd9a6af 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/aflatin.h +++ b/reactos/lib/3rdparty/freetype/src/autofit/aflatin.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for latin script (specification). */ /* */ -/* Copyright 2003-2007, 2009, 2011-2012 by */ +/* Copyright 2003-2007, 2009, 2011-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -24,10 +24,20 @@ FT_BEGIN_HEADER + /* the `latin' writing system */ - /* the latin-specific script class */ + AF_DECLARE_WRITING_SYSTEM_CLASS( af_latin_writing_system_class ) - AF_DECLARE_SCRIPT_CLASS( af_latin_script_class ) + + /* the latin-specific script classes */ + + AF_DECLARE_SCRIPT_CLASS( af_cyrl_script_class ) + AF_DECLARE_SCRIPT_CLASS( af_grek_script_class ) + AF_DECLARE_SCRIPT_CLASS( af_latn_script_class ) + AF_DECLARE_SCRIPT_CLASS( af_hebr_script_class ) +#if 0 + AF_DECLARE_SCRIPT_CLASS( af_armn_script_class ) +#endif /* constants are given with units_per_em == 2048 in mind */ @@ -51,27 +61,14 @@ FT_BEGIN_HEADER */ - /* Latin (global) metrics management */ - - enum - { - AF_LATIN_BLUE_CAPITAL_TOP, - AF_LATIN_BLUE_CAPITAL_BOTTOM, - AF_LATIN_BLUE_SMALL_F_TOP, - AF_LATIN_BLUE_SMALL_TOP, - AF_LATIN_BLUE_SMALL_BOTTOM, - AF_LATIN_BLUE_SMALL_MINOR, - - AF_LATIN_BLUE_MAX - }; - - -#define AF_LATIN_IS_TOP_BLUE( b ) ( (b) == AF_LATIN_BLUE_CAPITAL_TOP || \ - (b) == AF_LATIN_BLUE_SMALL_F_TOP || \ - (b) == AF_LATIN_BLUE_SMALL_TOP ) +#define AF_LATIN_IS_TOP_BLUE( b ) \ + ( (b)->properties & AF_BLUE_PROPERTY_LATIN_TOP ) +#define AF_LATIN_IS_X_HEIGHT_BLUE( b ) \ + ( (b)->properties & AF_BLUE_PROPERTY_LATIN_X_HEIGHT ) +#define AF_LATIN_IS_LONG_BLUE( b ) \ + ( (b)->properties & AF_BLUE_PROPERTY_LATIN_LONG ) #define AF_LATIN_MAX_WIDTHS 16 -#define AF_LATIN_MAX_BLUES AF_LATIN_BLUE_MAX enum @@ -106,7 +103,7 @@ FT_BEGIN_HEADER /* ignored for horizontal metrics */ FT_UInt blue_count; - AF_LatinBlueRec blues[AF_LATIN_BLUE_MAX]; + AF_LatinBlueRec blues[AF_BLUE_STRINGSET_MAX]; FT_Fixed org_scale; FT_Pos org_delta; diff --git a/reactos/lib/3rdparty/freetype/src/autofit/aflatin2.c b/reactos/lib/3rdparty/freetype/src/autofit/aflatin2.c index b1e9658d5d7..a6d564a28f5 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/aflatin2.c +++ b/reactos/lib/3rdparty/freetype/src/autofit/aflatin2.c @@ -76,8 +76,9 @@ AF_Scaler scaler = &dummy->root.scaler; - glyph_index = FT_Get_Char_Index( face, - metrics->root.clazz->standard_char ); + glyph_index = FT_Get_Char_Index( + face, + metrics->root.script_class->standard_char ); if ( glyph_index == 0 ) goto Exit; @@ -409,11 +410,11 @@ blue->flags |= AF_LATIN_BLUE_TOP; /* - * The following flags is used later to adjust the y and x scales + * The following flag is used later to adjust the y and x scales * in order to optimize the pixel grid alignment of the top of small * letters. */ - if ( bb == AF_LATIN_BLUE_SMALL_TOP ) + if ( AF_LATIN_IS_X_HEIGHT_BLUE( bb ) ) blue->flags |= AF_LATIN_BLUE_ADJUSTMENT; FT_TRACE5(( " -> reference = %ld\n" @@ -2379,18 +2380,10 @@ /*************************************************************************/ - static const AF_Script_UniRangeRec af_latin2_uniranges[] = - { - AF_UNIRANGE_REC( 32UL, 127UL ), /* TODO: Add new Unicode ranges here! */ - AF_UNIRANGE_REC( 160UL, 255UL ), - AF_UNIRANGE_REC( 0UL, 0UL ) - }; + AF_DEFINE_WRITING_SYSTEM_CLASS( + af_latin2_writing_system_class, - - AF_DEFINE_SCRIPT_CLASS( af_latin2_script_class, - AF_SCRIPT_LATIN2, - af_latin2_uniranges, - 'o', + AF_WRITING_SYSTEM_LATIN2, sizeof ( AF_LatinMetricsRec ), @@ -2403,4 +2396,53 @@ ) + /* XXX: this should probably fine tuned to differentiate better between */ + /* scripts... */ + + static const AF_Script_UniRangeRec af_ltn2_uniranges[] = + { + AF_UNIRANGE_REC( 0x0020UL, 0x007FUL ), /* Basic Latin (no control chars) */ + AF_UNIRANGE_REC( 0x00A0UL, 0x00FFUL ), /* Latin-1 Supplement (no control chars) */ + AF_UNIRANGE_REC( 0x0100UL, 0x017FUL ), /* Latin Extended-A */ + AF_UNIRANGE_REC( 0x0180UL, 0x024FUL ), /* Latin Extended-B */ + AF_UNIRANGE_REC( 0x0250UL, 0x02AFUL ), /* IPA Extensions */ + AF_UNIRANGE_REC( 0x02B0UL, 0x02FFUL ), /* Spacing Modifier Letters */ + AF_UNIRANGE_REC( 0x0300UL, 0x036FUL ), /* Combining Diacritical Marks */ + AF_UNIRANGE_REC( 0x0370UL, 0x03FFUL ), /* Greek and Coptic */ + AF_UNIRANGE_REC( 0x0400UL, 0x04FFUL ), /* Cyrillic */ + AF_UNIRANGE_REC( 0x0500UL, 0x052FUL ), /* Cyrillic Supplement */ + AF_UNIRANGE_REC( 0x1D00UL, 0x1D7FUL ), /* Phonetic Extensions */ + AF_UNIRANGE_REC( 0x1D80UL, 0x1DBFUL ), /* Phonetic Extensions Supplement */ + AF_UNIRANGE_REC( 0x1DC0UL, 0x1DFFUL ), /* Combining Diacritical Marks Supplement */ + AF_UNIRANGE_REC( 0x1E00UL, 0x1EFFUL ), /* Latin Extended Additional */ + AF_UNIRANGE_REC( 0x1F00UL, 0x1FFFUL ), /* Greek Extended */ + AF_UNIRANGE_REC( 0x2000UL, 0x206FUL ), /* General Punctuation */ + AF_UNIRANGE_REC( 0x2070UL, 0x209FUL ), /* Superscripts and Subscripts */ + AF_UNIRANGE_REC( 0x20A0UL, 0x20CFUL ), /* Currency Symbols */ + AF_UNIRANGE_REC( 0x2150UL, 0x218FUL ), /* Number Forms */ + AF_UNIRANGE_REC( 0x2460UL, 0x24FFUL ), /* Enclosed Alphanumerics */ + AF_UNIRANGE_REC( 0x2C60UL, 0x2C7FUL ), /* Latin Extended-C */ + AF_UNIRANGE_REC( 0x2DE0UL, 0x2DFFUL ), /* Cyrillic Extended-A */ + AF_UNIRANGE_REC( 0x2E00UL, 0x2E7FUL ), /* Supplemental Punctuation */ + AF_UNIRANGE_REC( 0xA640UL, 0xA69FUL ), /* Cyrillic Extended-B */ + AF_UNIRANGE_REC( 0xA720UL, 0xA7FFUL ), /* Latin Extended-D */ + AF_UNIRANGE_REC( 0xFB00UL, 0xFB06UL ), /* Alphab. Present. Forms (Latin Ligs) */ + AF_UNIRANGE_REC( 0x1D400UL, 0x1D7FFUL ), /* Mathematical Alphanumeric Symbols */ + AF_UNIRANGE_REC( 0x1F100UL, 0x1F1FFUL ), /* Enclosed Alphanumeric Supplement */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + + AF_DEFINE_SCRIPT_CLASS( + af_ltn2_script_class, + + AF_SCRIPT_LTN2, + AF_BLUE_STRINGSET_LATN, + AF_WRITING_SYSTEM_LATIN2, + + af_ltn2_uniranges, + 'o' + ) + + /* END */ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/aflatin2.h b/reactos/lib/3rdparty/freetype/src/autofit/aflatin2.h index cbfa395522e..f7f6d8d7c57 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/aflatin2.h +++ b/reactos/lib/3rdparty/freetype/src/autofit/aflatin2.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for latin script (specification). */ /* */ -/* Copyright 2003-2007, 2012 by */ +/* Copyright 2003-2007, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -25,9 +25,21 @@ FT_BEGIN_HEADER - /* the latin-specific script class */ + /* the `latin' writing system */ + + AF_DECLARE_WRITING_SYSTEM_CLASS( af_latin2_writing_system_class ) + + + /* the latin-specific script classes */ + + AF_DECLARE_SCRIPT_CLASS( af_ltn2_script_class ) /* XXX */ +#if 0 + AF_DECLARE_SCRIPT_CLASS( af_arm2_script_class ) + AF_DECLARE_SCRIPT_CLASS( af_cyr2_script_class ) + AF_DECLARE_SCRIPT_CLASS( af_grk2_script_class ) + AF_DECLARE_SCRIPT_CLASS( af_hbr2_script_class ) +#endif - AF_DECLARE_SCRIPT_CLASS( af_latin2_script_class ) /* */ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afloader.c b/reactos/lib/3rdparty/freetype/src/autofit/afloader.c index 17a6fb7c3b8..b49f8c096ae 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afloader.c +++ b/reactos/lib/3rdparty/freetype/src/autofit/afloader.c @@ -21,6 +21,7 @@ #include "afhints.h" #include "aferrors.h" #include "afmodule.h" +#include "afpic.h" /* Initialize glyph loader. */ @@ -180,10 +181,20 @@ /* now load the slot image into the auto-outline and run the */ /* automatic hinting process */ - if ( metrics->clazz->script_hints_apply ) - metrics->clazz->script_hints_apply( hints, - &gloader->current.outline, - metrics ); + { +#ifdef FT_CONFIG_OPTION_PIC + AF_FaceGlobals globals = loader->globals; +#endif + AF_WritingSystemClass writing_system_class = + AF_WRITING_SYSTEM_CLASSES_GET + [metrics->script_class->writing_system]; + + + if ( writing_system_class->script_hints_apply ) + writing_system_class->script_hints_apply( hints, + &gloader->current.outline, + metrics ); + } /* we now need to adjust the metrics according to the change in */ /* width/positioning that occurred during the hinting process */ @@ -519,33 +530,41 @@ if ( !error ) { AF_ScriptMetrics metrics; - FT_UInt options = 0; + FT_UInt options = AF_SCRIPT_DFLT; #ifdef FT_OPTION_AUTOFIT2 - /* XXX: undocumented hook to activate the latin2 hinter */ + /* XXX: undocumented hook to activate the latin2 writing system */ if ( load_flags & ( 1UL << 20 ) ) - options = 2; + options = AF_SCRIPT_LTN2; #endif error = af_face_globals_get_metrics( loader->globals, gindex, options, &metrics ); if ( !error ) { +#ifdef FT_CONFIG_OPTION_PIC + AF_FaceGlobals globals = loader->globals; +#endif + AF_WritingSystemClass writing_system_class = + AF_WRITING_SYSTEM_CLASSES_GET + [metrics->script_class->writing_system]; + + loader->metrics = metrics; - if ( metrics->clazz->script_metrics_scale ) - metrics->clazz->script_metrics_scale( metrics, &scaler ); + if ( writing_system_class->script_metrics_scale ) + writing_system_class->script_metrics_scale( metrics, &scaler ); else metrics->scaler = scaler; load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_TRANSFORM; load_flags &= ~FT_LOAD_RENDER; - if ( metrics->clazz->script_hints_init ) + if ( writing_system_class->script_hints_init ) { - error = metrics->clazz->script_hints_init( &loader->hints, - metrics ); + error = writing_system_class->script_hints_init( &loader->hints, + metrics ); if ( error ) goto Exit; } diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afpic.c b/reactos/lib/3rdparty/freetype/src/autofit/afpic.c index 45e1448c089..92d696d296d 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afpic.c +++ b/reactos/lib/3rdparty/freetype/src/autofit/afpic.c @@ -43,13 +43,10 @@ /* forward declaration of PIC init functions from script classes */ -#include "aflatin.h" -#ifdef FT_OPTION_AUTOFIT2 -#include "aflatin2.h" -#endif -#include "afcjk.h" -#include "afdummy.h" -#include "afindic.h" +#undef WRITING_SYSTEM +#define WRITING_SYSTEM( ws, WS ) /* empty */ + +#include "afwrtsys.h" void @@ -100,27 +97,31 @@ FT_Init_Class_af_service_properties( &container->af_service_properties ); - for ( ss = 0 ; ss < AF_SCRIPT_CLASSES_REC_COUNT ; ss++ ) - { + for ( ss = 0; ss < AF_WRITING_SYSTEM_MAX - 1; ss++ ) + container->af_writing_system_classes[ss] = + &container->af_writing_system_classes_rec[ss]; + container->af_writing_system_classes[AF_WRITING_SYSTEM_MAX - 1] = NULL; + + for ( ss = 0; ss < AF_SCRIPT_MAX - 1; ss++ ) container->af_script_classes[ss] = &container->af_script_classes_rec[ss]; - } - container->af_script_classes[AF_SCRIPT_CLASSES_COUNT - 1] = NULL; + container->af_script_classes[AF_SCRIPT_MAX - 1] = NULL; + +#undef WRITING_SYSTEM +#define WRITING_SYSTEM( ws, WS ) \ + FT_Init_Class_af_ ## ws ## _writing_system_class( \ + &container->af_writing_system_classes_rec[ss++] ); - /* add call to initialization function when you add new scripts */ ss = 0; - FT_Init_Class_af_dummy_script_class( - &container->af_script_classes_rec[ss++] ); -#ifdef FT_OPTION_AUTOFIT2 - FT_Init_Class_af_latin2_script_class( - &container->af_script_classes_rec[ss++] ); -#endif - FT_Init_Class_af_latin_script_class( - &container->af_script_classes_rec[ss++] ); - FT_Init_Class_af_cjk_script_class( - &container->af_script_classes_rec[ss++] ); - FT_Init_Class_af_indic_script_class( - &container->af_script_classes_rec[ss++] ); +#include "afwrtsys.h" + +#undef SCRIPT +#define SCRIPT( s, S, d ) \ + FT_Init_Class_af_ ## s ## _script_class( \ + &container->af_script_classes_rec[ss++] ); + + ss = 0; +#include "afscript.h" FT_Init_Class_af_autofitter_interface( library, &container->af_autofitter_interface ); diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afpic.h b/reactos/lib/3rdparty/freetype/src/autofit/afpic.h index 0acf803894c..09f8258a2e8 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/afpic.h +++ b/reactos/lib/3rdparty/freetype/src/autofit/afpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for autofit module. */ /* */ -/* Copyright 2009, 2011-2012 by */ +/* Copyright 2009, 2011-2013 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -27,11 +27,12 @@ FT_BEGIN_HEADER #ifndef FT_CONFIG_OPTION_PIC -#define AF_SERVICES_GET af_services -#define AF_SERVICE_PROPERTIES_GET af_service_properties +#define AF_SERVICES_GET af_services +#define AF_SERVICE_PROPERTIES_GET af_service_properties -#define AF_SCRIPT_CLASSES_GET af_script_classes -#define AF_INTERFACE_GET af_autofitter_interface +#define AF_WRITING_SYSTEM_CLASSES_GET af_writing_system_classes +#define AF_SCRIPT_CLASSES_GET af_script_classes +#define AF_INTERFACE_GET af_autofitter_interface #else /* FT_CONFIG_OPTION_PIC */ @@ -40,24 +41,22 @@ FT_BEGIN_HEADER #include "aftypes.h" - /* increase these when you add new scripts, */ - /* and update autofit_module_class_pic_init */ -#ifdef FT_OPTION_AUTOFIT2 -#define AF_SCRIPT_CLASSES_COUNT 6 -#else -#define AF_SCRIPT_CLASSES_COUNT 5 -#endif - -#define AF_SCRIPT_CLASSES_REC_COUNT ( AF_SCRIPT_CLASSES_COUNT - 1 ) - typedef struct AFModulePIC_ { FT_ServiceDescRec* af_services; FT_Service_PropertiesRec af_service_properties; - AF_ScriptClass af_script_classes[AF_SCRIPT_CLASSES_COUNT]; - AF_ScriptClassRec af_script_classes_rec[AF_SCRIPT_CLASSES_REC_COUNT]; + AF_WritingSystemClass af_writing_system_classes + [AF_WRITING_SYSTEM_MAX]; + AF_WritingSystemClassRec af_writing_system_classes_rec + [AF_WRITING_SYSTEM_MAX - 1]; + + AF_ScriptClass af_script_classes + [AF_SCRIPT_MAX]; + AF_ScriptClassRec af_script_classes_rec + [AF_SCRIPT_MAX - 1]; + FT_AutoHinter_InterfaceRec af_autofitter_interface; } AFModulePIC; @@ -71,6 +70,8 @@ FT_BEGIN_HEADER #define AF_SERVICE_PROPERTIES_GET \ ( GET_PIC( library )->af_service_properties ) +#define AF_WRITING_SYSTEM_CLASSES_GET \ + ( GET_PIC( FT_FACE_LIBRARY( globals->face ) )->af_writing_system_classes ) #define AF_SCRIPT_CLASSES_GET \ ( GET_PIC( FT_FACE_LIBRARY( globals->face ) )->af_script_classes ) #define AF_INTERFACE_GET \ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afscript.h b/reactos/lib/3rdparty/freetype/src/autofit/afscript.h new file mode 100644 index 00000000000..be0169a83cb --- /dev/null +++ b/reactos/lib/3rdparty/freetype/src/autofit/afscript.h @@ -0,0 +1,37 @@ +/***************************************************************************/ +/* */ +/* afscript.h */ +/* */ +/* Auto-fitter scripts (specification only). */ +/* */ +/* Copyright 2013 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /* The following part can be included multiple times. */ + /* Define `SCRIPT' as needed. */ + + + /* Add new scripts here. */ + + SCRIPT( cyrl, CYRL, "Cyrillic" ) + SCRIPT( deva, DEVA, "Indic scripts" ) + SCRIPT( dflt, DFLT, "no script" ) + SCRIPT( grek, GREK, "Greek" ) + SCRIPT( hani, HANI, "CJKV ideographs" ) + SCRIPT( hebr, HEBR, "Hebrew" ) + SCRIPT( latn, LATN, "Latin" ) +#ifdef FT_OPTION_AUTOFIT2 + SCRIPT( ltn2, LTN2, "Latin 2" ) +#endif + + +/* END */ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/aftypes.h b/reactos/lib/3rdparty/freetype/src/autofit/aftypes.h index 9acd7ad6d24..cda1f896595 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/aftypes.h +++ b/reactos/lib/3rdparty/freetype/src/autofit/aftypes.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter types (specification only). */ /* */ -/* Copyright 2003-2009, 2011-2012 by */ +/* Copyright 2003-2009, 2011-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,15 +20,12 @@ * * The auto-fitter is a complete rewrite of the old auto-hinter. * Its main feature is the ability to differentiate between different - * scripts in order to apply language-specific rules. + * writing systems in order to apply script-specific rules. * * The code has also been compartmentized into several entities that * should make algorithmic experimentation easier than with the old * code. * - * Finally, we get rid of the Catharon license, since this code is - * released under the FreeType one. - * *************************************************************************/ @@ -42,6 +39,8 @@ #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H +#include "afblue.h" + FT_BEGIN_HEADER @@ -201,56 +200,21 @@ extern void* _af_debug_hints; /*************************************************************************/ /*************************************************************************/ /***** *****/ - /***** S C R I P T S *****/ + /***** S C R I P T M E T R I C S *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ - /* - * The list of known scripts. Each different script corresponds to the - * following information: - * - * - A set of Unicode ranges to test whether the face supports the - * script. - * - * - A specific global analyzer that will compute global metrics - * specific to the script. - * - * - A specific glyph analyzer that will compute segments and - * edges for each glyph covered by the script. - * - * - A specific grid-fitting algorithm that will distort the - * scaled glyph outline according to the results of the glyph - * analyzer. - * - * Note that a given analyzer and/or grid-fitting algorithm can be - * used by more than one script. - */ + /* This is the main structure which combines writing systems and script */ + /* data (for a given face object, see below). */ - typedef enum AF_Script_ - { - AF_SCRIPT_DUMMY = 0, - AF_SCRIPT_LATIN = 1, - AF_SCRIPT_CJK = 2, - AF_SCRIPT_INDIC = 3, -#ifdef FT_OPTION_AUTOFIT2 - AF_SCRIPT_LATIN2 = 4, -#endif - - /* add new scripts here. Don't forget to update the list in */ - /* `afglobal.c'. */ - - AF_SCRIPT_MAX /* do not remove */ - - } AF_Script; - - - typedef struct AF_ScriptClassRec_ const* AF_ScriptClass; - typedef struct AF_FaceGlobalsRec_* AF_FaceGlobals; + typedef struct AF_WritingSystemClassRec_ const* AF_WritingSystemClass; + typedef struct AF_ScriptClassRec_ const* AF_ScriptClass; + typedef struct AF_FaceGlobalsRec_* AF_FaceGlobals; typedef struct AF_ScriptMetricsRec_ { - AF_ScriptClass clazz; + AF_ScriptClass script_class; AF_ScalerRec scaler; FT_Bool digits_have_same_width; @@ -284,23 +248,54 @@ extern void* _af_debug_hints; AF_ScriptMetrics metrics ); - typedef struct AF_Script_UniRangeRec_ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** W R I T I N G S Y S T E M S *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* + * In FreeType, a writing system consists of multiple scripts which can + * be handled similarly *in a typographical way*; the relationship is not + * based on history. For example, both the Greek and the unrelated + * Armenian scripts share the same features like ascender, descender, + * x-height, etc. Essentially, a writing system is covered by a + * submodule of the auto-fitter; it contains + * + * - a specific global analyzer which computes global metrics specific to + * the script (based on script-specific characters to identify ascender + * height, x-height, etc.), + * + * - a specific glyph analyzer that computes segments and edges for each + * glyph covered by the script, + * + * - a specific grid-fitting algorithm that distorts the scaled glyph + * outline according to the results of the glyph analyzer. + */ + +#define __AFWRTSYS_H__ /* don't load header files */ +#undef WRITING_SYSTEM +#define WRITING_SYSTEM( ws, WS ) \ + AF_WRITING_SYSTEM_ ## WS, + + /* The list of known writing systems. */ + typedef enum AF_WritingSystem_ { - FT_UInt32 first; - FT_UInt32 last; - } AF_Script_UniRangeRec; +#include "afwrtsys.h" -#define AF_UNIRANGE_REC( a, b ) { (FT_UInt32)(a), (FT_UInt32)(b) } + AF_WRITING_SYSTEM_MAX /* do not remove */ - typedef const AF_Script_UniRangeRec *AF_Script_UniRange; + } AF_WritingSystem; + +#undef __AFWRTSYS_H__ - typedef struct AF_ScriptClassRec_ + typedef struct AF_WritingSystemClassRec_ { - AF_Script script; - AF_Script_UniRange script_uni_ranges; /* last must be { 0, 0 } */ - FT_UInt32 standard_char; /* for default width and height */ + AF_WritingSystem writing_system; FT_Offset script_metrics_size; AF_Script_InitMetricsFunc script_metrics_init; @@ -310,59 +305,167 @@ extern void* _af_debug_hints; AF_Script_InitHintsFunc script_hints_init; AF_Script_ApplyHintsFunc script_hints_apply; + } AF_WritingSystemClassRec; + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** S C R I P T S *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* + * Each script is associated with a set of Unicode ranges which gets used + * to test whether the font face supports the script. It also references + * the writing system it belongs to. + * + * We use four-letter script tags from the OpenType specification. + */ + +#undef SCRIPT +#define SCRIPT( s, S, d ) \ + AF_SCRIPT_ ## S, + + /* The list of known scripts. */ + typedef enum AF_Script_ + { + +#include "afscript.h" + + AF_SCRIPT_MAX /* do not remove */ + + } AF_Script; + + + typedef struct AF_Script_UniRangeRec_ + { + FT_UInt32 first; + FT_UInt32 last; + + } AF_Script_UniRangeRec; + +#define AF_UNIRANGE_REC( a, b ) { (FT_UInt32)(a), (FT_UInt32)(b) } + + typedef const AF_Script_UniRangeRec* AF_Script_UniRange; + + + typedef struct AF_ScriptClassRec_ + { + AF_Script script; + AF_Blue_Stringset blue_stringset; + AF_WritingSystem writing_system; + + AF_Script_UniRange script_uni_ranges; /* last must be { 0, 0 } */ + FT_UInt32 standard_char; /* for default width and height */ + } AF_ScriptClassRec; /* Declare and define vtables for classes */ #ifndef FT_CONFIG_OPTION_PIC +#define AF_DECLARE_WRITING_SYSTEM_CLASS( writing_system_class ) \ + FT_CALLBACK_TABLE const AF_WritingSystemClassRec \ + writing_system_class; + +#define AF_DEFINE_WRITING_SYSTEM_CLASS( \ + writing_system_class, \ + system, \ + m_size, \ + m_init, \ + m_scale, \ + m_done, \ + h_init, \ + h_apply ) \ + FT_CALLBACK_TABLE_DEF \ + const AF_WritingSystemClassRec writing_system_class = \ + { \ + system, \ + \ + m_size, \ + \ + m_init, \ + m_scale, \ + m_done, \ + \ + h_init, \ + h_apply \ + }; + + #define AF_DECLARE_SCRIPT_CLASS( script_class ) \ FT_CALLBACK_TABLE const AF_ScriptClassRec \ script_class; -#define AF_DEFINE_SCRIPT_CLASS( script_class, script_, ranges, def_char, \ - m_size, \ - m_init, m_scale, m_done, h_init, h_apply ) \ - FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec script_class = \ - { \ - script_, \ - ranges, \ - def_char, \ - \ - m_size, \ - \ - m_init, \ - m_scale, \ - m_done, \ - \ - h_init, \ - h_apply \ +#define AF_DEFINE_SCRIPT_CLASS( \ + script_class, \ + script_, \ + blue_stringset_, \ + writing_system_, \ + ranges, \ + std_char ) \ + FT_CALLBACK_TABLE_DEF \ + const AF_ScriptClassRec script_class = \ + { \ + script_, \ + blue_stringset_, \ + writing_system_, \ + ranges, \ + std_char \ }; #else /* FT_CONFIG_OPTION_PIC */ +#define AF_DECLARE_WRITING_SYSTEM_CLASS( writing_system_class ) \ + FT_LOCAL( void ) \ + FT_Init_Class_ ## writing_system_class( AF_WritingSystemClassRec* ac ); + +#define AF_DEFINE_WRITING_SYSTEM_CLASS( \ + writing_system_class, \ + system, \ + m_size, \ + m_init, \ + m_scale, \ + m_done, \ + h_init, \ + h_apply ) \ + FT_LOCAL_DEF( void ) \ + FT_Init_Class_ ## writing_system_class( AF_WritingSystemClassRec* ac ) \ + { \ + ac->writing_system = system; \ + \ + ac->script_metrics_size = m_size; \ + \ + ac->script_metrics_init = m_init; \ + ac->script_metrics_scale = m_scale; \ + ac->script_metrics_done = m_done; \ + \ + ac->script_hints_init = h_init; \ + ac->script_hints_apply = h_apply; \ + } + + #define AF_DECLARE_SCRIPT_CLASS( script_class ) \ FT_LOCAL( void ) \ FT_Init_Class_ ## script_class( AF_ScriptClassRec* ac ); -#define AF_DEFINE_SCRIPT_CLASS( script_class, script_, ranges, def_char, \ - m_size, \ - m_init, m_scale, m_done, h_init, h_apply ) \ - FT_LOCAL_DEF( void ) \ - FT_Init_Class_ ## script_class( AF_ScriptClassRec* ac ) \ - { \ - ac->script = script_; \ - ac->script_uni_ranges = ranges; \ - ac->default_char = def_char; \ - \ - ac->script_metrics_size = m_size; \ - \ - ac->script_metrics_init = m_init; \ - ac->script_metrics_scale = m_scale; \ - ac->script_metrics_done = m_done; \ - \ - ac->script_hints_init = h_init; \ - ac->script_hints_apply = h_apply; \ +#define AF_DEFINE_SCRIPT_CLASS( \ + script_class, \ + script_, \ + blue_string_set_, \ + writing_system_, \ + ranges, \ + std_char ) \ + FT_LOCAL_DEF( void ) \ + FT_Init_Class_ ## script_class( AF_ScriptClassRec* ac ) \ + { \ + ac->script = script_; \ + ac->blue_stringset = blue_stringset_; \ + ac->writing_system = writing_system_; \ + ac->script_uni_ranges = ranges; \ + ac->standard_char = std_char; \ } #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/afwrtsys.h b/reactos/lib/3rdparty/freetype/src/autofit/afwrtsys.h new file mode 100644 index 00000000000..602c558842e --- /dev/null +++ b/reactos/lib/3rdparty/freetype/src/autofit/afwrtsys.h @@ -0,0 +1,51 @@ +/***************************************************************************/ +/* */ +/* afwrtsys.h */ +/* */ +/* Auto-fitter writing systems (specification only). */ +/* */ +/* Copyright 2013 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __AFWRTSYS_H__ +#define __AFWRTSYS_H__ + + /* Since preprocessor directives can't create other preprocessor */ + /* directives, we have to include the header files manually. */ + +#include "afdummy.h" +#include "aflatin.h" +#include "afcjk.h" +#include "afindic.h" +#ifdef FT_OPTION_AUTOFIT2 +#include "aflatin2.h" +#endif + +#endif /* __AFWRTSYS_H__ */ + + + /* The following part can be included multiple times. */ + /* Define `WRITING_SYSTEM' as needed. */ + + + /* Add new writing systems here. */ + + WRITING_SYSTEM( dummy, DUMMY ) + WRITING_SYSTEM( latin, LATIN ) + WRITING_SYSTEM( cjk, CJK ) + WRITING_SYSTEM( indic, INDIC ) +#ifdef FT_OPTION_AUTOFIT2 + WRITING_SYSTEM( latin2, LATIN2 ) +#endif + + +/* END */ diff --git a/reactos/lib/3rdparty/freetype/src/autofit/autofit.c b/reactos/lib/3rdparty/freetype/src/autofit/autofit.c index 3883a0a7060..b23374a23a1 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/autofit.c +++ b/reactos/lib/3rdparty/freetype/src/autofit/autofit.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter module (body). */ /* */ -/* Copyright 2003-2007, 2011 by */ +/* Copyright 2003-2007, 2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,6 +20,7 @@ #include #include "afpic.c" #include "afangles.c" +#include "afblue.c" #include "afglobal.c" #include "afhints.c" diff --git a/reactos/lib/3rdparty/freetype/src/autofit/rules.mk b/reactos/lib/3rdparty/freetype/src/autofit/rules.mk index b76bb79ab43..745adab25d7 100644 --- a/reactos/lib/3rdparty/freetype/src/autofit/rules.mk +++ b/reactos/lib/3rdparty/freetype/src/autofit/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2003, 2004, 2005, 2006, 2007, 2011 by +# Copyright 2003-2007, 2011, 2013 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -26,6 +26,7 @@ AUTOF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(AUTOF_DIR)) # AUTOF driver sources (i.e., C files) # AUTOF_DRV_SRC := $(AUTOF_DIR)/afangles.c \ + $(AUTOF_DIR)/afblue.c \ $(AUTOF_DIR)/afcjk.c \ $(AUTOF_DIR)/afdummy.c \ $(AUTOF_DIR)/afglobal.c \ @@ -41,7 +42,9 @@ AUTOF_DRV_SRC := $(AUTOF_DIR)/afangles.c \ # AUTOF_DRV_H := $(AUTOF_DRV_SRC:%c=%h) \ $(AUTOF_DIR)/aferrors.h \ - $(AUTOF_DIR)/aftypes.h + $(AUTOF_DIR)/afscript.h \ + $(AUTOF_DIR)/aftypes.h \ + $(AUTOF_DIR)/afwrtsys.h # AUTOF driver object(s) diff --git a/reactos/lib/3rdparty/freetype/src/base/ftbbox.c b/reactos/lib/3rdparty/freetype/src/base/ftbbox.c index 6d1c44cb2e8..8d3f383b4d6 100644 --- a/reactos/lib/3rdparty/freetype/src/base/ftbbox.c +++ b/reactos/lib/3rdparty/freetype/src/base/ftbbox.c @@ -85,7 +85,7 @@ /* BBox_Conic_Check */ /* */ /* */ - /* Finds the extrema of a 1-dimensional conic Bezier curve and update */ + /* Find the extrema of a 1-dimensional conic Bezier curve and update */ /* a bounding range. This version uses direct computation, as it */ /* doesn't need square roots. */ /* */ @@ -108,30 +108,19 @@ FT_Pos* min, FT_Pos* max ) { - if ( y1 <= y3 && y2 == y1 ) /* flat arc */ - goto Suite; + /* This function is only called when a control off-point is outside */ + /* the bbox that contains all on-points. It finds a local extremum */ + /* within the segment, equal to (y1*y3 - y2*y2)/(y1 - 2*y2 + y3). */ + /* Or, offsetting from y2, we get */ - if ( y1 < y3 ) - { - if ( y2 >= y1 && y2 <= y3 ) /* ascending arc */ - goto Suite; - } - else - { - if ( y2 >= y3 && y2 <= y1 ) /* descending arc */ - { - y2 = y1; - y1 = y3; - y3 = y2; - goto Suite; - } - } + y1 -= y2; + y3 -= y2; + y2 += FT_MulDiv( y1, y3, y1 + y3 ); - y1 = y3 = y1 - FT_MulDiv( y2 - y1, y2 - y1, y1 - 2*y2 + y3 ); - - Suite: - if ( y1 < *min ) *min = y1; - if ( y3 > *max ) *max = y3; + if ( y2 < *min ) + *min = y2; + if ( y2 > *max ) + *max = y2; } @@ -195,9 +184,9 @@ /* BBox_Cubic_Check */ /* */ /* */ - /* Finds the extrema of a 1-dimensional cubic Bezier curve and */ - /* updates a bounding range. This version uses splitting because we */ - /* don't want to use square roots and extra accuracy. */ + /* Find the extrema of a 1-dimensional cubic Bezier curve and */ + /* update a bounding range. This version uses iterative splitting */ + /* because it is faster than the exact solution with square roots. */ /* */ /* */ /* p1 :: The start coordinate. */ @@ -213,28 +202,16 @@ /* */ /* max :: The address of the current maximum. */ /* */ - -#if 0 - - static void - BBox_Cubic_Check( FT_Pos p1, - FT_Pos p2, - FT_Pos p3, - FT_Pos p4, - FT_Pos* min, - FT_Pos* max ) + static FT_Pos + update_cubic_max( FT_Pos q1, + FT_Pos q2, + FT_Pos q3, + FT_Pos q4, + FT_Pos max ) { - FT_Pos q1, q2, q3, q4; - - - q1 = p1; - q2 = p2; - q3 = p3; - q4 = p4; - - /* for a conic segment to possibly reach new maximum */ - /* one of its off-points must be above the current value */ - while ( q2 > *max || q3 > *max ) + /* for a cubic segment to possibly reach new maximum, at least */ + /* one of its off-points must stay above the current value */ + while ( q2 > max || q3 > max ) { /* determine which half contains the maximum and split */ if ( q1 + q2 > q3 + q4 ) /* first half */ @@ -260,232 +237,92 @@ q3 = q3 / 2; } - /* check if either end reached the maximum */ + /* check whether either end reached the maximum */ if ( q1 == q2 && q1 >= q3 ) { - *max = q1; + max = q1; break; } if ( q3 == q4 && q2 <= q4 ) { - *max = q4; + max = q4; break; } } - q1 = p1; - q2 = p2; - q3 = p3; - q4 = p4; - - /* for a conic segment to possibly reach new minimum */ - /* one of its off-points must be below the current value */ - while ( q2 < *min || q3 < *min ) - { - /* determine which half contains the minimum and split */ - if ( q1 + q2 < q3 + q4 ) /* first half */ - { - q4 = q4 + q3; - q3 = q3 + q2; - q2 = q2 + q1; - q4 = q4 + q3; - q3 = q3 + q2; - q4 = ( q4 + q3 ) / 8; - q3 = q3 / 4; - q2 = q2 / 2; - } - else /* second half */ - { - q1 = q1 + q2; - q2 = q2 + q3; - q3 = q3 + q4; - q1 = q1 + q2; - q2 = q2 + q3; - q1 = ( q1 + q2 ) / 8; - q2 = q2 / 4; - q3 = q3 / 2; - } - - /* check if either end reached the minimum */ - if ( q1 == q2 && q1 <= q3 ) - { - *min = q1; - break; - } - if ( q3 == q4 && q2 >= q4 ) - { - *min = q4; - break; - } - } - } - -#else - - static void - test_cubic_extrema( FT_Pos y1, - FT_Pos y2, - FT_Pos y3, - FT_Pos y4, - FT_Fixed u, - FT_Pos* min, - FT_Pos* max ) - { - /* FT_Pos a = y4 - 3*y3 + 3*y2 - y1; */ - FT_Pos b = y3 - 2*y2 + y1; - FT_Pos c = y2 - y1; - FT_Pos d = y1; - FT_Pos y; - FT_Fixed uu; - - FT_UNUSED ( y4 ); - - - /* The polynomial is */ - /* */ - /* P(x) = a*x^3 + 3b*x^2 + 3c*x + d , */ - /* */ - /* dP/dx = 3a*x^2 + 6b*x + 3c . */ - /* */ - /* However, we also have */ - /* */ - /* dP/dx(u) = 0 , */ - /* */ - /* which implies by subtraction that */ - /* */ - /* P(u) = b*u^2 + 2c*u + d . */ - - if ( u > 0 && u < 0x10000L ) - { - uu = FT_MulFix( u, u ); - y = d + FT_MulFix( c, 2*u ) + FT_MulFix( b, uu ); - - if ( y < *min ) *min = y; - if ( y > *max ) *max = y; - } + return max; } static void - BBox_Cubic_Check( FT_Pos y1, - FT_Pos y2, - FT_Pos y3, - FT_Pos y4, + BBox_Cubic_Check( FT_Pos p1, + FT_Pos p2, + FT_Pos p3, + FT_Pos p4, FT_Pos* min, FT_Pos* max ) { - /* always compare first and last points */ - if ( y1 < *min ) *min = y1; - else if ( y1 > *max ) *max = y1; + FT_Pos nmin, nmax; + FT_Int shift; - if ( y4 < *min ) *min = y4; - else if ( y4 > *max ) *max = y4; - /* now, try to see if there are split points here */ - if ( y1 <= y4 ) + /* This function is only called when a control off-point is outside */ + /* the bbox that contains all on-points. It finds a local extremum */ + /* within the segment using iterative bisection of the segment. */ + /* The fixed-point arithmetic of bisection is inherently stable */ + /* but may loose accuracy in the two lowest bits. To compensate, */ + /* we upscale the segment if there is room. Large values may need */ + /* to be downscaled to avoid overflows during bisection. */ + /* The control off-point outside the bbox is likely to have the top */ + /* absolute value among arguments. */ + + shift = 27 - FT_MSB( FT_ABS( p2 ) | FT_ABS( p3 ) ); + + if ( shift > 0 ) { - /* flat or ascending arc test */ - if ( y1 <= y2 && y2 <= y4 && y1 <= y3 && y3 <= y4 ) - return; + /* upscaling too much just wastes time */ + if ( shift > 2 ) + shift = 2; + + p1 <<= shift; + p2 <<= shift; + p3 <<= shift; + p4 <<= shift; + nmin = *min << shift; + nmax = *max << shift; } - else /* y1 > y4 */ + else { - /* descending arc test */ - if ( y1 >= y2 && y2 >= y4 && y1 >= y3 && y3 >= y4 ) - return; + p1 >>= -shift; + p2 >>= -shift; + p3 >>= -shift; + p4 >>= -shift; + nmin = *min >> -shift; + nmax = *max >> -shift; } - /* There are some split points. Find them. */ - /* We already made sure that a, b, and c below cannot be all zero. */ + nmax = update_cubic_max( p1, p2, p3, p4, nmax ); + + /* now flip the signs to update the minimum */ + nmin = -update_cubic_max( -p1, -p2, -p3, -p4, -nmin ); + + if ( shift > 0 ) { - FT_Pos a = y4 - 3*y3 + 3*y2 - y1; - FT_Pos b = y3 - 2*y2 + y1; - FT_Pos c = y2 - y1; - FT_Pos d; - FT_Fixed t; - FT_Int shift; - - - /* We need to solve `ax^2+2bx+c' here, without floating points! */ - /* The trick is to normalize to a different representation in order */ - /* to use our 16.16 fixed-point routines. */ - /* */ - /* We compute FT_MulFix(b,b) and FT_MulFix(a,c) after normalization. */ - /* These values must fit into a single 16.16 value. */ - /* */ - /* We normalize a, b, and c to `8.16' fixed-point values to ensure */ - /* that their product is held in a `16.16' value including the sign. */ - /* Necessarily, we need to shift `a', `b', and `c' so that the most */ - /* significant bit of their absolute values is at position 22. */ - /* */ - /* This also means that we are using 23 bits of precision to compute */ - /* the zeros, independently of the range of the original polynomial */ - /* coefficients. */ - /* */ - /* This algorithm should ensure reasonably accurate values for the */ - /* zeros. Note that they are only expressed with 16 bits when */ - /* computing the extrema (the zeros need to be in 0..1 exclusive */ - /* to be considered part of the arc). */ - - shift = FT_MSB( FT_ABS( a ) | FT_ABS( b ) | FT_ABS( c ) ); - - if ( shift > 22 ) - { - shift -= 22; - - /* this loses some bits of precision, but we use 23 of them */ - /* for the computation anyway */ - a >>= shift; - b >>= shift; - c >>= shift; - } - else - { - shift = 22 - shift; - - a <<= shift; - b <<= shift; - c <<= shift; - } - - /* handle a == 0 */ - if ( a == 0 ) - { - if ( b != 0 ) - { - t = - FT_DivFix( c, b ) / 2; - test_cubic_extrema( y1, y2, y3, y4, t, min, max ); - } - } - else - { - /* solve the equation now */ - d = FT_MulFix( b, b ) - FT_MulFix( a, c ); - if ( d < 0 ) - return; - - if ( d == 0 ) - { - /* there is a single split point at -b/a */ - t = - FT_DivFix( b, a ); - test_cubic_extrema( y1, y2, y3, y4, t, min, max ); - } - else - { - /* there are two solutions; we need to filter them */ - d = FT_SqrtFixed( (FT_Int32)d ); - t = - FT_DivFix( b - d, a ); - test_cubic_extrema( y1, y2, y3, y4, t, min, max ); - - t = - FT_DivFix( b + d, a ); - test_cubic_extrema( y1, y2, y3, y4, t, min, max ); - } - } + nmin >>= shift; + nmax >>= shift; } + else + { + nmin <<= -shift; + nmax <<= -shift; + } + + if ( nmin < *min ) + *min = nmin; + if ( nmax > *max ) + *max = nmax; } -#endif - /*************************************************************************/ /* */ @@ -521,8 +358,9 @@ FT_Vector* to, TBBox_Rec* user ) { - /* we don't need to check `to' since it is always an `on' point, thus */ - /* within the bbox */ + /* We don't need to check `to' since it is always an on-point, */ + /* thus within the bbox. Only segments with an off-point outside */ + /* the bbox can possibly reach new extreme values. */ if ( CHECK_X( control1, user->bbox ) || CHECK_X( control2, user->bbox ) ) diff --git a/reactos/lib/3rdparty/freetype/src/base/ftbitmap.c b/reactos/lib/3rdparty/freetype/src/base/ftbitmap.c index 01271142e27..ad8a10044f2 100644 --- a/reactos/lib/3rdparty/freetype/src/base/ftbitmap.c +++ b/reactos/lib/3rdparty/freetype/src/base/ftbitmap.c @@ -385,6 +385,10 @@ FT_Long l; + /* Short-circuit transparent color to avoid div-by-zero. */ + if ( !a ) + return 0; + /* * Luminosity for sRGB is defined using ~0.2126,0.7152,0.0722 * coefficients for RGB channels *on the linear colors*. diff --git a/reactos/lib/3rdparty/freetype/src/base/ftcalc.c b/reactos/lib/3rdparty/freetype/src/base/ftcalc.c index 0ec0d78930f..b23b4d44a46 100644 --- a/reactos/lib/3rdparty/freetype/src/base/ftcalc.c +++ b/reactos/lib/3rdparty/freetype/src/base/ftcalc.c @@ -816,6 +816,8 @@ } +#if 0 + /* documentation is in ftcalc.h */ FT_BASE_DEF( FT_Int32 ) @@ -850,6 +852,8 @@ return (FT_Int32)root; } +#endif /* 0 */ + /* documentation is in ftcalc.h */ @@ -945,11 +949,27 @@ FT_Pos d_in, d_out, d_corner; + /* We approximate the Euclidean metric (sqrt(x^2 + y^2)) with */ + /* the Taxicab metric (|x| + |y|), which can be computed much */ + /* faster. If one of the two vectors is much longer than the */ + /* other one, the direction of the shorter vector doesn't */ + /* influence the result any more. */ + /* */ + /* corner */ + /* x---------------------------x */ + /* \ / */ + /* \ / */ + /* in \ / out */ + /* \ / */ + /* o */ + /* Point */ + /* */ + if ( ax < 0 ) ax = -ax; if ( ay < 0 ) ay = -ay; - d_in = ax + ay; + d_in = ax + ay; /* d_in = || in || */ ax = out_x; if ( ax < 0 ) @@ -957,7 +977,7 @@ ay = out_y; if ( ay < 0 ) ay = -ay; - d_out = ax + ay; + d_out = ax + ay; /* d_out = || out || */ ax = out_x + in_x; if ( ax < 0 ) @@ -965,7 +985,11 @@ ay = out_y + in_y; if ( ay < 0 ) ay = -ay; - d_corner = ax + ay; + d_corner = ax + ay; /* d_corner = || in + out || */ + + /* now do a simple length comparison: */ + /* */ + /* d_in + d_out < 17/16 d_corner */ return ( d_in + d_out - d_corner ) < ( d_corner >> 4 ); } diff --git a/reactos/lib/3rdparty/freetype/src/base/ftdebug.c b/reactos/lib/3rdparty/freetype/src/base/ftdebug.c index b9156d15ee3..39ac6add057 100644 --- a/reactos/lib/3rdparty/freetype/src/base/ftdebug.c +++ b/reactos/lib/3rdparty/freetype/src/base/ftdebug.c @@ -152,7 +152,7 @@ /* the memory and stream components which are set to 7 and 5, */ /* respectively. */ /* */ - /* See the file for details of the */ + /* See the file for details of the */ /* available toggle names. */ /* */ /* The level must be between 0 and 7; 0 means quiet (except for serious */ diff --git a/reactos/lib/3rdparty/freetype/src/base/ftglyph.c b/reactos/lib/3rdparty/freetype/src/base/ftglyph.c index 5dd28a8c524..c62b3db0c39 100644 --- a/reactos/lib/3rdparty/freetype/src/base/ftglyph.c +++ b/reactos/lib/3rdparty/freetype/src/base/ftglyph.c @@ -424,15 +424,16 @@ FT_Matrix* matrix, FT_Vector* delta ) { - const FT_Glyph_Class* clazz; - FT_Error error = FT_Err_Ok; + FT_Error error = FT_Err_Ok; if ( !glyph || !glyph->clazz ) error = FT_THROW( Invalid_Argument ); else { - clazz = glyph->clazz; + const FT_Glyph_Class* clazz = glyph->clazz; + + if ( clazz->glyph_transform ) { /* transform glyph image */ @@ -466,38 +467,33 @@ if ( !glyph || !glyph->clazz ) return; - else + + clazz = glyph->clazz; + if ( !clazz->glyph_bbox ) + return; + + /* retrieve bbox in 26.6 coordinates */ + clazz->glyph_bbox( glyph, acbox ); + + /* perform grid fitting if needed */ + if ( bbox_mode == FT_GLYPH_BBOX_GRIDFIT || + bbox_mode == FT_GLYPH_BBOX_PIXELS ) { - clazz = glyph->clazz; - if ( !clazz->glyph_bbox ) - return; - else - { - /* retrieve bbox in 26.6 coordinates */ - clazz->glyph_bbox( glyph, acbox ); - - /* perform grid fitting if needed */ - if ( bbox_mode == FT_GLYPH_BBOX_GRIDFIT || - bbox_mode == FT_GLYPH_BBOX_PIXELS ) - { - acbox->xMin = FT_PIX_FLOOR( acbox->xMin ); - acbox->yMin = FT_PIX_FLOOR( acbox->yMin ); - acbox->xMax = FT_PIX_CEIL( acbox->xMax ); - acbox->yMax = FT_PIX_CEIL( acbox->yMax ); - } - - /* convert to integer pixels if needed */ - if ( bbox_mode == FT_GLYPH_BBOX_TRUNCATE || - bbox_mode == FT_GLYPH_BBOX_PIXELS ) - { - acbox->xMin >>= 6; - acbox->yMin >>= 6; - acbox->xMax >>= 6; - acbox->yMax >>= 6; - } - } + acbox->xMin = FT_PIX_FLOOR( acbox->xMin ); + acbox->yMin = FT_PIX_FLOOR( acbox->yMin ); + acbox->xMax = FT_PIX_CEIL( acbox->xMax ); + acbox->yMax = FT_PIX_CEIL( acbox->yMax ); + } + + /* convert to integer pixels if needed */ + if ( bbox_mode == FT_GLYPH_BBOX_TRUNCATE || + bbox_mode == FT_GLYPH_BBOX_PIXELS ) + { + acbox->xMin >>= 6; + acbox->yMin >>= 6; + acbox->xMax >>= 6; + acbox->yMax >>= 6; } - return; } diff --git a/reactos/lib/3rdparty/freetype/src/base/ftinit.c b/reactos/lib/3rdparty/freetype/src/base/ftinit.c index 85f321fd2d4..6176273f0a6 100644 --- a/reactos/lib/3rdparty/freetype/src/base/ftinit.c +++ b/reactos/lib/3rdparty/freetype/src/base/ftinit.c @@ -23,8 +23,8 @@ /* FT_Add_Default_Modules(): */ /* This function is used to add the set of default modules to a */ /* fresh new library object. The set is taken from the header file */ - /* `freetype/config/ftmodule.h'. See the document `FreeType 2.0 */ - /* Build System' for more information. */ + /* `config/ftmodule.h'. See the document `FreeType 2.0 Build */ + /* System' for more information. */ /* */ /* FT_Init_FreeType(): */ /* This function creates a system object for the current platform, */ diff --git a/reactos/lib/3rdparty/freetype/src/base/ftmac.c b/reactos/lib/3rdparty/freetype/src/base/ftmac.c index 5b5aae61cce..9b49da81402 100644 --- a/reactos/lib/3rdparty/freetype/src/base/ftmac.c +++ b/reactos/lib/3rdparty/freetype/src/base/ftmac.c @@ -963,7 +963,6 @@ if ( !pathname ) return FT_THROW( Invalid_Argument ); - error = FT_Err_Ok; *aface = NULL; /* try resourcefork based font: LWFN, FFIL */ diff --git a/reactos/lib/3rdparty/freetype/src/base/ftobjs.c b/reactos/lib/3rdparty/freetype/src/base/ftobjs.c index 157bf456349..bd0c66e4a95 100644 --- a/reactos/lib/3rdparty/freetype/src/base/ftobjs.c +++ b/reactos/lib/3rdparty/freetype/src/base/ftobjs.c @@ -56,9 +56,7 @@ #endif /* _MSC_VER */ /* it's easiest to include `md5.c' directly */ -#define free md5_free /* suppress a shadow warning */ #include "md5.c" -#undef free #if defined( _MSC_VER ) #pragma warning( pop ) @@ -667,11 +665,18 @@ /* the check for `num_locations' assures that we actually */ /* test for instructions in a TTF and not in a CFF-based OTF */ + /* */ + /* since `maxSizeOfInstructions' might be unreliable, we */ + /* check the size of the `fpgm' and `prep' tables, too -- */ + /* the assumption is that there don't exist real TTFs where */ + /* both `fpgm' and `prep' tables are missing */ if ( mode == FT_RENDER_MODE_LIGHT || face->internal->ignore_unpatented_hinter || ( FT_IS_SFNT( face ) && ttface->num_locations && - ttface->max_profile.maxSizeOfInstructions == 0 ) ) + ttface->max_profile.maxSizeOfInstructions == 0 && + ttface->font_program_size == 0 && + ttface->cvt_program_size == 0 ) ) autohint = TRUE; } } @@ -1133,7 +1138,8 @@ /* */ static FT_Error open_face( FT_Driver driver, - FT_Stream stream, + FT_Stream *astream, + FT_Bool external_stream, FT_Long face_index, FT_Int num_params, FT_Parameter* params, @@ -1141,10 +1147,11 @@ { FT_Memory memory; FT_Driver_Class clazz; - FT_Face face = 0; - FT_Error error, error2; + FT_Face face = NULL; FT_Face_Internal internal = NULL; + FT_Error error, error2; + clazz = driver->clazz; memory = driver->root.memory; @@ -1155,7 +1162,11 @@ face->driver = driver; face->memory = memory; - face->stream = stream; + face->stream = *astream; + + /* set the FT_FACE_FLAG_EXTERNAL_STREAM bit for FT_Done_Face */ + if ( external_stream ) + face->face_flags |= FT_FACE_FLAG_EXTERNAL_STREAM; if ( FT_NEW( internal ) ) goto Fail; @@ -1177,11 +1188,12 @@ #endif if ( clazz->init_face ) - error = clazz->init_face( stream, + error = clazz->init_face( *astream, face, (FT_Int)face_index, num_params, params ); + *astream = face->stream; /* Stream may have been changed. */ if ( error ) goto Fail; @@ -2069,7 +2081,7 @@ params = args->params; } - error = open_face( driver, stream, face_index, + error = open_face( driver, &stream, external_stream, face_index, num_params, params, &face ); if ( !error ) goto Success; @@ -2105,7 +2117,7 @@ params = args->params; } - error = open_face( driver, stream, face_index, + error = open_face( driver, &stream, external_stream, face_index, num_params, params, &face ); if ( !error ) goto Success; @@ -2174,10 +2186,6 @@ Success: FT_TRACE4(( "FT_Open_Face: New face object, adding to list\n" )); - /* set the FT_FACE_FLAG_EXTERNAL_STREAM bit for FT_Done_Face */ - if ( external_stream ) - face->face_flags |= FT_FACE_FLAG_EXTERNAL_STREAM; - /* add the face object to its driver's list */ if ( FT_NEW( node ) ) goto Fail; @@ -3380,8 +3388,10 @@ FT_CMap cmap = FT_CMAP( face->charmap ); - do { + do + { gindex = cmap->clazz->char_next( cmap, &code ); + } while ( gindex >= (FT_UInt)face->num_glyphs ); result = ( gindex == 0 ) ? 0 : code; diff --git a/reactos/lib/3rdparty/freetype/src/base/ftoutln.c b/reactos/lib/3rdparty/freetype/src/base/ftoutln.c index 54ca5cdcf6e..35df0cd821b 100644 --- a/reactos/lib/3rdparty/freetype/src/base/ftoutln.c +++ b/reactos/lib/3rdparty/freetype/src/base/ftoutln.c @@ -576,11 +576,13 @@ { char* p = outline->tags + first; char* q = outline->tags + last; - char swap; while ( p < q ) { + char swap; + + swap = *p; *p = *q; *q = swap; @@ -721,7 +723,8 @@ #if 0 #define FT_OUTLINE_GET_CONTOUR( outline, c, first, last ) \ - do { \ + do \ + { \ (first) = ( c > 0 ) ? (outline)->points + \ (outline)->contours[c - 1] + 1 \ : (outline)->points; \ diff --git a/reactos/lib/3rdparty/freetype/src/base/ftpic.c b/reactos/lib/3rdparty/freetype/src/base/ftpic.c index 1c871016969..9bd92f785a1 100644 --- a/reactos/lib/3rdparty/freetype/src/base/ftpic.c +++ b/reactos/lib/3rdparty/freetype/src/base/ftpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services (body). */ /* */ -/* Copyright 2009 by */ +/* Copyright 2009, 2013 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -29,7 +29,7 @@ ft_pic_container_init( FT_Library library ) { FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; + FT_Error error; FT_MEM_SET( pic_container, 0, sizeof ( *pic_container ) ); diff --git a/reactos/lib/3rdparty/freetype/src/base/ftsynth.c b/reactos/lib/3rdparty/freetype/src/base/ftsynth.c index 241d37f4262..3098a60fa89 100644 --- a/reactos/lib/3rdparty/freetype/src/base/ftsynth.c +++ b/reactos/lib/3rdparty/freetype/src/base/ftsynth.c @@ -4,7 +4,7 @@ /* */ /* FreeType synthesizing code for emboldening and slanting (body). */ /* */ -/* Copyright 2000-2006, 2010, 2012 by */ +/* Copyright 2000-2006, 2010, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -139,10 +139,11 @@ if ( slot->advance.y ) slot->advance.y += ystr; - slot->metrics.width += xstr; - slot->metrics.height += ystr; - slot->metrics.horiAdvance += xstr; - slot->metrics.vertAdvance += ystr; + slot->metrics.width += xstr; + slot->metrics.height += ystr; + slot->metrics.horiAdvance += xstr; + slot->metrics.vertAdvance += ystr; + slot->metrics.horiBearingY += ystr; /* XXX: 16-bit overflow case must be excluded before here */ if ( slot->format == FT_GLYPH_FORMAT_BITMAP ) diff --git a/reactos/lib/3rdparty/freetype/src/base/md5.c b/reactos/lib/3rdparty/freetype/src/base/md5.c index 2f01c9302cb..52d96accd30 100644 --- a/reactos/lib/3rdparty/freetype/src/base/md5.c +++ b/reactos/lib/3rdparty/freetype/src/base/md5.c @@ -50,7 +50,8 @@ */ #define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) #define G(x, y, z) ((y) ^ ((z) & ((x) ^ (y)))) -#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define H(x, y, z) (((x) ^ (y)) ^ (z)) +#define H2(x, y, z) ((x) ^ ((y) ^ (z))) #define I(x, y, z) ((y) ^ ((x) | ~(z))) /* @@ -89,13 +90,13 @@ * This processes one or more 64-byte data blocks, but does NOT update * the bit counters. There are no alignment requirements. */ -static void *body(MD5_CTX *ctx, void *data, unsigned long size) +static const void *body(MD5_CTX *ctx, const void *data, unsigned long size) { - unsigned char *ptr; + const unsigned char *ptr; MD5_u32plus a, b, c, d; MD5_u32plus saved_a, saved_b, saved_c, saved_d; - ptr = (unsigned char *)data; + ptr = (const unsigned char *)data; a = ctx->a; b = ctx->b; @@ -146,21 +147,21 @@ static void *body(MD5_CTX *ctx, void *data, unsigned long size) /* Round 3 */ STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4) - STEP(H, d, a, b, c, GET(8), 0x8771f681, 11) + STEP(H2, d, a, b, c, GET(8), 0x8771f681, 11) STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16) - STEP(H, b, c, d, a, GET(14), 0xfde5380c, 23) + STEP(H2, b, c, d, a, GET(14), 0xfde5380c, 23) STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4) - STEP(H, d, a, b, c, GET(4), 0x4bdecfa9, 11) + STEP(H2, d, a, b, c, GET(4), 0x4bdecfa9, 11) STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16) - STEP(H, b, c, d, a, GET(10), 0xbebfbc70, 23) + STEP(H2, b, c, d, a, GET(10), 0xbebfbc70, 23) STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4) - STEP(H, d, a, b, c, GET(0), 0xeaa127fa, 11) + STEP(H2, d, a, b, c, GET(0), 0xeaa127fa, 11) STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16) - STEP(H, b, c, d, a, GET(6), 0x04881d05, 23) + STEP(H2, b, c, d, a, GET(6), 0x04881d05, 23) STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4) - STEP(H, d, a, b, c, GET(12), 0xe6db99e5, 11) + STEP(H2, d, a, b, c, GET(12), 0xe6db99e5, 11) STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16) - STEP(H, b, c, d, a, GET(2), 0xc4ac5665, 23) + STEP(H2, b, c, d, a, GET(2), 0xc4ac5665, 23) /* Round 4 */ STEP(I, a, b, c, d, GET(0), 0xf4292244, 6) @@ -207,10 +208,10 @@ void MD5_Init(MD5_CTX *ctx) ctx->hi = 0; } -void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size) +void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size) { MD5_u32plus saved_lo; - unsigned long used, free; + unsigned long used, available; saved_lo = ctx->lo; if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo) @@ -220,16 +221,16 @@ void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size) used = saved_lo & 0x3f; if (used) { - free = 64 - used; + available = 64 - used; - if (size < free) { + if (size < available) { memcpy(&ctx->buffer[used], data, size); return; } - memcpy(&ctx->buffer[used], data, free); - data = (unsigned char *)data + free; - size -= free; + memcpy(&ctx->buffer[used], data, available); + data = (const unsigned char *)data + available; + size -= available; body(ctx, ctx->buffer, 64); } @@ -243,22 +244,22 @@ void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size) void MD5_Final(unsigned char *result, MD5_CTX *ctx) { - unsigned long used, free; + unsigned long used, available; used = ctx->lo & 0x3f; ctx->buffer[used++] = 0x80; - free = 64 - used; + available = 64 - used; - if (free < 8) { - memset(&ctx->buffer[used], 0, free); + if (available < 8) { + memset(&ctx->buffer[used], 0, available); body(ctx, ctx->buffer, 64); used = 0; - free = 64; + available = 64; } - memset(&ctx->buffer[used], 0, free - 8); + memset(&ctx->buffer[used], 0, available - 8); ctx->lo <<= 3; ctx->buffer[56] = ctx->lo; diff --git a/reactos/lib/3rdparty/freetype/src/base/md5.h b/reactos/lib/3rdparty/freetype/src/base/md5.h index f1a68576401..2da44bf355a 100644 --- a/reactos/lib/3rdparty/freetype/src/base/md5.h +++ b/reactos/lib/3rdparty/freetype/src/base/md5.h @@ -39,7 +39,7 @@ typedef struct { } MD5_CTX; extern void MD5_Init(MD5_CTX *ctx); -extern void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size); +extern void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size); extern void MD5_Final(unsigned char *result, MD5_CTX *ctx); #endif diff --git a/reactos/lib/3rdparty/freetype/src/base/rules.mk b/reactos/lib/3rdparty/freetype/src/base/rules.mk index e932191157a..874533754fa 100644 --- a/reactos/lib/3rdparty/freetype/src/base/rules.mk +++ b/reactos/lib/3rdparty/freetype/src/base/rules.mk @@ -19,8 +19,8 @@ # BASE_OBJ_S: The single-object base layer. # BASE_OBJ_M: A list of all objects for a multiple-objects build. # BASE_EXT_OBJ: A list of base layer extensions, i.e., components found -# in `freetype/src/base' which are not compiled within the -# base layer proper. +# in `src/base' which are not compiled within the base +# layer proper. BASE_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(SRC_DIR)/base) diff --git a/reactos/lib/3rdparty/freetype/src/bdf/Jamfile b/reactos/lib/3rdparty/freetype/src/bdf/Jamfile deleted file mode 100644 index da23ccd0add..00000000000 --- a/reactos/lib/3rdparty/freetype/src/bdf/Jamfile +++ /dev/null @@ -1,29 +0,0 @@ -# FreeType 2 src/bdf Jamfile -# -# Copyright 2002 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) bdf ; - -{ - local _sources ; - - if $(FT2_MULTI) - { - _sources = bdfdrivr bdflib ; - } - else - { - _sources = bdf ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# end of src/bdf Jamfile diff --git a/reactos/lib/3rdparty/freetype/src/bdf/bdfdrivr.c b/reactos/lib/3rdparty/freetype/src/bdf/bdfdrivr.c index 0ea0a5ea5eb..caa142b5ef4 100644 --- a/reactos/lib/3rdparty/freetype/src/bdf/bdfdrivr.c +++ b/reactos/lib/3rdparty/freetype/src/bdf/bdfdrivr.c @@ -351,7 +351,6 @@ THE SOFTWARE. FT_UNUSED( num_params ); FT_UNUSED( params ); - FT_UNUSED( face_index ); FT_TRACE2(( "BDF driver\n" )); @@ -375,6 +374,19 @@ THE SOFTWARE. /* we have a bdf font: let's construct the face object */ face->bdffont = font; + + /* BDF could not have multiple face in single font file. + * XXX: non-zero face_index is already invalid argument, but + * Type1, Type42 driver has a convention to return + * an invalid argument error when the font could be + * opened by the specified driver. + */ + if ( face_index > 0 ) { + FT_ERROR(( "BDF_Face_Init: invalid face index\n" )); + BDF_Face_Done( bdfface ); + return FT_THROW( Invalid_Argument ); + } + { bdf_property_t* prop = NULL; @@ -674,6 +686,8 @@ THE SOFTWARE. goto Exit; } + FT_TRACE1(( "BDF_Glyph_Load: glyph index %d\n", glyph_index )); + /* index 0 is the undefined glyph */ if ( glyph_index == 0 ) glyph_index = bdf->default_glyph; diff --git a/reactos/lib/3rdparty/freetype/src/bzip2/Jamfile b/reactos/lib/3rdparty/freetype/src/bzip2/Jamfile deleted file mode 100644 index 3da986dce65..00000000000 --- a/reactos/lib/3rdparty/freetype/src/bzip2/Jamfile +++ /dev/null @@ -1,19 +0,0 @@ -# FreeType 2 src/bzip2 Jamfile -# -# Copyright 2010 by -# Joel Klinghed -# -# Based on src/lzw/Jamfile, Copyright 2004, 2006 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) bzip2 ; - -Library $(FT2_LIB) : ftbzip2.c ; - -# end of src/bzip2 Jamfile diff --git a/reactos/lib/3rdparty/freetype/src/cache/Jamfile b/reactos/lib/3rdparty/freetype/src/cache/Jamfile deleted file mode 100644 index 340cff77423..00000000000 --- a/reactos/lib/3rdparty/freetype/src/cache/Jamfile +++ /dev/null @@ -1,43 +0,0 @@ -# FreeType 2 src/cache Jamfile -# -# Copyright 2001, 2003, 2004 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) cache ; - -# The file contains some macro definitions that are -# later used in #include statements related to the cache sub-system. It -# needs to be parsed through a HDRMACRO rule for macro definitions. -# -HDRMACRO [ FT2_SubDir include ftcache.h ] ; - -{ - local _sources ; - - if $(FT2_MULTI) - { - _sources = ftcmru - ftcmanag - ftccache - ftcglyph - ftcsbits - ftcimage - ftcbasic - ftccmap - ; - } - else - { - _sources = ftcache ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# end of src/cache Jamfile diff --git a/reactos/lib/3rdparty/freetype/src/cff/cf2blues.c b/reactos/lib/3rdparty/freetype/src/cff/cf2blues.c index 5b348398af8..eec589ef036 100644 --- a/reactos/lib/3rdparty/freetype/src/cff/cf2blues.c +++ b/reactos/lib/3rdparty/freetype/src/cff/cf2blues.c @@ -86,11 +86,13 @@ size_t i; CF2_Fixed emBoxBottom, emBoxTop; +#if 0 CF2_Int unitsPerEm = font->unitsPerEm; if ( unitsPerEm == 0 ) unitsPerEm = 1000; +#endif FT_ZERO( blues ); blues->scale = font->innerTransform.d; diff --git a/reactos/lib/3rdparty/freetype/src/cff/cf2font.c b/reactos/lib/3rdparty/freetype/src/cff/cf2font.c index 479d9125d15..718d1e27ec1 100644 --- a/reactos/lib/3rdparty/freetype/src/cff/cf2font.c +++ b/reactos/lib/3rdparty/freetype/src/cff/cf2font.c @@ -51,10 +51,59 @@ CF2_Fixed stemWidth, CF2_Fixed* darkenAmount, CF2_Fixed boldenAmount, - FT_Bool stemDarkened ) + FT_Bool stemDarkened, + FT_Int* darkenParams ) { + /* + * Total darkening amount is computed in 1000 unit character space + * using the modified 5 part curve as Adobe's Avalon rasterizer. + * The darkening amount is smaller for thicker stems. + * It becomes zero when the stem is thicker than 2.333 pixels. + * + * By default, we use + * + * darkenAmount = 0.4 pixels if scaledStem <= 0.5 pixels, + * darkenAmount = 0.275 pixels if 1 <= scaledStem <= 1.667 pixels, + * darkenAmount = 0 pixel if scaledStem >= 2.333 pixels, + * + * and piecewise linear in-between: + * + * + * darkening + * ^ + * | + * | (x1,y1) + * |--------+ + * | \ + * | \ + * | \ (x3,y3) + * | +----------+ + * | (x2,y2) \ + * | \ + * | \ + * | +----------------- + * | (x4,y4) + * +---------------------------------------------> stem + * thickness + * + * + * This corresponds to the following values for the + * `darkening-parameters' property: + * + * (x1, y1) = (500, 400) + * (x2, y2) = (1000, 275) + * (x3, y3) = (1667, 275) + * (x4, y4) = (2333, 0) + * + */ + /* Internal calculations are done in units per thousand for */ - /* convenience. */ + /* convenience. The x axis is scaled stem width in */ + /* thousandths of a pixel. That is, 1000 is 1 pixel. */ + /* The y axis is darkening amount in thousandths of a pixel.*/ + /* In the code, below, dividing by ppem and */ + /* adjusting for emRatio converts darkenAmount to character */ + /* space (font units). */ CF2_Fixed stemWidthPer1000, scaledStem; @@ -69,6 +118,16 @@ if ( stemDarkened ) { + FT_Int x1 = darkenParams[0]; + FT_Int y1 = darkenParams[1]; + FT_Int x2 = darkenParams[2]; + FT_Int y2 = darkenParams[3]; + FT_Int x3 = darkenParams[4]; + FT_Int y3 = darkenParams[5]; + FT_Int x4 = darkenParams[6]; + FT_Int y4 = darkenParams[7]; + + /* convert from true character space to 1000 unit character space; */ /* add synthetic emboldening effect */ @@ -81,7 +140,7 @@ stemWidthPer1000 <= ( stemWidth + boldenAmount ) ) { stemWidthPer1000 = 0; /* to pacify compiler */ - scaledStem = cf2_intToFixed( 2333 ); + scaledStem = cf2_intToFixed( x4 ); } else { @@ -89,39 +148,70 @@ if ( ppem > CF2_FIXED_ONE && scaledStem <= stemWidthPer1000 ) - scaledStem = cf2_intToFixed( 2333 ); + scaledStem = cf2_intToFixed( x4 ); } - /* - * Total darkening amount is computed in 1000 unit character space - * using the modified 5 part curve as Avalon rasterizer. - * The darkening amount is smaller for thicker stems. - * It becomes zero when the stem is thicker than 2.333 pixels. - * - * In Avalon rasterizer, - * - * darkenAmount = 0.5 pixels if scaledStem <= 0.5 pixels, - * darkenAmount = 0.333 pixels if 1 <= scaledStem <= 1.667 pixels, - * darkenAmount = 0 pixel if scaledStem >= 2.333 pixels, - * - * and piecewise linear in-between. - * - */ - if ( scaledStem < cf2_intToFixed( 500 ) ) - *darkenAmount = FT_DivFix( cf2_intToFixed( 400 ), ppem ); + /* now apply the darkening parameters */ - else if ( scaledStem < cf2_intToFixed( 1000 ) ) - *darkenAmount = FT_DivFix( cf2_intToFixed( 525 ), ppem ) - - FT_MulFix( stemWidthPer1000, - cf2_floatToFixed( .25 ) ); + if ( scaledStem < cf2_intToFixed( x1 ) ) + *darkenAmount = FT_DivFix( cf2_intToFixed( y1 ), ppem ); - else if ( scaledStem < cf2_intToFixed( 1667 ) ) - *darkenAmount = FT_DivFix( cf2_intToFixed( 275 ), ppem ); + else if ( scaledStem < cf2_intToFixed( x2 ) ) + { + FT_Int xdelta = x2 - x1; + FT_Int ydelta = y2 - y1; + FT_Int x = stemWidthPer1000 - + FT_DivFix( cf2_intToFixed( x1 ), ppem ); - else if ( scaledStem < cf2_intToFixed( 2333 ) ) - *darkenAmount = FT_DivFix( cf2_intToFixed( 963 ), ppem ) - - FT_MulFix( stemWidthPer1000, - cf2_floatToFixed( .413 ) ); + + if ( !xdelta ) + goto Try_x3; + + *darkenAmount = FT_MulFix( x, FT_DivFix( ydelta, xdelta ) ) + + FT_DivFix( cf2_intToFixed( y1 ), ppem ); + } + + else if ( scaledStem < cf2_intToFixed( x3 ) ) + { + Try_x3: + { + FT_Int xdelta = x3 - x2; + FT_Int ydelta = y3 - y2; + FT_Int x = stemWidthPer1000 - + FT_DivFix( cf2_intToFixed( x2 ), ppem ); + + + if ( !xdelta ) + goto Try_x4; + + *darkenAmount = FT_MulFix( x, FT_DivFix( ydelta, xdelta ) ) + + FT_DivFix( cf2_intToFixed( y2 ), ppem ); + } + } + + else if ( scaledStem < cf2_intToFixed( x4 ) ) + { + Try_x4: + { + FT_Int xdelta = x4 - x3; + FT_Int ydelta = y4 - y3; + FT_Int x = stemWidthPer1000 - + FT_DivFix( cf2_intToFixed( x3 ), ppem ); + + + if ( !xdelta ) + goto Use_y4; + + *darkenAmount = FT_MulFix( x, FT_DivFix( ydelta, xdelta ) ) + + FT_DivFix( cf2_intToFixed( y3 ), ppem ); + } + } + + else + { + Use_y4: + *darkenAmount = FT_DivFix( cf2_intToFixed( y4 ), ppem ); + } /* use half the amount on each side and convert back to true */ /* character space */ @@ -268,7 +358,8 @@ font->stdVW, &font->darkenX, boldenX, - FALSE ); + FALSE, + font->darkenParams ); } else cf2_computeDarkening( emRatio, @@ -276,7 +367,8 @@ font->stdVW, &font->darkenX, 0, - font->stemDarkened ); + font->stemDarkened, + font->darkenParams ); #if 0 /* since hstem is measured in the y-direction, we use the `d' member */ @@ -303,7 +395,8 @@ font->stdHW, &font->darkenY, boldenY, - font->stemDarkened ); + font->stemDarkened, + font->darkenParams ); if ( font->darkenX != 0 || font->darkenY != 0 ) font->darkened = TRUE; diff --git a/reactos/lib/3rdparty/freetype/src/cff/cf2font.h b/reactos/lib/3rdparty/freetype/src/cff/cf2font.h index f9dd1bbd408..d8860ce8ed5 100644 --- a/reactos/lib/3rdparty/freetype/src/cff/cf2font.h +++ b/reactos/lib/3rdparty/freetype/src/cff/cf2font.h @@ -85,6 +85,8 @@ FT_BEGIN_HEADER /* i.e. darkenX != 0 || darkenY != 0 */ FT_Bool stemDarkened; + FT_Int darkenParams[8]; /* 1000 unit character space */ + /* variables that depend on both FontDict and Transform */ CF2_Fixed stdVW; /* in character space; depends on dict entry */ CF2_Fixed stdHW; /* in character space; depends on dict entry */ diff --git a/reactos/lib/3rdparty/freetype/src/cff/cf2ft.c b/reactos/lib/3rdparty/freetype/src/cff/cf2ft.c index c09a0244a83..4abbc9d798d 100644 --- a/reactos/lib/3rdparty/freetype/src/cff/cf2ft.c +++ b/reactos/lib/3rdparty/freetype/src/cff/cf2ft.c @@ -344,6 +344,15 @@ if ( scaled && !driver->no_stem_darkening ) font->renderingFlags |= CF2_FlagsDarkened; + font->darkenParams[0] = driver->darken_params[0]; + font->darkenParams[1] = driver->darken_params[1]; + font->darkenParams[2] = driver->darken_params[2]; + font->darkenParams[3] = driver->darken_params[3]; + font->darkenParams[4] = driver->darken_params[4]; + font->darkenParams[5] = driver->darken_params[5]; + font->darkenParams[6] = driver->darken_params[6]; + font->darkenParams[7] = driver->darken_params[7]; + /* now get an outline for this glyph; */ /* also get units per em to validate scale */ font->unitsPerEm = (CF2_Int)cf2_getUnitsPerEm( decoder ); diff --git a/reactos/lib/3rdparty/freetype/src/cff/cf2hints.c b/reactos/lib/3rdparty/freetype/src/cff/cf2hints.c index 96bd49f186a..5f441616866 100644 --- a/reactos/lib/3rdparty/freetype/src/cff/cf2hints.c +++ b/reactos/lib/3rdparty/freetype/src/cff/cf2hints.c @@ -596,22 +596,31 @@ indexInsert = 0; for ( ; indexInsert < hintmap->count; indexInsert++ ) { - if ( hintmap->edge[indexInsert].csCoord > firstHintEdge->csCoord ) + if ( hintmap->edge[indexInsert].csCoord >= firstHintEdge->csCoord ) break; } /* - * Discard any hints that overlap in character space. Most often, - * this is while building the initial map, but in theory, it can also - * occur because of darkening. + * Discard any hints that overlap in character space. Most often, this + * is while building the initial map, where captured hints from all + * zones are combined. Define overlap to include hints that `touch' + * (overlap zero). Hiragino Sans/Gothic fonts have numerous hints that + * touch. Some fonts have non-ideographic glyphs that overlap our + * synthetic hints. + * + * Overlap also occurs when darkening stem hints that are close. * */ if ( indexInsert < hintmap->count ) { - /* we are inserting before an existing edge: */ + /* we are inserting before an existing edge: */ + /* verify that an existing edge is not the same */ + if ( hintmap->edge[indexInsert].csCoord == firstHintEdge->csCoord ) + return; /* ignore overlapping stem hint */ + /* verify that a new pair does not straddle the next edge */ - if ( isPair && - hintmap->edge[indexInsert].csCoord < secondHintEdge->csCoord ) + if ( isPair && + hintmap->edge[indexInsert].csCoord <= secondHintEdge->csCoord ) return; /* ignore overlapping stem hint */ /* verify that we are not inserting between paired edges */ @@ -645,8 +654,27 @@ firstHintEdge->csCoord ); } - /* discard any hints that overlap in device space; this can occur */ - /* because locked hints have been moved to align with blue zones */ + /* + * Discard any hints that overlap in device space; this can occur + * because locked hints have been moved to align with blue zones. + * + * TODO: Although we might correct this later during adjustment, we + * don't currently have a way to delete a conflicting hint once it has + * been inserted. See v2.030 MinionPro-Regular, 12 ppem darkened, + * initial hint map for second path, glyph 945 (the perispomeni (tilde) + * in U+1F6E, Greek omega with psili and perispomeni). Darkening is + * 25. Pair 667,747 initially conflicts in design space with top edge + * 660. This is because 667 maps to 7.87, and the top edge was + * captured by a zone at 8.0. The pair is later successfully inserted + * in a zone without the top edge. In this zone it is adjusted to 8.0, + * and no longer conflicts with the top edge in design space. This + * means it can be included in yet a later zone which does have the top + * edge hint. This produces a small mismatch between the first and + * last points of this path, even though the hint masks are the same. + * The density map difference is tiny (1/256). + * + */ + if ( indexInsert > 0 ) { /* we are inserting after an existing edge */ @@ -1035,6 +1063,7 @@ glyphpath->moveIsPending = TRUE; glyphpath->pathIsOpen = FALSE; + glyphpath->pathIsClosing = FALSE; glyphpath->elemIsQueued = FALSE; } @@ -1175,12 +1204,16 @@ /* * Push the cached element (glyphpath->prevElem*) to the outline * consumer. When a darkening offset is used, the end point of the - * cached element may be adjusted to an intersection point or it may be - * connected by a line to the current element. This calculation must - * use a HintMap that was valid at the time the element was saved. For - * the first point in a subpath, that is a saved HintMap. For most - * elements, it just means the caller has delayed building a HintMap - * from the current HintMask. + * cached element may be adjusted to an intersection point or we may + * synthesize a connecting line to the current element. If we are + * closing a subpath, we may also generate a connecting line to the start + * point. + * + * This is where Character Space (CS) is converted to Device Space (DS) + * using a hint map. This calculation must use a HintMap that was valid + * at the time the element was saved. For the first point in a subpath, + * that is a saved HintMap. For most elements, it just means the caller + * has delayed building a HintMap from the current HintMask. * * Transform each point with outerTransform and call the outline * callbacks. This is a general 3x3 transform: @@ -1250,16 +1283,32 @@ params.op = CF2_PathOpLineTo; /* note: pt2 and pt3 are unused */ - cf2_glyphpath_hintPoint( glyphpath, - hintmap, - ¶ms.pt1, - glyphpath->prevElemP1.x, - glyphpath->prevElemP1.y ); - glyphpath->callbacks->lineTo( glyphpath->callbacks, ¶ms ); + if ( close ) + { + /* use first hint map if closing */ + cf2_glyphpath_hintPoint( glyphpath, + &glyphpath->firstHintMap, + ¶ms.pt1, + glyphpath->prevElemP1.x, + glyphpath->prevElemP1.y ); + } + else + { + cf2_glyphpath_hintPoint( glyphpath, + hintmap, + ¶ms.pt1, + glyphpath->prevElemP1.x, + glyphpath->prevElemP1.y ); + } - glyphpath->currentDS = params.pt1; + /* output only non-zero length lines */ + if ( params.pt0.x != params.pt1.x || params.pt0.y != params.pt1.y ) + { + glyphpath->callbacks->lineTo( glyphpath->callbacks, ¶ms ); + glyphpath->currentDS = params.pt1; + } break; case CF2_PathOpCubeTo: @@ -1296,11 +1345,24 @@ /* note: at the end of a subpath, we might do both, so use `nextP0' */ /* before we change it, below */ - cf2_glyphpath_hintPoint( glyphpath, - hintmap, - ¶ms.pt1, - nextP0->x, - nextP0->y ); + if ( close ) + { + /* if we are closing the subpath, then nextP0 is in the first */ + /* hint zone */ + cf2_glyphpath_hintPoint( glyphpath, + &glyphpath->firstHintMap, + ¶ms.pt1, + nextP0->x, + nextP0->y ); + } + else + { + cf2_glyphpath_hintPoint( glyphpath, + hintmap, + ¶ms.pt1, + nextP0->x, + nextP0->y ); + } if ( params.pt1.x != glyphpath->currentDS.x || params.pt1.y != glyphpath->currentDS.y ) @@ -1511,6 +1573,16 @@ } + /* + * The functions cf2_glyphpath_{moveTo,lineTo,curveTo,closeOpenPath} are + * called by the interpreter with Character Space (CS) coordinates. Each + * path element is placed into a queue of length one to await the + * calculation of the following element. At that time, the darkening + * offset of the following element is known and joins can be computed, + * including possible modification of this element, before mapping to + * Device Space (DS) and passing it on to the outline consumer. + * + */ FT_LOCAL_DEF( void ) cf2_glyphpath_moveTo( CF2_GlyphPath glyphpath, CF2_Fixed x, @@ -1548,10 +1620,46 @@ { CF2_Fixed xOffset, yOffset; FT_Vector P0, P1; + FT_Bool newHintMap; + /* + * New hints will be applied after cf2_glyphpath_pushPrevElem has run. + * In case this is a synthesized closing line, any new hints should be + * delayed until this path is closed (`cf2_hintmask_isNew' will be + * called again before the next line or curve). + */ - /* can't compute offset of zero length line, so ignore them */ - if ( glyphpath->currentCS.x == x && glyphpath->currentCS.y == y ) + /* true if new hint map not on close */ + newHintMap = cf2_hintmask_isNew( glyphpath->hintMask ) && + !glyphpath->pathIsClosing; + + /* + * Zero-length lines may occur in the charstring. Because we cannot + * compute darkening offsets or intersections from zero-length lines, + * it is best to remove them and avoid artifacts. However, zero-length + * lines in CS at the start of a new hint map can generate non-zero + * lines in DS due to hint substitution. We detect a change in hint + * map here and pass those zero-length lines along. + */ + + /* + * Note: Find explicitly closed paths here with a conditional + * breakpoint using + * + * !gp->pathIsClosing && gp->start.x == x && gp->start.y == y + * + */ + + if ( glyphpath->currentCS.x == x && + glyphpath->currentCS.y == y && + !newHintMap ) + /* + * Ignore zero-length lines in CS where the hint map is the same + * because the line in DS will also be zero length. + * + * Ignore zero-length lines when we synthesize a closing line because + * the close will be handled in cf2_glyphPath_pushPrevElem. + */ return; cf2_glyphpath_computeOffset( glyphpath, @@ -1597,7 +1705,7 @@ glyphpath->prevElemP1 = P1; /* update current map */ - if ( cf2_hintmask_isNew( glyphpath->hintMask ) ) + if ( newHintMap ) cf2_hintmap_build( &glyphpath->hintMap, glyphpath->hStemHintArray, glyphpath->vStemHintArray, @@ -1703,29 +1811,29 @@ { if ( glyphpath->pathIsOpen ) { - FT_ASSERT( cf2_hintmap_isValid( &glyphpath->firstHintMap ) ); + /* + * A closing line in Character Space line is always generated below + * with `cf2_glyphPath_lineTo'. It may be ignored later if it turns + * out to be zero length in Device Space. + */ + glyphpath->pathIsClosing = TRUE; - /* since we need to apply an offset to the implicit lineto, we make */ - /* it explicit here */ cf2_glyphpath_lineTo( glyphpath, glyphpath->start.x, glyphpath->start.y ); - /* Draw previous element (the explicit LineTo we just created, */ - /* above) and connect it to the start point, but with the offset we */ - /* saved from the first element. */ - /* Use the saved HintMap, too. */ - FT_ASSERT( glyphpath->elemIsQueued ); - - cf2_glyphpath_pushPrevElem( glyphpath, - &glyphpath->firstHintMap, - &glyphpath->offsetStart0, - glyphpath->offsetStart1, - TRUE ); + /* empty the final element from the queue and close the path */ + if ( glyphpath->elemIsQueued ) + cf2_glyphpath_pushPrevElem( glyphpath, + &glyphpath->hintMap, + &glyphpath->offsetStart0, + glyphpath->offsetStart1, + TRUE ); /* reset state machine */ glyphpath->moveIsPending = TRUE; glyphpath->pathIsOpen = FALSE; + glyphpath->pathIsClosing = FALSE; glyphpath->elemIsQueued = FALSE; } } diff --git a/reactos/lib/3rdparty/freetype/src/cff/cf2hints.h b/reactos/lib/3rdparty/freetype/src/cff/cf2hints.h index c4fa922a396..f25d91bf89f 100644 --- a/reactos/lib/3rdparty/freetype/src/cff/cf2hints.h +++ b/reactos/lib/3rdparty/freetype/src/cff/cf2hints.h @@ -204,6 +204,7 @@ FT_BEGIN_HEADER #endif FT_Bool pathIsOpen; /* true after MoveTo */ + FT_Bool pathIsClosing; /* true when synthesizing closepath line */ FT_Bool darken; /* true if stem darkening */ FT_Bool moveIsPending; /* true between MoveTo and offset MoveTo */ @@ -229,7 +230,8 @@ FT_BEGIN_HEADER FT_Vector currentCS; /* current point, device space */ FT_Vector currentDS; - FT_Vector start; /* start point of subpath */ + /* start point of subpath, character space */ + FT_Vector start; /* the following members constitute the `queue' of one element */ FT_Bool elemIsQueued; diff --git a/reactos/lib/3rdparty/freetype/src/cff/cffdrivr.c b/reactos/lib/3rdparty/freetype/src/cff/cffdrivr.c index c8ca96ba495..dde7d448801 100644 --- a/reactos/lib/3rdparty/freetype/src/cff/cffdrivr.c +++ b/reactos/lib/3rdparty/freetype/src/cff/cffdrivr.c @@ -164,6 +164,8 @@ if ( !slot ) return FT_THROW( Invalid_Slot_Handle ); + FT_TRACE1(( "cff_glyph_load: glyph index %d\n", glyph_index )); + /* check whether we want a scaled outline or bitmap */ if ( !size ) load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; @@ -586,7 +588,38 @@ CFF_Driver driver = (CFF_Driver)module; - if ( !ft_strcmp( property_name, "hinting-engine" ) ) + if ( !ft_strcmp( property_name, "darkening-parameters" ) ) + { + FT_Int* darken_params = (FT_Int*)value; + + FT_Int x1 = darken_params[0]; + FT_Int y1 = darken_params[1]; + FT_Int x2 = darken_params[2]; + FT_Int y2 = darken_params[3]; + FT_Int x3 = darken_params[4]; + FT_Int y3 = darken_params[5]; + FT_Int x4 = darken_params[6]; + FT_Int y4 = darken_params[7]; + + + if ( x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 || + y1 < 0 || y2 < 0 || y3 < 0 || y4 < 0 || + x1 > x2 || x2 > x3 || x3 > x4 || + y1 > 500 || y2 > 500 || y3 > 500 || y4 > 500 ) + return FT_THROW( Invalid_Argument ); + + driver->darken_params[0] = x1; + driver->darken_params[1] = y1; + driver->darken_params[2] = x2; + driver->darken_params[3] = y2; + driver->darken_params[4] = x3; + driver->darken_params[5] = y3; + driver->darken_params[6] = x4; + driver->darken_params[7] = y4; + + return error; + } + else if ( !ft_strcmp( property_name, "hinting-engine" ) ) { FT_UInt* hinting_engine = (FT_UInt*)value; @@ -624,13 +657,28 @@ FT_Error error = FT_Err_Ok; CFF_Driver driver = (CFF_Driver)module; - FT_UInt hinting_engine = driver->hinting_engine; - FT_Bool no_stem_darkening = driver->no_stem_darkening; - - if ( !ft_strcmp( property_name, "hinting-engine" ) ) + if ( !ft_strcmp( property_name, "darkening-parameters" ) ) { - FT_UInt* val = (FT_UInt*)value; + FT_Int* darken_params = driver->darken_params; + FT_Int* val = (FT_Int*)value; + + + val[0] = darken_params[0]; + val[1] = darken_params[1]; + val[2] = darken_params[2]; + val[3] = darken_params[3]; + val[4] = darken_params[4]; + val[5] = darken_params[5]; + val[6] = darken_params[6]; + val[7] = darken_params[7]; + + return error; + } + else if ( !ft_strcmp( property_name, "hinting-engine" ) ) + { + FT_UInt hinting_engine = driver->hinting_engine; + FT_UInt* val = (FT_UInt*)value; *val = hinting_engine; @@ -639,7 +687,8 @@ } else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) { - FT_Bool* val = (FT_Bool*)value; + FT_Bool no_stem_darkening = driver->no_stem_darkening; + FT_Bool* val = (FT_Bool*)value; *val = no_stem_darkening; diff --git a/reactos/lib/3rdparty/freetype/src/cff/cffgload.c b/reactos/lib/3rdparty/freetype/src/cff/cffgload.c index 6a8494fa9ff..c8e9f9124b6 100644 --- a/reactos/lib/3rdparty/freetype/src/cff/cffgload.c +++ b/reactos/lib/3rdparty/freetype/src/cff/cffgload.c @@ -434,7 +434,7 @@ goto Exit; } - FT_TRACE3(( "glyph index %d (subfont %d):\n", glyph_index, fd_index )); + FT_TRACE3(( " in subfont %d:\n", fd_index )); sub = cff->subfonts[fd_index]; @@ -447,10 +447,6 @@ builder->hints_globals = (void *)internal->subfonts[fd_index]; } } -#ifdef FT_DEBUG_LEVEL_TRACE - else - FT_TRACE3(( "glyph index %d:\n", glyph_index )); -#endif decoder->num_locals = sub->local_subrs_index.count; decoder->locals = sub->local_subrs; diff --git a/reactos/lib/3rdparty/freetype/src/cff/cffload.c b/reactos/lib/3rdparty/freetype/src/cff/cffload.c index 64b497168d8..ff271f3d583 100644 --- a/reactos/lib/3rdparty/freetype/src/cff/cffload.c +++ b/reactos/lib/3rdparty/freetype/src/cff/cffload.c @@ -414,7 +414,7 @@ cur_offset = idx->offsets[0] - 1; /* sanity check */ - if ( cur_offset >= idx->data_size ) + if ( cur_offset != 0 ) { FT_TRACE0(( "cff_index_get_pointers:" " invalid first offset value %d set to zero\n", @@ -432,11 +432,11 @@ FT_ULong next_offset = idx->offsets[n] - 1; - /* empty slot + two sanity checks for invalid offset tables */ - if ( next_offset == 0 || - next_offset < cur_offset || - ( next_offset >= idx->data_size && n < idx->count ) ) + /* two sanity checks for invalid offset tables */ + if ( next_offset < cur_offset ) next_offset = cur_offset; + else if ( next_offset > idx->data_size ) + next_offset = idx->data_size; if ( !pool ) t[n] = org_bytes + next_offset; diff --git a/reactos/lib/3rdparty/freetype/src/cff/cffobjs.c b/reactos/lib/3rdparty/freetype/src/cff/cffobjs.c index dd750d10416..29c36915084 100644 --- a/reactos/lib/3rdparty/freetype/src/cff/cffobjs.c +++ b/reactos/lib/3rdparty/freetype/src/cff/cffobjs.c @@ -1055,7 +1055,7 @@ CFF_Driver driver = (CFF_Driver)module; - /* set default property values */ + /* set default property values, cf `ftcffdrv.h' */ #ifdef CFF_CONFIG_OPTION_OLD_ENGINE driver->hinting_engine = FT_CFF_HINTING_FREETYPE; #else @@ -1063,6 +1063,15 @@ #endif driver->no_stem_darkening = FALSE; + driver->darken_params[0] = 500; + driver->darken_params[1] = 400; + driver->darken_params[2] = 1000; + driver->darken_params[3] = 275; + driver->darken_params[4] = 1667; + driver->darken_params[5] = 275; + driver->darken_params[6] = 2333; + driver->darken_params[7] = 0; + return FT_Err_Ok; } diff --git a/reactos/lib/3rdparty/freetype/src/cff/cffobjs.h b/reactos/lib/3rdparty/freetype/src/cff/cffobjs.h index b375c20c743..dfbf9a96b0b 100644 --- a/reactos/lib/3rdparty/freetype/src/cff/cffobjs.h +++ b/reactos/lib/3rdparty/freetype/src/cff/cffobjs.h @@ -121,6 +121,8 @@ FT_BEGIN_HEADER FT_UInt hinting_engine; FT_Bool no_stem_darkening; + FT_Int darken_params[8]; + } CFF_DriverRec; diff --git a/reactos/lib/3rdparty/freetype/src/cid/cidgload.c b/reactos/lib/3rdparty/freetype/src/cid/cidgload.c index a1a86586935..7febab81c41 100644 --- a/reactos/lib/3rdparty/freetype/src/cid/cidgload.c +++ b/reactos/lib/3rdparty/freetype/src/cid/cidgload.c @@ -58,7 +58,7 @@ #endif - FT_TRACE4(( "cid_load_glyph: glyph index %d\n", glyph_index )); + FT_TRACE1(( "cid_load_glyph: glyph index %d\n", glyph_index )); #ifdef FT_CONFIG_OPTION_INCREMENTAL diff --git a/reactos/lib/3rdparty/freetype/src/cid/cidload.c b/reactos/lib/3rdparty/freetype/src/cid/cidload.c index f2a18ea5105..46def71b79e 100644 --- a/reactos/lib/3rdparty/freetype/src/cid/cidload.c +++ b/reactos/lib/3rdparty/freetype/src/cid/cidload.c @@ -150,8 +150,6 @@ cid_parse_font_matrix( CID_Face face, CID_Parser* parser ) { - FT_Matrix* matrix; - FT_Vector* offset; CID_FaceDict dict; FT_Face root = (FT_Face)&face->root; FT_Fixed temp[6]; @@ -160,6 +158,10 @@ if ( parser->num_dict >= 0 && parser->num_dict < face->cid.num_dicts ) { + FT_Matrix* matrix; + FT_Vector* offset; + + dict = face->cid.font_dicts + parser->num_dict; matrix = &dict->font_matrix; offset = &dict->font_offset; diff --git a/reactos/lib/3rdparty/freetype/src/gxvalid/gxvcommn.c b/reactos/lib/3rdparty/freetype/src/gxvalid/gxvcommn.c index 2ac80be8c7a..7af52342ba0 100644 --- a/reactos/lib/3rdparty/freetype/src/gxvalid/gxvcommn.c +++ b/reactos/lib/3rdparty/freetype/src/gxvalid/gxvcommn.c @@ -1288,7 +1288,9 @@ valid ); else { +#if 0 maxState = 1; /* 0:start of text, 1:start of line are predefined */ +#endif maxEntry = 0; } @@ -1621,8 +1623,10 @@ gxv_LookupTable_validate( table + classTable, table + classTable + classTable_length, valid ); +#if 0 if ( valid->subtable_length < classTable_length ) classTable_length = valid->subtable_length; +#endif } else { @@ -1641,7 +1645,9 @@ valid ); else { +#if 0 maxState = 1; /* 0:start of text, 1:start of line are predefined */ +#endif maxEntry = 0; } @@ -1727,6 +1733,7 @@ odtect->range[j].start, odtect->range[j].length ) ) { +#ifdef FT_DEBUG_LEVEL_TRACE if ( odtect->range[i].name || odtect->range[j].name ) GXV_TRACE(( "found overlap between range %d and range %d\n", i, j )); @@ -1734,6 +1741,7 @@ GXV_TRACE(( "found overlap between `%s' and `%s\'\n", odtect->range[i].name, odtect->range[j].name )); +#endif FT_INVALID_OFFSET; } diff --git a/reactos/lib/3rdparty/freetype/src/gxvalid/gxvcommn.h b/reactos/lib/3rdparty/freetype/src/gxvalid/gxvcommn.h index 1ff87e4423c..2f44a7515e3 100644 --- a/reactos/lib/3rdparty/freetype/src/gxvalid/gxvcommn.h +++ b/reactos/lib/3rdparty/freetype/src/gxvalid/gxvcommn.h @@ -318,7 +318,7 @@ FT_BEGIN_HEADER FT_BEGIN_STMNT \ { \ if ( (a) & 3 ) \ - FT_INVALID_OFFSET ; \ + FT_INVALID_OFFSET; \ } \ FT_END_STMNT diff --git a/reactos/lib/3rdparty/freetype/src/gxvalid/gxvmort.c b/reactos/lib/3rdparty/freetype/src/gxvalid/gxvmort.c index 5356e67ca72..c4d49b32d35 100644 --- a/reactos/lib/3rdparty/freetype/src/gxvalid/gxvmort.c +++ b/reactos/lib/3rdparty/freetype/src/gxvalid/gxvmort.c @@ -123,6 +123,7 @@ { FT_UNUSED( valid ); +#ifdef FT_DEBUG_LEVEL_TRACE if ( coverage & 0x8000U ) GXV_TRACE(( " this subtable is for vertical text only\n" )); else @@ -141,6 +142,7 @@ if ( coverage & 0x1FF8 ) GXV_TRACE(( " coverage has non-zero bits in reserved area\n" )); +#endif } diff --git a/reactos/lib/3rdparty/freetype/src/gxvalid/gxvmorx2.c b/reactos/lib/3rdparty/freetype/src/gxvalid/gxvmorx2.c index 9d2b0bc4af0..95b8ea40b44 100644 --- a/reactos/lib/3rdparty/freetype/src/gxvalid/gxvmorx2.c +++ b/reactos/lib/3rdparty/freetype/src/gxvalid/gxvmorx2.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT morx table validation */ /* body for type2 (Ligature Substitution) subtable. */ /* */ -/* Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ +/* Copyright 2005, 2013 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -317,7 +317,9 @@ gxv_XStateTable_validate( p, limit, valid ); +#if 0 p += valid->subtable_length; +#endif gxv_morx_subtable_type2_ligatureTable_validate( table, valid ); GXV_EXIT; diff --git a/reactos/lib/3rdparty/freetype/src/gzip/Jamfile b/reactos/lib/3rdparty/freetype/src/gzip/Jamfile deleted file mode 100644 index a7aafa05180..00000000000 --- a/reactos/lib/3rdparty/freetype/src/gzip/Jamfile +++ /dev/null @@ -1,16 +0,0 @@ -# FreeType 2 src/gzip Jamfile -# -# Copyright 2001 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) gzip ; - -Library $(FT2_LIB) : ftgzip.c ; - -# end of src/pcf Jamfile diff --git a/reactos/lib/3rdparty/freetype/src/gzip/ftgzip.c b/reactos/lib/3rdparty/freetype/src/gzip/ftgzip.c index f26755834f4..2c60b6c571c 100644 --- a/reactos/lib/3rdparty/freetype/src/gzip/ftgzip.c +++ b/reactos/lib/3rdparty/freetype/src/gzip/ftgzip.c @@ -596,6 +596,8 @@ } + /* documentation is in ftgzip.h */ + FT_EXPORT_DEF( FT_Error ) FT_Stream_OpenGzip( FT_Stream stream, FT_Stream source ) @@ -684,7 +686,64 @@ return error; } -#else /* !FT_CONFIG_OPTION_USE_ZLIB */ + + /* documentation is in ftgzip.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Gzip_Uncompress( FT_Memory memory, + FT_Byte* output, + FT_ULong* output_len, + const FT_Byte* input, + FT_ULong input_len ) + { + z_stream stream; + int err; + + + /* this function is modeled after zlib's `uncompress' function */ + + stream.next_in = (Bytef*)input; + stream.avail_in = (uInt)input_len; + + stream.next_out = output; + stream.avail_out = (uInt)*output_len; + + stream.zalloc = (alloc_func)ft_gzip_alloc; + stream.zfree = (free_func) ft_gzip_free; + stream.opaque = memory; + + err = inflateInit2( &stream, MAX_WBITS ); + if ( err != Z_OK ) + return FT_THROW( Invalid_Argument ); + + err = inflate( &stream, Z_FINISH ); + if ( err != Z_STREAM_END ) + { + inflateEnd( &stream ); + if ( err == Z_OK ) + err = Z_BUF_ERROR; + } + else + { + *output_len = stream.total_out; + + err = inflateEnd( &stream ); + } + + if ( err == Z_MEM_ERROR ) + return FT_THROW( Out_Of_Memory ); + + if ( err == Z_BUF_ERROR ) + return FT_THROW( Array_Too_Large ); + + if ( err == Z_DATA_ERROR ) + return FT_THROW( Invalid_Table ); + + return FT_Err_Ok; + } + + +#else /* !FT_CONFIG_OPTION_USE_ZLIB */ FT_EXPORT_DEF( FT_Error ) FT_Stream_OpenGzip( FT_Stream stream, @@ -696,6 +755,23 @@ return FT_THROW( Unimplemented_Feature ); } + + FT_EXPORT_DEF( FT_Error ) + FT_Gzip_Uncompress( FT_Memory memory, + FT_Byte* output, + FT_ULong* output_len, + const FT_Byte* input, + FT_ULong input_len ) + { + FT_UNUSED( memory ); + FT_UNUSED( output ); + FT_UNUSED( output_len ); + FT_UNUSED( input ); + FT_UNUSED( input_len ); + + return FT_THROW( Unimplemented_Feature ); + } + #endif /* !FT_CONFIG_OPTION_USE_ZLIB */ diff --git a/reactos/lib/3rdparty/freetype/src/gzip/rules.mk b/reactos/lib/3rdparty/freetype/src/gzip/rules.mk index d2a43a6a890..37cd9917653 100644 --- a/reactos/lib/3rdparty/freetype/src/gzip/rules.mk +++ b/reactos/lib/3rdparty/freetype/src/gzip/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2002, 2003 by +# Copyright 2002, 2003, 2013 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -27,49 +27,52 @@ else endif -# gzip support sources (i.e., C files) +# gzip support sources # -GZIP_DRV_SRC := $(GZIP_DIR)/ftgzip.c - -# gzip support headers +# All source and header files get loaded by `ftgzip.c' only if SYTEM_ZLIB is +# not defined (regardless whether we have a `single' or a `multi' build). +# However, it doesn't harm if we add everything as a dependency +# unconditionally. # -GZIP_DRV_H := +GZIP_DRV_SRCS := $(GZIP_DIR)/adler32.c \ + $(GZIP_DIR)/infblock.c \ + $(GZIP_DIR)/infblock.h \ + $(GZIP_DIR)/infcodes.c \ + $(GZIP_DIR)/infcodes.h \ + $(GZIP_DIR)/inffixed.h \ + $(GZIP_DIR)/inflate.c \ + $(GZIP_DIR)/inftrees.c \ + $(GZIP_DIR)/inftrees.h \ + $(GZIP_DIR)/infutil.c \ + $(GZIP_DIR)/infutil.h \ + $(GZIP_DIR)/zconf.h \ + $(GZIP_DIR)/zlib.h \ + $(GZIP_DIR)/zutil.c \ + $(GZIP_DIR)/zutil.h # gzip driver object(s) # -# GZIP_DRV_OBJ_M is used during `multi' builds -# GZIP_DRV_OBJ_S is used during `single' builds +# GZIP_DRV_OBJ is used during both `single' and `multi' builds # -ifeq ($(SYSTEM_ZLIB),) - GZIP_DRV_OBJ_M := $(GZIP_DRV_SRC:$(GZIP_DIR)/%.c=$(OBJ_DIR)/%.$O) -else - GZIP_DRV_OBJ_M := $(OBJ_DIR)/ftgzip.$O -endif -GZIP_DRV_OBJ_S := $(OBJ_DIR)/ftgzip.$O +GZIP_DRV_OBJ := $(OBJ_DIR)/ftgzip.$O -# gzip support source file for single build + +# gzip main source file # -GZIP_DRV_SRC_S := $(GZIP_DIR)/ftgzip.c +GZIP_DRV_SRC := $(GZIP_DIR)/ftgzip.c -# gzip support - single object +# gzip support - object # -$(GZIP_DRV_OBJ_S): $(GZIP_DRV_SRC_S) $(GZIP_DRV_SRC) $(FREETYPE_H) \ - $(GZIP_DRV_H) - $(GZIP_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(GZIP_DRV_SRC_S)) - - -# gzip support - multiple objects -# -$(OBJ_DIR)/%.$O: $(GZIP_DIR)/%.c $(FREETYPE_H) $(GZIP_DRV_H) - $(GZIP_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) +$(GZIP_DRV_OBJ): $(GZIP_DRV_SRC) $(GZIP_DRV_SRCS) $(FREETYPE_H) + $(GZIP_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(GZIP_DRV_SRC)) # update main driver object lists # -DRV_OBJS_S += $(GZIP_DRV_OBJ_S) -DRV_OBJS_M += $(GZIP_DRV_OBJ_M) +DRV_OBJS_S += $(GZIP_DRV_OBJ) +DRV_OBJS_M += $(GZIP_DRV_OBJ) # EOF diff --git a/reactos/lib/3rdparty/freetype/src/pcf/pcfdrivr.c b/reactos/lib/3rdparty/freetype/src/pcf/pcfdrivr.c index df25a645a07..748cbca8f1b 100644 --- a/reactos/lib/3rdparty/freetype/src/pcf/pcfdrivr.c +++ b/reactos/lib/3rdparty/freetype/src/pcf/pcfdrivr.c @@ -218,25 +218,24 @@ THE SOFTWARE. FT_FREE( face->metrics ); /* free properties */ + if ( face->properties ) { - PCF_Property prop; - FT_Int i; + FT_Int i; - if ( face->properties ) + for ( i = 0; i < face->nprops; i++ ) { - for ( i = 0; i < face->nprops; i++ ) - { - prop = &face->properties[i]; + PCF_Property prop = &face->properties[i]; - if ( prop ) - { - FT_FREE( prop->name ); - if ( prop->isString ) - FT_FREE( prop->value.atom ); - } + + if ( prop ) + { + FT_FREE( prop->name ); + if ( prop->isString ) + FT_FREE( prop->value.atom ); } } + FT_FREE( face->properties ); } @@ -264,11 +263,10 @@ THE SOFTWARE. FT_Parameter* params ) { PCF_Face face = (PCF_Face)pcfface; - FT_Error error = FT_Err_Ok; + FT_Error error; FT_UNUSED( num_params ); FT_UNUSED( params ); - FT_UNUSED( face_index ); FT_TRACE2(( "PCF driver\n" )); @@ -347,6 +345,18 @@ THE SOFTWARE. #endif } + /* PCF could not have multiple face in single font file. + * XXX: non-zero face_index is already invalid argument, but + * Type1, Type42 driver has a convention to return + * an invalid argument error when the font could be + * opened by the specified driver. + */ + if ( face_index > 0 ) { + FT_ERROR(( "PCF_Face_Init: invalid face index\n" )); + PCF_Face_Done( pcfface ); + return FT_THROW( Invalid_Argument ); + } + /* set up charmap */ { FT_String *charset_registry = face->charset_registry; @@ -482,7 +492,7 @@ THE SOFTWARE. FT_UNUSED( load_flags ); - FT_TRACE4(( "load_glyph %d ---", glyph_index )); + FT_TRACE1(( "PCF_Glyph_Load: glyph index %d\n", glyph_index )); if ( !face || glyph_index >= (FT_UInt)face->root.num_glyphs ) { @@ -576,8 +586,6 @@ THE SOFTWARE. ( face->accel.fontAscent + face->accel.fontDescent ) << 6 ); - FT_TRACE4(( " --- ok\n" )); - Exit: return error; } diff --git a/reactos/lib/3rdparty/freetype/src/pcf/pcfread.c b/reactos/lib/3rdparty/freetype/src/pcf/pcfread.c index 3c1bb7dfa24..ee41c5df3ae 100644 --- a/reactos/lib/3rdparty/freetype/src/pcf/pcfread.c +++ b/reactos/lib/3rdparty/freetype/src/pcf/pcfread.c @@ -1096,7 +1096,7 @@ THE SOFTWARE. pcf_load_font( FT_Stream stream, PCF_Face face ) { - FT_Error error = FT_Err_Ok; + FT_Error error; FT_Memory memory = FT_FACE( face )->memory; FT_Bool hasBDFAccelerators; diff --git a/reactos/lib/3rdparty/freetype/src/pcf/pcfutil.c b/reactos/lib/3rdparty/freetype/src/pcf/pcfutil.c index b91274f935b..0451ee8deff 100644 --- a/reactos/lib/3rdparty/freetype/src/pcf/pcfutil.c +++ b/reactos/lib/3rdparty/freetype/src/pcf/pcfutil.c @@ -66,11 +66,11 @@ in this Software without prior written authorization from The Open Group. TwoByteSwap( unsigned char* buf, size_t nbytes ) { - unsigned char c; - - for ( ; nbytes >= 2; nbytes -= 2, buf += 2 ) { + unsigned char c; + + c = buf[0]; buf[0] = buf[1]; buf[1] = c; @@ -85,11 +85,11 @@ in this Software without prior written authorization from The Open Group. FourByteSwap( unsigned char* buf, size_t nbytes ) { - unsigned char c; - - for ( ; nbytes >= 4; nbytes -= 4, buf += 4 ) { + unsigned char c; + + c = buf[0]; buf[0] = buf[3]; buf[3] = c; diff --git a/reactos/lib/3rdparty/freetype/src/pfr/pfrcmap.c b/reactos/lib/3rdparty/freetype/src/pfr/pfrcmap.c index 740c433d662..1f05640cc60 100644 --- a/reactos/lib/3rdparty/freetype/src/pfr/pfrcmap.c +++ b/reactos/lib/3rdparty/freetype/src/pfr/pfrcmap.c @@ -67,14 +67,16 @@ pfr_cmap_char_index( PFR_CMap cmap, FT_UInt32 char_code ) { - FT_UInt min = 0; - FT_UInt max = cmap->num_chars; - FT_UInt mid; - PFR_Char gchar; + FT_UInt min = 0; + FT_UInt max = cmap->num_chars; while ( min < max ) { + PFR_Char gchar; + FT_UInt mid; + + mid = min + ( max - min ) / 2; gchar = cmap->chars + mid; diff --git a/reactos/lib/3rdparty/freetype/src/pfr/pfrgload.c b/reactos/lib/3rdparty/freetype/src/pfr/pfrgload.c index 88b4d66a134..2ce093779c3 100644 --- a/reactos/lib/3rdparty/freetype/src/pfr/pfrgload.c +++ b/reactos/lib/3rdparty/freetype/src/pfr/pfrgload.c @@ -763,7 +763,7 @@ PFR_SubGlyph subglyph; - FT_TRACE4(( "subglyph %d:\n", n )); + FT_TRACE4(( " subglyph %d:\n", n )); subglyph = glyph->subs + old_count + n; old_points = base->n_points; diff --git a/reactos/lib/3rdparty/freetype/src/pfr/pfrobjs.c b/reactos/lib/3rdparty/freetype/src/pfr/pfrobjs.c index 75fc4c3f1f2..8d3cd2920b9 100644 --- a/reactos/lib/3rdparty/freetype/src/pfr/pfrobjs.c +++ b/reactos/lib/3rdparty/freetype/src/pfr/pfrobjs.c @@ -324,6 +324,8 @@ FT_ULong gps_offset; + FT_TRACE1(( "pfr_slot_load: glyph index %d\n", gindex )); + if ( gindex > 0 ) gindex--; diff --git a/reactos/lib/3rdparty/freetype/src/psaux/Jamfile b/reactos/lib/3rdparty/freetype/src/psaux/Jamfile deleted file mode 100644 index faeded90445..00000000000 --- a/reactos/lib/3rdparty/freetype/src/psaux/Jamfile +++ /dev/null @@ -1,31 +0,0 @@ -# FreeType 2 src/psaux Jamfile -# -# Copyright 2001, 2002 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) psaux ; - -{ - local _sources ; - - if $(FT2_MULTI) - { - _sources = psauxmod psobjs t1decode t1cmap - psconv afmparse - ; - } - else - { - _sources = psaux ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# end of src/psaux Jamfile diff --git a/reactos/lib/3rdparty/freetype/src/pshinter/pshglob.c b/reactos/lib/3rdparty/freetype/src/pshinter/pshglob.c index 9285efc9e16..f75bae45105 100644 --- a/reactos/lib/3rdparty/freetype/src/pshinter/pshglob.c +++ b/reactos/lib/3rdparty/freetype/src/pshinter/pshglob.c @@ -5,7 +5,7 @@ /* PostScript hinter global hinting management (body). */ /* Inspired by the new auto-hinter module. */ /* */ -/* Copyright 2001-2004, 2006, 2010, 2012 by */ +/* Copyright 2001-2004, 2006, 2010, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ @@ -757,7 +757,7 @@ FT_Fixed x_delta, FT_Fixed y_delta ) { - PSH_Dimension dim = &globals->dimension[0]; + PSH_Dimension dim; dim = &globals->dimension[0]; diff --git a/reactos/lib/3rdparty/freetype/src/raster/ftraster.c b/reactos/lib/3rdparty/freetype/src/raster/ftraster.c index bbd503d97d2..8aa11133ab8 100644 --- a/reactos/lib/3rdparty/freetype/src/raster/ftraster.c +++ b/reactos/lib/3rdparty/freetype/src/raster/ftraster.c @@ -24,8 +24,8 @@ /* */ /* - copy `src/raster/ftraster.c' (this file) to your current directory */ /* */ - /* - copy `include/freetype/ftimage.h' and `src/raster/ftmisc.h' */ - /* to your current directory */ + /* - copy `include/ftimage.h' and `src/raster/ftmisc.h' to your current */ + /* directory */ /* */ /* - compile `ftraster' with the _STANDALONE_ macro defined, as in */ /* */ diff --git a/reactos/lib/3rdparty/freetype/src/sfnt/pngshim.c b/reactos/lib/3rdparty/freetype/src/sfnt/pngshim.c index 408f879c348..878de1fefac 100644 --- a/reactos/lib/3rdparty/freetype/src/sfnt/pngshim.c +++ b/reactos/lib/3rdparty/freetype/src/sfnt/pngshim.c @@ -122,7 +122,7 @@ error_callback( png_structp png, png_const_charp error_msg ) { - FT_Error* error = png_get_error_ptr( png ); + FT_Error* error = (FT_Error*)png_get_error_ptr( png ); FT_UNUSED( error_msg ); @@ -159,7 +159,7 @@ if ( FT_FRAME_ENTER( length ) ) { - FT_Error* e = png_get_error_ptr( png ); + FT_Error* e = (FT_Error*)png_get_error_ptr( png ); *e = FT_THROW( Invalid_Stream_Read ); @@ -174,16 +174,18 @@ } - static FT_Error - Load_SBit_Png( FT_Bitmap* map, + FT_LOCAL_DEF( FT_Error ) + Load_SBit_Png( FT_GlyphSlot slot, FT_Int x_offset, FT_Int y_offset, FT_Int pix_bits, TT_SBit_Metrics metrics, FT_Memory memory, FT_Byte* data, - FT_UInt png_len ) + FT_UInt png_len, + FT_Bool populate_map_and_metrics ) { + FT_Bitmap *map = &slot->bitmap; FT_Error error = FT_Err_Ok; FT_StreamRec stream; @@ -193,12 +195,21 @@ int bitdepth, color_type, interlace; FT_Int i; - png_byte* *rows; + png_byte* *rows = NULL; /* pacify compiler */ - if ( x_offset < 0 || x_offset + metrics->width > map->width || - y_offset < 0 || y_offset + metrics->height > map->rows || - pix_bits != 32 || map->pixel_mode != FT_PIXEL_MODE_BGRA ) + if ( x_offset < 0 || + y_offset < 0 ) + { + error = FT_THROW( Invalid_Argument ); + goto Exit; + } + + if ( !populate_map_and_metrics && + ( x_offset + metrics->width > map->width || + y_offset + metrics->height > map->rows || + pix_bits != 32 || + map->pixel_mode != FT_PIXEL_MODE_BGRA ) ) { error = FT_THROW( Invalid_Argument ); goto Exit; @@ -238,11 +249,33 @@ &bitdepth, &color_type, &interlace, NULL, NULL ); - if ( error != FT_Err_Ok || - (FT_Int)imgWidth != metrics->width || - (FT_Int)imgHeight != metrics->height ) + if ( error || + ( !populate_map_and_metrics && + ( (FT_Int)imgWidth != metrics->width || + (FT_Int)imgHeight != metrics->height ) ) ) goto DestroyExit; + if ( populate_map_and_metrics ) + { + FT_Long size; + + + metrics->width = (FT_Int)imgWidth; + metrics->height = (FT_Int)imgHeight; + + map->width = metrics->width; + map->rows = metrics->height; + map->pixel_mode = FT_PIXEL_MODE_BGRA; + map->pitch = map->width * 4; + map->num_grays = 256; + + size = map->rows * map->pitch; + + error = ft_glyphslot_alloc_bitmap( slot, size ); + if ( error ) + goto DestroyExit; + } + /* convert palette/gray image to rgb */ if ( color_type == PNG_COLOR_TYPE_PALETTE ) png_set_palette_to_rgb( png ); diff --git a/reactos/lib/3rdparty/freetype/src/sfnt/pngshim.h b/reactos/lib/3rdparty/freetype/src/sfnt/pngshim.h index 8a2e69ccf9f..dc9ecaf9189 100644 --- a/reactos/lib/3rdparty/freetype/src/sfnt/pngshim.h +++ b/reactos/lib/3rdparty/freetype/src/sfnt/pngshim.h @@ -29,14 +29,15 @@ FT_BEGIN_HEADER #ifdef FT_CONFIG_OPTION_USE_PNG FT_LOCAL( FT_Error ) - Load_SBit_Png( FT_Bitmap* map, + Load_SBit_Png( FT_GlyphSlot slot, FT_Int x_offset, FT_Int y_offset, FT_Int pix_bits, TT_SBit_Metrics metrics, FT_Memory memory, FT_Byte* data, - FT_UInt png_len ); + FT_UInt png_len, + FT_Bool populate_map_and_metrics ); #endif diff --git a/reactos/lib/3rdparty/freetype/src/sfnt/sfdriver.c b/reactos/lib/3rdparty/freetype/src/sfnt/sfdriver.c index a368b8caeaa..e0132c920cc 100644 --- a/reactos/lib/3rdparty/freetype/src/sfnt/sfdriver.c +++ b/reactos/lib/3rdparty/freetype/src/sfnt/sfdriver.c @@ -499,8 +499,8 @@ tt_face_load_hmtx, /* see `ttsbit.h' and `sfnt.h' */ - PUT_EMBEDDED_BITMAPS( tt_face_load_eblc ), - PUT_EMBEDDED_BITMAPS( tt_face_free_eblc ), + PUT_EMBEDDED_BITMAPS( tt_face_load_sbit ), + PUT_EMBEDDED_BITMAPS( tt_face_free_sbit ), PUT_EMBEDDED_BITMAPS( tt_face_set_sbit_strike ), PUT_EMBEDDED_BITMAPS( tt_face_load_strike_metrics ), diff --git a/reactos/lib/3rdparty/freetype/src/sfnt/sfobjs.c b/reactos/lib/3rdparty/freetype/src/sfnt/sfobjs.c index f975e71c3ba..a31c77cbec6 100644 --- a/reactos/lib/3rdparty/freetype/src/sfnt/sfobjs.c +++ b/reactos/lib/3rdparty/freetype/src/sfnt/sfobjs.c @@ -27,6 +27,7 @@ #include FT_TRUETYPE_TAGS_H #include FT_SERVICE_POSTSCRIPT_CMAPS_H #include FT_SFNT_NAMES_H +#include FT_GZIP_H #include "sferrors.h" #ifdef TT_CONFIG_OPTION_BDF @@ -347,6 +348,380 @@ } +#define WRITE_BYTE( p, v ) \ + do \ + { \ + *(p)++ = (v) >> 0; \ + \ + } while ( 0 ) + +#define WRITE_USHORT( p, v ) \ + do \ + { \ + *(p)++ = (v) >> 8; \ + *(p)++ = (v) >> 0; \ + \ + } while ( 0 ) + +#define WRITE_ULONG( p, v ) \ + do \ + { \ + *(p)++ = (v) >> 24; \ + *(p)++ = (v) >> 16; \ + *(p)++ = (v) >> 8; \ + *(p)++ = (v) >> 0; \ + \ + } while ( 0 ) + + + static void + sfnt_stream_close( FT_Stream stream ) + { + FT_Memory memory = stream->memory; + + + FT_FREE( stream->base ); + + stream->size = 0; + stream->base = 0; + stream->close = 0; + } + + + FT_CALLBACK_DEF( int ) + compare_offsets( const void* a, + const void* b ) + { + WOFF_Table table1 = *(WOFF_Table*)a; + WOFF_Table table2 = *(WOFF_Table*)b; + + FT_ULong offset1 = table1->Offset; + FT_ULong offset2 = table2->Offset; + + + if ( offset1 > offset2 ) + return 1; + else if ( offset1 < offset2 ) + return -1; + else + return 0; + } + + + /* Replace `face->root.stream' with a stream containing the extracted */ + /* SFNT of a WOFF font. */ + + static FT_Error + woff_open_font( FT_Stream stream, + TT_Face face ) + { + FT_Memory memory = stream->memory; + FT_Error error = FT_Err_Ok; + + WOFF_HeaderRec woff; + WOFF_Table tables = NULL; + WOFF_Table* indices = NULL; + + FT_ULong woff_offset; + + FT_Byte* sfnt = NULL; + FT_Stream sfnt_stream = NULL; + + FT_Byte* sfnt_header; + FT_ULong sfnt_offset; + + FT_Int nn; + FT_ULong old_tag = 0; + + static const FT_Frame_Field woff_header_fields[] = + { +#undef FT_STRUCTURE +#define FT_STRUCTURE WOFF_HeaderRec + + FT_FRAME_START( 44 ), + FT_FRAME_ULONG ( signature ), + FT_FRAME_ULONG ( flavor ), + FT_FRAME_ULONG ( length ), + FT_FRAME_USHORT( num_tables ), + FT_FRAME_USHORT( reserved ), + FT_FRAME_ULONG ( totalSfntSize ), + FT_FRAME_USHORT( majorVersion ), + FT_FRAME_USHORT( minorVersion ), + FT_FRAME_ULONG ( metaOffset ), + FT_FRAME_ULONG ( metaLength ), + FT_FRAME_ULONG ( metaOrigLength ), + FT_FRAME_ULONG ( privOffset ), + FT_FRAME_ULONG ( privLength ), + FT_FRAME_END + }; + + + FT_ASSERT( stream == face->root.stream ); + FT_ASSERT( FT_STREAM_POS() == 0 ); + + if ( FT_STREAM_READ_FIELDS( woff_header_fields, &woff ) ) + return error; + + /* Make sure we don't recurse back here or hit TTC code. */ + if ( woff.flavor == TTAG_wOFF || woff.flavor == TTAG_ttcf ) + return FT_THROW( Invalid_Table ); + + /* Miscellaneous checks. */ + if ( woff.length != stream->size || + woff.num_tables == 0 || + 44 + woff.num_tables * 20UL >= woff.length || + 12 + woff.num_tables * 16UL >= woff.totalSfntSize || + ( woff.totalSfntSize & 3 ) != 0 || + ( woff.metaOffset == 0 && ( woff.metaLength != 0 || + woff.metaOrigLength != 0 ) ) || + ( woff.metaLength != 0 && woff.metaOrigLength == 0 ) || + ( woff.privOffset == 0 && woff.privLength != 0 ) ) + return FT_THROW( Invalid_Table ); + + if ( FT_ALLOC( sfnt, woff.totalSfntSize ) || + FT_NEW( sfnt_stream ) ) + goto Exit; + + sfnt_header = sfnt; + + /* Write sfnt header. */ + { + FT_UInt searchRange, entrySelector, rangeShift, x; + + + x = woff.num_tables; + entrySelector = 0; + while ( x ) + { + x >>= 1; + entrySelector += 1; + } + entrySelector--; + + searchRange = ( 1 << entrySelector ) * 16; + rangeShift = woff.num_tables * 16 - searchRange; + + WRITE_ULONG ( sfnt_header, woff.flavor ); + WRITE_USHORT( sfnt_header, woff.num_tables ); + WRITE_USHORT( sfnt_header, searchRange ); + WRITE_USHORT( sfnt_header, entrySelector ); + WRITE_USHORT( sfnt_header, rangeShift ); + } + + /* While the entries in the sfnt header must be sorted by the */ + /* tag value, the tables themselves are not. We thus have to */ + /* sort them by offset and check that they don't overlap. */ + + if ( FT_NEW_ARRAY( tables, woff.num_tables ) || + FT_NEW_ARRAY( indices, woff.num_tables ) ) + goto Exit; + + FT_TRACE2(( "\n" + " tag offset compLen origLen checksum\n" + " -------------------------------------------\n" )); + + if ( FT_FRAME_ENTER( 20L * woff.num_tables ) ) + goto Exit; + + for ( nn = 0; nn < woff.num_tables; nn++ ) + { + WOFF_Table table = tables + nn; + + table->Tag = FT_GET_TAG4(); + table->Offset = FT_GET_ULONG(); + table->CompLength = FT_GET_ULONG(); + table->OrigLength = FT_GET_ULONG(); + table->CheckSum = FT_GET_ULONG(); + + FT_TRACE2(( " %c%c%c%c %08lx %08lx %08lx %08lx\n", + (FT_Char)( table->Tag >> 24 ), + (FT_Char)( table->Tag >> 16 ), + (FT_Char)( table->Tag >> 8 ), + (FT_Char)( table->Tag ), + table->Offset, + table->CompLength, + table->OrigLength, + table->CheckSum )); + + if ( table->Tag <= old_tag ) + { + FT_FRAME_EXIT(); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + old_tag = table->Tag; + indices[nn] = table; + } + + FT_FRAME_EXIT(); + + /* Sort by offset. */ + + ft_qsort( indices, + woff.num_tables, + sizeof ( WOFF_Table ), + compare_offsets ); + + /* Check offsets and lengths. */ + + woff_offset = 44 + woff.num_tables * 20L; + sfnt_offset = 12 + woff.num_tables * 16L; + + for ( nn = 0; nn < woff.num_tables; nn++ ) + { + WOFF_Table table = indices[nn]; + + + if ( table->Offset != woff_offset || + table->Offset + table->CompLength > woff.length || + sfnt_offset + table->OrigLength > woff.totalSfntSize || + table->CompLength > table->OrigLength ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + table->OrigOffset = sfnt_offset; + + /* The offsets must be multiples of 4. */ + woff_offset += ( table->CompLength + 3 ) & ~3; + sfnt_offset += ( table->OrigLength + 3 ) & ~3; + } + + /* + * Final checks! + * + * We don't decode and check the metadata block. + * We don't check table checksums either. + * But other than those, I think we implement all + * `MUST' checks from the spec. + */ + + if ( woff.metaOffset ) + { + if ( woff.metaOffset != woff_offset || + woff.metaOffset + woff.metaLength > woff.length ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + /* We have padding only ... */ + woff_offset += woff.metaLength; + } + + if ( woff.privOffset ) + { + /* ... if it isn't the last block. */ + woff_offset = ( woff_offset + 3 ) & ~3; + + if ( woff.privOffset != woff_offset || + woff.privOffset + woff.privLength > woff.length ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + /* No padding for the last block. */ + woff_offset += woff.privLength; + } + + if ( sfnt_offset != woff.totalSfntSize || + woff_offset != woff.length ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + /* Write the tables. */ + + for ( nn = 0; nn < woff.num_tables; nn++ ) + { + WOFF_Table table = tables + nn; + + + /* Write SFNT table entry. */ + WRITE_ULONG( sfnt_header, table->Tag ); + WRITE_ULONG( sfnt_header, table->CheckSum ); + WRITE_ULONG( sfnt_header, table->OrigOffset ); + WRITE_ULONG( sfnt_header, table->OrigLength ); + + /* Write table data. */ + if ( FT_STREAM_SEEK( table->Offset ) || + FT_FRAME_ENTER( table->CompLength ) ) + goto Exit; + + if ( table->CompLength == table->OrigLength ) + { + /* Uncompressed data; just copy. */ + ft_memcpy( sfnt + table->OrigOffset, + stream->cursor, + table->OrigLength ); + } + else + { + /* Uncompress with zlib. */ + FT_ULong output_len = table->OrigLength; + + + error = FT_Gzip_Uncompress( memory, + sfnt + table->OrigOffset, &output_len, + stream->cursor, table->CompLength ); + if ( error ) + goto Exit; + if ( output_len != table->OrigLength ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + } + + FT_FRAME_EXIT(); + + /* We don't check whether the padding bytes in the WOFF file are */ + /* actually '\0'. For the output, however, we do set them properly. */ + sfnt_offset = table->OrigOffset + table->OrigLength; + while ( sfnt_offset & 3 ) + { + sfnt[sfnt_offset] = '\0'; + sfnt_offset++; + } + } + + /* Ok! Finally ready. Swap out stream and return. */ + FT_Stream_OpenMemory( sfnt_stream, sfnt, woff.totalSfntSize ); + sfnt_stream->memory = stream->memory; + sfnt_stream->close = sfnt_stream_close; + + FT_Stream_Free( + face->root.stream, + ( face->root.face_flags & FT_FACE_FLAG_EXTERNAL_STREAM ) != 0 ); + + face->root.stream = sfnt_stream; + + face->root.face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM; + + Exit: + FT_FREE( tables ); + FT_FREE( indices ); + + if ( error ) + { + FT_FREE( sfnt ); + FT_Stream_Close( sfnt_stream ); + FT_FREE( sfnt_stream ); + } + + return error; + } + + +#undef WRITE_BYTE +#undef WRITE_USHORT +#undef WRITE_ULONG + + /* Fill in face->ttc_header. If the font is not a TTC, it is */ /* synthesized into a TTC with one offset table. */ static FT_Error @@ -373,11 +748,28 @@ face->ttc_header.version = 0; face->ttc_header.count = 0; + retry: offset = FT_STREAM_POS(); if ( FT_READ_ULONG( tag ) ) return error; + if ( tag == TTAG_wOFF ) + { + FT_TRACE2(( "sfnt_open_font: file is a WOFF; synthesizing SFNT\n" )); + + if ( FT_STREAM_SEEK( offset ) ) + return error; + + error = woff_open_font( stream, face ); + if ( error ) + return error; + + /* Swap out stream and retry! */ + stream = face->root.stream; + goto retry; + } + if ( tag != 0x00010000UL && tag != TTAG_ttcf && tag != TTAG_OTTO && @@ -480,6 +872,9 @@ if ( error ) return error; + /* Stream may have changed in sfnt_open_font. */ + stream = face->root.stream; + FT_TRACE2(( "sfnt_init_face: %08p, %ld\n", face, face_index )); if ( face_index < 0 ) @@ -504,7 +899,8 @@ #define LOAD_( x ) \ - do { \ + do \ + { \ FT_TRACE2(( "`" #x "' " )); \ FT_TRACE3(( "-->\n" )); \ \ @@ -519,7 +915,8 @@ } while ( 0 ) #define LOADM_( x, vertical ) \ - do { \ + do \ + { \ FT_TRACE2(( "`%s" #x "' ", \ vertical ? "vertical " : "" )); \ FT_TRACE3(( "-->\n" )); \ @@ -535,7 +932,8 @@ } while ( 0 ) #define GET_NAME( id, field ) \ - do { \ + do \ + { \ error = tt_face_get_name( face, TT_NAME_ID_ ## id, field ); \ if ( error ) \ goto Exit; \ @@ -555,6 +953,7 @@ #endif FT_Bool has_outline; FT_Bool is_apple_sbit; + FT_Bool is_apple_sbix; FT_Bool ignore_preferred_family = FALSE; FT_Bool ignore_preferred_subfamily = FALSE; @@ -608,6 +1007,14 @@ #endif is_apple_sbit = 0; + is_apple_sbix = !face->goto_table( face, TTAG_sbix, stream, 0 ); + + /* Apple 'sbix' color bitmaps are rendered scaled and then the 'glyf' + * outline rendered on top. We don't support that yet, so just ignore + * the 'glyf' outline and advertise it as a bitmap-only font. */ + if ( is_apple_sbix ) + has_outline = FALSE; + /* if this font doesn't contain outlines, we try to load */ /* a `bhed' table */ @@ -619,7 +1026,7 @@ /* load the font header (`head' table) if this isn't an Apple */ /* sbit font file */ - if ( !is_apple_sbit ) + if ( !is_apple_sbit || is_apple_sbix ) { LOAD_( head ); if ( error ) @@ -803,6 +1210,10 @@ /* */ /* Compute face flags. */ /* */ + if ( face->sbit_table_type == TT_SBIT_TABLE_TYPE_CBLC || + face->sbit_table_type == TT_SBIT_TABLE_TYPE_SBIX ) + flags |= FT_FACE_FLAG_COLOR; /* color glyphs */ + if ( has_outline == TRUE ) flags |= FT_FACE_FLAG_SCALABLE; /* scalable outlines */ @@ -931,7 +1342,7 @@ if ( em_size == 0 || face->os2.version == 0xFFFFU ) { - avgwidth = 0; + avgwidth = 1; em_size = 1; } diff --git a/reactos/lib/3rdparty/freetype/src/sfnt/ttcmap.c b/reactos/lib/3rdparty/freetype/src/sfnt/ttcmap.c index 1507202ea82..9b7856ba589 100644 --- a/reactos/lib/3rdparty/freetype/src/sfnt/ttcmap.c +++ b/reactos/lib/3rdparty/freetype/src/sfnt/ttcmap.c @@ -320,9 +320,8 @@ /* parse sub-headers */ for ( n = 0; n <= max_subs; n++ ) { - FT_UInt first_code, code_count, offset; - FT_Int delta; - FT_Byte* ids; + FT_UInt first_code, code_count, offset; + FT_Int delta; first_code = TT_NEXT_USHORT( p ); @@ -344,6 +343,9 @@ /* check offset */ if ( offset != 0 ) { + FT_Byte* ids; + + ids = p - 2 + offset; if ( ids < glyph_ids || ids + code_count*2 > table + length ) FT_INVALID_OFFSET; @@ -3208,7 +3210,6 @@ { FT_Byte *p = tt_cmap14_find_variant( cmap->data + 6, variantSelector ); - FT_UInt32 *ret; FT_Int i; FT_ULong defOff; FT_ULong nondefOff; @@ -3242,6 +3243,8 @@ FT_Byte* dp; FT_UInt di, ni, k; + FT_UInt32 *ret; + p = cmap->data + nondefOff; dp = cmap->data + defOff; diff --git a/reactos/lib/3rdparty/freetype/src/sfnt/ttkern.c b/reactos/lib/3rdparty/freetype/src/sfnt/ttkern.c index 60ee546d793..32c4008b23c 100644 --- a/reactos/lib/3rdparty/freetype/src/sfnt/ttkern.c +++ b/reactos/lib/3rdparty/freetype/src/sfnt/ttkern.c @@ -5,7 +5,7 @@ /* Load the basic TrueType kerning table. This doesn't handle */ /* kerning data within the GPOS table at the moment. */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 by */ +/* Copyright 1996-2007, 2009, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -183,7 +183,7 @@ FT_UInt right_glyph ) { FT_Int result = 0; - FT_UInt count, mask = 1; + FT_UInt count, mask; FT_Byte* p = face->kern_table; FT_Byte* p_limit = p + face->kern_table_size; @@ -196,7 +196,7 @@ count--, mask <<= 1 ) { FT_Byte* base = p; - FT_Byte* next = base; + FT_Byte* next; FT_UInt version = FT_NEXT_USHORT( p ); FT_UInt length = FT_NEXT_USHORT( p ); FT_UInt coverage = FT_NEXT_USHORT( p ); diff --git a/reactos/lib/3rdparty/freetype/src/sfnt/ttload.c b/reactos/lib/3rdparty/freetype/src/sfnt/ttload.c index fbe70f7974a..0a3cd29dbae 100644 --- a/reactos/lib/3rdparty/freetype/src/sfnt/ttload.c +++ b/reactos/lib/3rdparty/freetype/src/sfnt/ttload.c @@ -236,7 +236,8 @@ */ if ( table.Length < 0x36 ) { - FT_TRACE2(( "check_table_dir: `head' table too small\n" )); + FT_TRACE2(( "check_table_dir:" + " `head' or `bhed' table too small\n" )); error = FT_THROW( Table_Missing ); goto Exit; } @@ -246,12 +247,8 @@ goto Exit; if ( magic != 0x5F0F3CF5UL ) - { FT_TRACE2(( "check_table_dir:" - " no magic number found in `head' table\n")); - error = FT_THROW( Table_Missing ); - goto Exit; - } + " invalid magic number in `head' or `bhed' table\n")); if ( FT_STREAM_SEEK( offset + ( nn + 1 ) * 16 ) ) goto Exit; @@ -394,8 +391,8 @@ { entry->Tag = FT_GET_TAG4(); entry->CheckSum = FT_GET_ULONG(); - entry->Offset = FT_GET_LONG(); - entry->Length = FT_GET_LONG(); + entry->Offset = FT_GET_ULONG(); + entry->Length = FT_GET_ULONG(); /* ignore invalid tables */ if ( entry->Offset + entry->Length > stream->size ) @@ -1006,7 +1003,8 @@ FT_FRAME_END }; - static const FT_Frame_Field os2_fields_extra[] = + /* `OS/2' version 1 and newer */ + static const FT_Frame_Field os2_fields_extra1[] = { FT_FRAME_START( 8 ), FT_FRAME_ULONG( ulCodePageRange1 ), @@ -1014,6 +1012,7 @@ FT_FRAME_END }; + /* `OS/2' version 2 and newer */ static const FT_Frame_Field os2_fields_extra2[] = { FT_FRAME_START( 10 ), @@ -1025,6 +1024,15 @@ FT_FRAME_END }; + /* `OS/2' version 5 and newer */ + static const FT_Frame_Field os2_fields_extra5[] = + { + FT_FRAME_START( 4 ), + FT_FRAME_USHORT( usLowerOpticalPointSize ), + FT_FRAME_USHORT( usUpperOpticalPointSize ), + FT_FRAME_END + }; + /* We now support old Mac fonts where the OS/2 table doesn't */ /* exist. Simply put, we set the `version' field to 0xFFFF */ @@ -1038,18 +1046,20 @@ if ( FT_STREAM_READ_FIELDS( os2_fields, os2 ) ) goto Exit; - os2->ulCodePageRange1 = 0; - os2->ulCodePageRange2 = 0; - os2->sxHeight = 0; - os2->sCapHeight = 0; - os2->usDefaultChar = 0; - os2->usBreakChar = 0; - os2->usMaxContext = 0; + os2->ulCodePageRange1 = 0; + os2->ulCodePageRange2 = 0; + os2->sxHeight = 0; + os2->sCapHeight = 0; + os2->usDefaultChar = 0; + os2->usBreakChar = 0; + os2->usMaxContext = 0; + os2->usLowerOpticalPointSize = 0; + os2->usUpperOpticalPointSize = 0xFFFF; if ( os2->version >= 0x0001 ) { /* only version 1 tables */ - if ( FT_STREAM_READ_FIELDS( os2_fields_extra, os2 ) ) + if ( FT_STREAM_READ_FIELDS( os2_fields_extra1, os2 ) ) goto Exit; if ( os2->version >= 0x0002 ) @@ -1057,6 +1067,13 @@ /* only version 2 tables */ if ( FT_STREAM_READ_FIELDS( os2_fields_extra2, os2 ) ) goto Exit; + + if ( os2->version >= 0x0005 ) + { + /* only version 5 tables */ + if ( FT_STREAM_READ_FIELDS( os2_fields_extra5, os2 ) ) + goto Exit; + } } } @@ -1164,6 +1181,7 @@ FT_FRAME_USHORT( Style ), FT_FRAME_USHORT( TypeFamily ), FT_FRAME_USHORT( CapHeight ), + FT_FRAME_USHORT( SymbolSet ), FT_FRAME_BYTES ( TypeFace, 16 ), FT_FRAME_BYTES ( CharacterComplement, 8 ), FT_FRAME_BYTES ( FileName, 6 ), diff --git a/reactos/lib/3rdparty/freetype/src/sfnt/ttmtx.c b/reactos/lib/3rdparty/freetype/src/sfnt/ttmtx.c index 371a9edabee..a8cc63a1151 100644 --- a/reactos/lib/3rdparty/freetype/src/sfnt/ttmtx.c +++ b/reactos/lib/3rdparty/freetype/src/sfnt/ttmtx.c @@ -183,20 +183,23 @@ /* tt_face_get_metrics */ /* */ /* */ - /* Returns the horizontal or vertical metrics in font units for a */ - /* given glyph. The metrics are the left side bearing (resp. top */ - /* side bearing) and advance width (resp. advance height). */ + /* Return the horizontal or vertical metrics in font units for a */ + /* given glyph. The values are the left side bearing (top side */ + /* bearing for vertical metrics) and advance width (advance height */ + /* for vertical metrics). */ /* */ /* */ - /* header :: A pointer to either the horizontal or vertical metrics */ - /* structure. */ + /* face :: A pointer to the TrueType face structure. */ /* */ - /* idx :: The glyph index. */ + /* vertical :: If set to TRUE, get vertical metrics. */ + /* */ + /* gindex :: The glyph index. */ /* */ /* */ - /* bearing :: The bearing, either left side or top side. */ + /* abearing :: The bearing, either left side or top side. */ /* */ - /* advance :: The advance width resp. advance height. */ + /* aadvance :: The advance width or advance height, depending on */ + /* the `vertical' flag. */ /* */ FT_LOCAL_DEF( FT_Error ) tt_face_get_metrics( TT_Face face, diff --git a/reactos/lib/3rdparty/freetype/src/sfnt/ttsbit.c b/reactos/lib/3rdparty/freetype/src/sfnt/ttsbit.c index cd3e5a4a004..7469ff1ecbc 100644 --- a/reactos/lib/3rdparty/freetype/src/sfnt/ttsbit.c +++ b/reactos/lib/3rdparty/freetype/src/sfnt/ttsbit.c @@ -28,6 +28,7 @@ #include "sferrors.h" +#include "ttmtx.h" #include "pngshim.h" @@ -42,25 +43,36 @@ FT_LOCAL_DEF( FT_Error ) - tt_face_load_eblc( TT_Face face, + tt_face_load_sbit( TT_Face face, FT_Stream stream ) { - FT_Error error = FT_Err_Ok; - FT_Fixed version; - FT_ULong num_strikes, table_size; - FT_Byte* p; - FT_Byte* p_limit; - FT_UInt count; + FT_Error error; + FT_ULong table_size; + face->sbit_table = NULL; + face->sbit_table_size = 0; + face->sbit_table_type = TT_SBIT_TABLE_TYPE_NONE; face->sbit_num_strikes = 0; - /* this table is optional */ error = face->goto_table( face, TTAG_CBLC, stream, &table_size ); - if ( error ) + if ( !error ) + face->sbit_table_type = TT_SBIT_TABLE_TYPE_CBLC; + else + { error = face->goto_table( face, TTAG_EBLC, stream, &table_size ); + if ( error ) + error = face->goto_table( face, TTAG_bloc, stream, &table_size ); + if ( !error ) + face->sbit_table_type = TT_SBIT_TABLE_TYPE_EBLC; + } + if ( error ) - error = face->goto_table( face, TTAG_bloc, stream, &table_size ); + { + error = face->goto_table( face, TTAG_sbix, stream, &table_size ); + if ( !error ) + face->sbit_table_type = TT_SBIT_TABLE_TYPE_SBIX; + } if ( error ) goto Exit; @@ -71,53 +83,130 @@ goto Exit; } - if ( FT_FRAME_EXTRACT( table_size, face->sbit_table ) ) - goto Exit; - - face->sbit_table_size = table_size; - - p = face->sbit_table; - p_limit = p + table_size; - - version = FT_NEXT_ULONG( p ); - num_strikes = FT_NEXT_ULONG( p ); - - if ( version != 0x00020000UL || num_strikes >= 0x10000UL ) + switch ( (FT_UInt)face->sbit_table_type ) { - FT_ERROR(( "tt_face_load_sbit_strikes: invalid table version\n" )); - error = FT_THROW( Invalid_File_Format ); - goto Fail; + case TT_SBIT_TABLE_TYPE_EBLC: + case TT_SBIT_TABLE_TYPE_CBLC: + { + FT_Byte* p; + FT_Fixed version; + FT_ULong num_strikes; + FT_UInt count; + + + if ( FT_FRAME_EXTRACT( table_size, face->sbit_table ) ) + goto Exit; + + face->sbit_table_size = table_size; + + p = face->sbit_table; + + version = FT_NEXT_ULONG( p ); + num_strikes = FT_NEXT_ULONG( p ); + + if ( ( version & 0xFFFF0000UL ) != 0x00020000UL ) + { + error = FT_THROW( Unknown_File_Format ); + goto Exit; + } + + if ( num_strikes >= 0x10000UL ) + { + error = FT_THROW( Invalid_File_Format ); + goto Exit; + } + + /* + * Count the number of strikes available in the table. We are a bit + * paranoid there and don't trust the data. + */ + count = (FT_UInt)num_strikes; + if ( 8 + 48UL * count > table_size ) + count = (FT_UInt)( ( table_size - 8 ) / 48 ); + + face->sbit_num_strikes = count; + } + break; + + case TT_SBIT_TABLE_TYPE_SBIX: + { + FT_UShort version; + FT_UShort flags; + FT_ULong num_strikes; + FT_UInt count; + + + if ( FT_FRAME_ENTER( 8 ) ) + goto Exit; + + version = FT_GET_USHORT(); + flags = FT_GET_USHORT(); + num_strikes = FT_GET_ULONG(); + + FT_FRAME_EXIT(); + + if ( version < 1 ) + { + error = FT_THROW( Unknown_File_Format ); + goto Exit; + } + if ( flags != 0x0001 || num_strikes >= 0x10000UL ) + { + error = FT_THROW( Invalid_File_Format ); + goto Exit; + } + + /* + * Count the number of strikes available in the table. We are a bit + * paranoid there and don't trust the data. + */ + count = (FT_UInt)num_strikes; + if ( 8 + 4UL * count > table_size ) + count = (FT_UInt)( ( table_size - 8 ) / 4 ); + + if ( FT_STREAM_SEEK( FT_STREAM_POS() - 8 ) ) + goto Exit; + + face->sbit_table_size = 8 + count * 4; + if ( FT_FRAME_EXTRACT( face->sbit_table_size, face->sbit_table ) ) + goto Exit; + + face->sbit_num_strikes = count; + } + break; + + default: + error = FT_THROW( Unknown_File_Format ); + break; } - /* - * Count the number of strikes available in the table. We are a bit - * paranoid there and don't trust the data. - */ - count = (FT_UInt)num_strikes; - if ( 8 + 48UL * count > table_size ) - count = (FT_UInt)( ( p_limit - p ) / 48 ); + if ( !error ) + FT_TRACE3(( "sbit_num_strikes: %u\n", face->sbit_num_strikes )); - face->sbit_num_strikes = count; + return FT_Err_Ok; - FT_TRACE3(( "sbit_num_strikes: %u\n", count )); Exit: - return error; + if ( error ) + { + if ( face->sbit_table ) + FT_FRAME_RELEASE( face->sbit_table ); + face->sbit_table_size = 0; + face->sbit_table_type = TT_SBIT_TABLE_TYPE_NONE; + } - Fail: - FT_FRAME_RELEASE( face->sbit_table ); - face->sbit_table_size = 0; - goto Exit; + return error; } FT_LOCAL_DEF( void ) - tt_face_free_eblc( TT_Face face ) + tt_face_free_sbit( TT_Face face ) { FT_Stream stream = face->root.stream; FT_FRAME_RELEASE( face->sbit_table ); face->sbit_table_size = 0; + face->sbit_table_type = TT_SBIT_TABLE_TYPE_NONE; face->sbit_num_strikes = 0; } @@ -136,28 +225,85 @@ FT_ULong strike_index, FT_Size_Metrics* metrics ) { - FT_Byte* strike; - - if ( strike_index >= (FT_ULong)face->sbit_num_strikes ) return FT_THROW( Invalid_Argument ); - strike = face->sbit_table + 8 + strike_index * 48; + switch ( (FT_UInt)face->sbit_table_type ) + { + case TT_SBIT_TABLE_TYPE_EBLC: + case TT_SBIT_TABLE_TYPE_CBLC: + { + FT_Byte* strike; - metrics->x_ppem = (FT_UShort)strike[44]; - metrics->y_ppem = (FT_UShort)strike[45]; - metrics->ascender = (FT_Char)strike[16] << 6; /* hori.ascender */ - metrics->descender = (FT_Char)strike[17] << 6; /* hori.descender */ - metrics->height = metrics->ascender - metrics->descender; + strike = face->sbit_table + 8 + strike_index * 48; - /* XXX: Is this correct? */ - metrics->max_advance = ( (FT_Char)strike[22] + /* min_origin_SB */ - strike[18] + /* max_width */ - (FT_Char)strike[23] /* min_advance_SB */ - ) << 6; + metrics->x_ppem = (FT_UShort)strike[44]; + metrics->y_ppem = (FT_UShort)strike[45]; - return FT_Err_Ok; + metrics->ascender = (FT_Char)strike[16] << 6; /* hori.ascender */ + metrics->descender = (FT_Char)strike[17] << 6; /* hori.descender */ + metrics->height = metrics->ascender - metrics->descender; + + /* Is this correct? */ + metrics->max_advance = ( (FT_Char)strike[22] + /* min_origin_SB */ + strike[18] + /* max_width */ + (FT_Char)strike[23] /* min_advance_SB */ + ) << 6; + return FT_Err_Ok; + } + + case TT_SBIT_TABLE_TYPE_SBIX: + { + FT_Stream stream = face->root.stream; + FT_UInt offset, ppem, resolution, upem; + TT_HoriHeader *hori; + FT_ULong table_size; + + FT_Error error; + FT_Byte* p; + + + p = face->sbit_table + 8 + 4 * strike_index; + offset = FT_NEXT_ULONG( p ); + + error = face->goto_table( face, TTAG_sbix, stream, &table_size ); + if ( error ) + return error; + + if ( offset + 4 > table_size ) + return FT_THROW( Invalid_File_Format ); + + if ( FT_STREAM_SEEK( FT_STREAM_POS() + offset ) || + FT_FRAME_ENTER( 4 ) ) + return error; + + ppem = FT_GET_USHORT(); + resolution = FT_GET_USHORT(); + + FT_UNUSED( resolution ); /* What to do with this? */ + + FT_FRAME_EXIT(); + + upem = face->header.Units_Per_EM; + hori = &face->horizontal; + + metrics->x_ppem = ppem; + metrics->y_ppem = ppem; + + metrics->ascender = ppem * hori->Ascender * 64 / upem; + metrics->descender = ppem * hori->Descender * 64 / upem; + metrics->height = ppem * ( hori->Ascender - + hori->Descender + + hori->Line_Gap ) * 64 / upem; + metrics->max_advance = ppem * hori->advance_Width_Max * 64 / upem; + + return error; + } + + default: + return FT_THROW( Unknown_File_Format ); + } } @@ -253,8 +399,7 @@ static FT_Error - tt_sbit_decoder_alloc_bitmap( TT_SBitDecoder decoder, - FT_UInt load_flags ) + tt_sbit_decoder_alloc_bitmap( TT_SBitDecoder decoder ) { FT_Error error = FT_Err_Ok; FT_UInt width, height; @@ -301,18 +446,9 @@ break; case 32: - if ( load_flags & FT_LOAD_COLOR ) - { - map->pixel_mode = FT_PIXEL_MODE_BGRA; - map->pitch = map->width * 4; - map->num_grays = 256; - } - else - { - map->pixel_mode = FT_PIXEL_MODE_GRAY; - map->pitch = map->width; - map->num_grays = 256; - } + map->pixel_mode = FT_PIXEL_MODE_BGRA; + map->pitch = map->width * 4; + map->num_grays = 256; break; default: @@ -382,13 +518,11 @@ /* forward declaration */ static FT_Error tt_sbit_decoder_load_image( TT_SBitDecoder decoder, - FT_UInt load_flags, FT_UInt glyph_index, FT_Int x_pos, FT_Int y_pos ); typedef FT_Error (*TT_SBitDecoder_LoadFunc)( TT_SBitDecoder decoder, - FT_UInt load_flags, FT_Byte* p, FT_Byte* plimit, FT_Int x_pos, @@ -397,7 +531,6 @@ static FT_Error tt_sbit_decoder_load_byte_aligned( TT_SBitDecoder decoder, - FT_UInt load_flags, FT_Byte* p, FT_Byte* limit, FT_Int x_pos, @@ -408,8 +541,6 @@ FT_Int bit_height, bit_width, pitch, width, height, line_bits, h; FT_Bitmap* bitmap; - FT_UNUSED( load_flags ); - /* check that we can write the glyph into the bitmap */ bitmap = decoder->bitmap; @@ -538,7 +669,6 @@ static FT_Error tt_sbit_decoder_load_bit_aligned( TT_SBitDecoder decoder, - FT_UInt load_flags, FT_Byte* p, FT_Byte* limit, FT_Int x_pos, @@ -550,8 +680,6 @@ FT_Bitmap* bitmap; FT_UShort rval; - FT_UNUSED( load_flags ); - /* check that we can write the glyph into the bitmap */ bitmap = decoder->bitmap; @@ -664,7 +792,6 @@ static FT_Error tt_sbit_decoder_load_compound( TT_SBitDecoder decoder, - FT_UInt load_flags, FT_Byte* p, FT_Byte* limit, FT_Int x_pos, @@ -702,7 +829,7 @@ /* NB: a recursive call */ - error = tt_sbit_decoder_load_image( decoder, load_flags, gindex, + error = tt_sbit_decoder_load_image( decoder, gindex, x_pos + dx, y_pos + dy ); if ( error ) break; @@ -732,7 +859,6 @@ static FT_Error tt_sbit_decoder_load_png( TT_SBitDecoder decoder, - FT_UInt load_flags, FT_Byte* p, FT_Byte* limit, FT_Int x_pos, @@ -741,8 +867,6 @@ FT_Error error = FT_Err_Ok; FT_ULong png_len; - FT_UNUSED( load_flags ); - if ( limit - p < 4 ) { @@ -759,14 +883,15 @@ goto Exit; } - error = Load_SBit_Png( decoder->bitmap, + error = Load_SBit_Png( decoder->face->root.glyph, x_pos, y_pos, decoder->bit_depth, decoder->metrics, decoder->stream->memory, p, - png_len ); + png_len, + FALSE ); Exit: if ( !error ) @@ -779,7 +904,6 @@ static FT_Error tt_sbit_decoder_load_bitmap( TT_SBitDecoder decoder, - FT_UInt load_flags, FT_UInt glyph_format, FT_ULong glyph_start, FT_ULong glyph_size, @@ -845,7 +969,32 @@ case 2: case 5: case 7: - loader = tt_sbit_decoder_load_bit_aligned; + { + /* Don't trust `glyph_format'. For example, Apple's main Korean */ + /* system font, `AppleMyungJo.ttf' (version 7.0d2e6), uses glyph */ + /* format 7, but the data is format 6. We check whether we have */ + /* an excessive number of bytes in the image: If it is equal to */ + /* the value for a byte-aligned glyph, use the other loading */ + /* routine. */ + /* */ + /* Note that for some (width,height) combinations, where the */ + /* width is not a multiple of 8, the sizes for bit- and */ + /* byte-aligned data are equal, for example (7,7) or (15,6). We */ + /* then prefer what `glyph_format' specifies. */ + + FT_UInt width = decoder->metrics->width; + FT_UInt height = decoder->metrics->height; + + FT_UInt bit_size = ( width * height + 7 ) >> 3; + FT_UInt byte_size = height * ( ( width + 7 ) >> 3 ); + + + if ( bit_size < byte_size && + byte_size == (FT_UInt)( p_limit - p ) ) + loader = tt_sbit_decoder_load_byte_aligned; + else + loader = tt_sbit_decoder_load_bit_aligned; + } break; case 8: @@ -859,13 +1008,15 @@ loader = tt_sbit_decoder_load_compound; break; -#ifdef FT_CONFIG_OPTION_USE_PNG case 17: /* small metrics, PNG image data */ case 18: /* big metrics, PNG image data */ case 19: /* metrics in EBLC, PNG image data */ +#ifdef FT_CONFIG_OPTION_USE_PNG loader = tt_sbit_decoder_load_png; - break; +#else + error = FT_THROW( Unimplemented_Feature ); #endif /* FT_CONFIG_OPTION_USE_PNG */ + break; default: error = FT_THROW( Invalid_Table ); @@ -874,64 +1025,12 @@ if ( !decoder->bitmap_allocated ) { - error = tt_sbit_decoder_alloc_bitmap( decoder, load_flags ); + error = tt_sbit_decoder_alloc_bitmap( decoder ); if ( error ) goto Fail; } - if ( decoder->bit_depth == 32 && - decoder->bitmap->pixel_mode != FT_PIXEL_MODE_BGRA ) - { - /* Flatten color bitmaps if color was not requested. */ - - FT_Library library = decoder->face->root.glyph->library; - FT_Memory memory = decoder->stream->memory; - - FT_Bitmap color, *orig; - - - if ( decoder->bitmap->pixel_mode != FT_PIXEL_MODE_GRAY || - x_pos != 0 || y_pos != 0 ) - { - /* Shouldn't happen. */ - error = FT_THROW( Invalid_Table ); - goto Fail; - } - - FT_Bitmap_New( &color ); - - color.rows = decoder->bitmap->rows; - color.width = decoder->bitmap->width; - color.pitch = color.width * 4; - color.pixel_mode = FT_PIXEL_MODE_BGRA; - - if ( FT_ALLOC( color.buffer, color.rows * color.pitch ) ) - goto Fail; - - orig = decoder->bitmap; - decoder->bitmap = &color; - - error = loader( decoder, load_flags, p, p_limit, x_pos, y_pos ); - - decoder->bitmap = orig; - - /* explicitly test against FT_Err_Ok to avoid compiler warnings */ - /* (we do an assignment within a conditional) */ - if ( error || - ( error = FT_Bitmap_Convert( library, - &color, - decoder->bitmap, - 1 ) ) != FT_Err_Ok ) - { - FT_Bitmap_Done( library, &color ); - goto Fail; - } - - FT_Bitmap_Done( library, &color ); - } - - else - error = loader( decoder, load_flags, p, p_limit, x_pos, y_pos ); + error = loader( decoder, p, p_limit, x_pos, y_pos ); } Fail: @@ -944,7 +1043,6 @@ static FT_Error tt_sbit_decoder_load_image( TT_SBitDecoder decoder, - FT_UInt load_flags, FT_UInt glyph_index, FT_Int x_pos, FT_Int y_pos ) @@ -993,17 +1091,15 @@ switch ( index_format ) { case 1: /* 4-byte offsets relative to `image_offset' */ - { - p += 4 * ( glyph_index - start ); - if ( p + 8 > p_limit ) - goto NoBitmap; + p += 4 * ( glyph_index - start ); + if ( p + 8 > p_limit ) + goto NoBitmap; - image_start = FT_NEXT_ULONG( p ); - image_end = FT_NEXT_ULONG( p ); + image_start = FT_NEXT_ULONG( p ); + image_end = FT_NEXT_ULONG( p ); - if ( image_start == image_end ) /* missing glyph */ - goto NoBitmap; - } + if ( image_start == image_end ) /* missing glyph */ + goto NoBitmap; break; case 2: /* big metrics, constant image size */ @@ -1025,17 +1121,15 @@ break; case 3: /* 2-byte offsets relative to 'image_offset' */ - { - p += 2 * ( glyph_index - start ); - if ( p + 4 > p_limit ) - goto NoBitmap; + p += 2 * ( glyph_index - start ); + if ( p + 4 > p_limit ) + goto NoBitmap; - image_start = FT_NEXT_USHORT( p ); - image_end = FT_NEXT_USHORT( p ); + image_start = FT_NEXT_USHORT( p ); + image_end = FT_NEXT_USHORT( p ); - if ( image_start == image_end ) /* missing glyph */ - goto NoBitmap; - } + if ( image_start == image_end ) /* missing glyph */ + goto NoBitmap; break; case 4: /* sparse glyph array with (glyph,offset) pairs */ @@ -1124,7 +1218,6 @@ image_format, glyph_index )); return tt_sbit_decoder_load_bitmap( decoder, - load_flags, image_format, image_start, image_end, @@ -1142,6 +1235,129 @@ } + static FT_Error + tt_face_load_sbix_image( TT_Face face, + FT_ULong strike_index, + FT_UInt glyph_index, + FT_Stream stream, + FT_Bitmap *map, + TT_SBit_MetricsRec *metrics ) + { + FT_UInt sbix_pos, strike_offset, glyph_start, glyph_end; + FT_ULong table_size, data_size; + FT_Int originOffsetX, originOffsetY; + FT_Tag graphicType; + FT_Int recurse_depth = 0; + + FT_Error error; + FT_Byte* p; + + FT_UNUSED( map ); + + + metrics->width = 0; + metrics->height = 0; + + p = face->sbit_table + 8 + 4 * strike_index; + strike_offset = FT_NEXT_ULONG( p ); + + error = face->goto_table( face, TTAG_sbix, stream, &table_size ); + if ( error ) + return error; + sbix_pos = FT_STREAM_POS(); + + retry: + if ( glyph_index > (FT_UInt)face->root.num_glyphs ) + return FT_THROW( Invalid_Argument ); + + if ( strike_offset >= table_size || + table_size - strike_offset < 4 + glyph_index * 4 + 8 ) + return FT_THROW( Invalid_File_Format ); + + if ( FT_STREAM_SEEK( sbix_pos + strike_offset + 4 + glyph_index * 4 ) || + FT_FRAME_ENTER( 8 ) ) + return error; + + glyph_start = FT_GET_ULONG(); + glyph_end = FT_GET_ULONG(); + + FT_FRAME_EXIT(); + + if ( glyph_start == glyph_end ) + return FT_THROW( Invalid_Argument ); + if ( glyph_start > glyph_end || + glyph_end - glyph_start < 8 || + table_size - strike_offset < glyph_end ) + return FT_THROW( Invalid_File_Format ); + + if ( FT_STREAM_SEEK( sbix_pos + strike_offset + glyph_start ) || + FT_FRAME_ENTER( glyph_end - glyph_start ) ) + return error; + + originOffsetX = FT_GET_SHORT(); + originOffsetY = FT_GET_SHORT(); + + graphicType = FT_GET_TAG4(); + data_size = glyph_end - glyph_start - 8; + + switch ( graphicType ) + { + case FT_MAKE_TAG( 'd', 'u', 'p', 'e' ): + if ( recurse_depth < 4 ) + { + glyph_index = FT_GET_USHORT(); + FT_FRAME_EXIT(); + recurse_depth++; + goto retry; + } + error = FT_THROW( Invalid_File_Format ); + break; + + case FT_MAKE_TAG( 'p', 'n', 'g', ' ' ): +#ifdef FT_CONFIG_OPTION_USE_PNG + error = Load_SBit_Png( face->root.glyph, + 0, + 0, + 32, + metrics, + stream->memory, + stream->cursor, + data_size, + TRUE ); +#else + error = FT_THROW( Unimplemented_Feature ); +#endif + break; + + case FT_MAKE_TAG( 'j', 'p', 'g', ' ' ): + case FT_MAKE_TAG( 't', 'i', 'f', 'f' ): + error = FT_THROW( Unknown_File_Format ); + break; + + default: + error = FT_THROW( Unimplemented_Feature ); + break; + } + + FT_FRAME_EXIT(); + + if ( !error ) + { + FT_Short abearing; + FT_UShort aadvance; + + + tt_face_get_metrics( face, FALSE, glyph_index, &abearing, &aadvance ); + + metrics->horiBearingX = originOffsetX; + metrics->horiBearingY = -originOffsetY + metrics->height; + metrics->horiAdvance = aadvance * face->root.size->metrics.x_ppem / + face->header.Units_Per_EM; + } + + return error; + } + FT_LOCAL( FT_Error ) tt_face_load_sbit_image( TT_Face face, FT_ULong strike_index, @@ -1151,23 +1367,67 @@ FT_Bitmap *map, TT_SBit_MetricsRec *metrics ) { - TT_SBitDecoderRec decoder[1]; - FT_Error error; - - FT_UNUSED( load_flags ); - FT_UNUSED( stream ); - FT_UNUSED( map ); + FT_Error error = FT_Err_Ok; - error = tt_sbit_decoder_init( decoder, face, strike_index, metrics ); - if ( !error ) + switch ( (FT_UInt)face->sbit_table_type ) { - error = tt_sbit_decoder_load_image( decoder, - load_flags, - glyph_index, - 0, - 0 ); - tt_sbit_decoder_done( decoder ); + case TT_SBIT_TABLE_TYPE_EBLC: + case TT_SBIT_TABLE_TYPE_CBLC: + { + TT_SBitDecoderRec decoder[1]; + + + error = tt_sbit_decoder_init( decoder, face, strike_index, metrics ); + if ( !error ) + { + error = tt_sbit_decoder_load_image( decoder, + glyph_index, + 0, + 0 ); + tt_sbit_decoder_done( decoder ); + } + } + break; + + case TT_SBIT_TABLE_TYPE_SBIX: + error = tt_face_load_sbix_image( face, + strike_index, + glyph_index, + stream, + map, + metrics ); + break; + + default: + error = FT_THROW( Unknown_File_Format ); + break; + } + + /* Flatten color bitmaps if color was not requested. */ + if ( !error && + !( load_flags & FT_LOAD_COLOR ) && + map->pixel_mode == FT_PIXEL_MODE_BGRA ) + { + FT_Bitmap new_map; + FT_Library library = face->root.glyph->library; + + + FT_Bitmap_New( &new_map ); + + /* Convert to 8bit grayscale. */ + error = FT_Bitmap_Convert( library, map, &new_map, 1 ); + if ( error ) + FT_Bitmap_Done( library, &new_map ); + else + { + map->pixel_mode = new_map.pixel_mode; + map->pitch = new_map.pitch; + map->num_grays = new_map.num_grays; + + ft_glyphslot_set_bitmap( face->root.glyph, new_map.buffer ); + face->root.glyph->internal->flags |= FT_GLYPH_OWN_BITMAP; + } } return error; diff --git a/reactos/lib/3rdparty/freetype/src/sfnt/ttsbit.h b/reactos/lib/3rdparty/freetype/src/sfnt/ttsbit.h index ea0b5f8adae..695d0d8d02e 100644 --- a/reactos/lib/3rdparty/freetype/src/sfnt/ttsbit.h +++ b/reactos/lib/3rdparty/freetype/src/sfnt/ttsbit.h @@ -28,11 +28,11 @@ FT_BEGIN_HEADER FT_LOCAL( FT_Error ) - tt_face_load_eblc( TT_Face face, + tt_face_load_sbit( TT_Face face, FT_Stream stream ); FT_LOCAL( void ) - tt_face_free_eblc( TT_Face face ); + tt_face_free_sbit( TT_Face face ); FT_LOCAL( FT_Error ) diff --git a/reactos/lib/3rdparty/freetype/src/smooth/ftgrays.c b/reactos/lib/3rdparty/freetype/src/smooth/ftgrays.c index 7532a358296..2c51e9f6ebf 100644 --- a/reactos/lib/3rdparty/freetype/src/smooth/ftgrays.c +++ b/reactos/lib/3rdparty/freetype/src/smooth/ftgrays.c @@ -24,8 +24,8 @@ /* */ /* - copy `src/smooth/ftgrays.c' (this file) to your current directory */ /* */ - /* - copy `include/freetype/ftimage.h' and `src/smooth/ftgrays.h' to the */ - /* same directory */ + /* - copy `include/ftimage.h' and `src/smooth/ftgrays.h' to the same */ + /* directory */ /* */ /* - compile `ftgrays' with the _STANDALONE_ macro defined, as in */ /* */ @@ -310,6 +310,40 @@ typedef ptrdiff_t FT_PtrDist; #endif + /* Compute `dividend / divisor' and return both its quotient and */ + /* remainder, cast to a specific type. This macro also ensures that */ + /* the remainder is always positive. */ +#define FT_DIV_MOD( type, dividend, divisor, quotient, remainder ) \ + FT_BEGIN_STMNT \ + (quotient) = (type)( (dividend) / (divisor) ); \ + (remainder) = (type)( (dividend) % (divisor) ); \ + if ( (remainder) < 0 ) \ + { \ + (quotient)--; \ + (remainder) += (type)(divisor); \ + } \ + FT_END_STMNT + +#ifdef __arm__ + /* Work around a bug specific to GCC which make the compiler fail to */ + /* optimize a division and modulo operation on the same parameters */ + /* into a single call to `__aeabi_idivmod'. See */ + /* */ + /* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43721 */ +#undef FT_DIV_MOD +#define FT_DIV_MOD( type, dividend, divisor, quotient, remainder ) \ + FT_BEGIN_STMNT \ + (quotient) = (type)( (dividend) / (divisor) ); \ + (remainder) = (type)( (dividend) - (quotient) * (divisor) ); \ + if ( (remainder) < 0 ) \ + { \ + (quotient)--; \ + (remainder) += (type)(divisor); \ + } \ + FT_END_STMNT +#endif /* __arm__ */ + + /*************************************************************************/ /* */ /* TYPE DEFINITIONS */ @@ -548,7 +582,7 @@ typedef ptrdiff_t FT_PtrDist; static void gray_record_cell( RAS_ARG ) { - if ( !ras.invalid && ( ras.area | ras.cover ) ) + if ( ras.area | ras.cover ) { PCell cell = gray_find_cell( RAS_VAR ); @@ -597,10 +631,10 @@ typedef ptrdiff_t FT_PtrDist; ras.area = 0; ras.cover = 0; + ras.ex = ex; + ras.ey = ey; } - ras.ex = ex; - ras.ey = ey; ras.invalid = ( (unsigned)ey >= (unsigned)ras.count_ey || ex >= ras.count_ex ); } @@ -686,13 +720,7 @@ typedef ptrdiff_t FT_PtrDist; dx = -dx; } - delta = (TCoord)( p / dx ); - mod = (TCoord)( p % dx ); - if ( mod < 0 ) - { - delta--; - mod += (TCoord)dx; - } + FT_DIV_MOD( TCoord, p, dx, delta, mod ); ras.area += (TArea)(( fx1 + first ) * delta); ras.cover += delta; @@ -706,14 +734,8 @@ typedef ptrdiff_t FT_PtrDist; TCoord lift, rem; - p = ONE_PIXEL * ( y2 - y1 + delta ); - lift = (TCoord)( p / dx ); - rem = (TCoord)( p % dx ); - if ( rem < 0 ) - { - lift--; - rem += (TCoord)dx; - } + p = ONE_PIXEL * ( y2 - y1 + delta ); + FT_DIV_MOD( TCoord, p, dx, lift, rem ); mod -= (int)dx; @@ -763,9 +785,6 @@ typedef ptrdiff_t FT_PtrDist; dx = to_x - ras.x; dy = to_y - ras.y; - /* XXX: we should do something about the trivial case where dx == 0, */ - /* as it happens very often! */ - /* perform vertical clipping */ { TCoord min, max; @@ -844,13 +863,7 @@ typedef ptrdiff_t FT_PtrDist; dy = -dy; } - delta = (int)( p / dy ); - mod = (int)( p % dy ); - if ( mod < 0 ) - { - delta--; - mod += (TCoord)dy; - } + FT_DIV_MOD( int, p, dy, delta, mod ); x = ras.x + delta; gray_render_scanline( RAS_VAR_ ey1, ras.x, fy1, x, (TCoord)first ); @@ -861,13 +874,7 @@ typedef ptrdiff_t FT_PtrDist; if ( ey1 != ey2 ) { p = ONE_PIXEL * dx; - lift = (int)( p / dy ); - rem = (int)( p % dy ); - if ( rem < 0 ) - { - lift--; - rem += (int)dy; - } + FT_DIV_MOD( int, p, dy, lift, rem ); mod -= (int)dy; while ( ey1 != ey2 ) @@ -1171,7 +1178,8 @@ typedef ptrdiff_t FT_PtrDist; /* record current cell, if any */ - gray_record_cell( RAS_VAR ); + if ( !ras.invalid ) + gray_record_cell( RAS_VAR ); /* start to a new position */ x = UPSCALE( to->x ); @@ -1781,7 +1789,8 @@ typedef ptrdiff_t FT_PtrDist; if ( ft_setjmp( ras.jump_buffer ) == 0 ) { error = FT_Outline_Decompose( &ras.outline, &func_interface, &ras ); - gray_record_cell( RAS_VAR ); + if ( !ras.invalid ) + gray_record_cell( RAS_VAR ); } else error = FT_THROW( Memory_Overflow ); diff --git a/reactos/lib/3rdparty/freetype/src/tools/afblue.pl b/reactos/lib/3rdparty/freetype/src/tools/afblue.pl new file mode 100644 index 00000000000..774438f84a7 --- /dev/null +++ b/reactos/lib/3rdparty/freetype/src/tools/afblue.pl @@ -0,0 +1,542 @@ +#! /usr/bin/perl -w +# -*- Perl -*- +# +# afblue.pl +# +# Process a blue zone character data file. +# +# Copyright 2013 by +# David Turner, Robert Wilhelm, and Werner Lemberg. +# +# This file is part of the FreeType project, and may only be used, +# modified, and distributed under the terms of the FreeType project +# license, LICENSE.TXT. By continuing to use, modify, or distribute +# this file you indicate that you have read the license and +# understand and accept it fully. + +use strict; +use warnings; +use English '-no_match_vars'; +use open ':std', ':locale'; + + +my $prog = $PROGRAM_NAME; +$prog =~ s| .* / ||x; # Remove path. + +die "usage: $prog datafile < infile > outfile\n" if $#ARGV != 0; + + +my $datafile = $ARGV[0]; + +my %diversions; # The extracted and massaged data from `datafile'. +my @else_stack; # Booleans to track else-clauses. +my @name_stack; # Stack of integers used for names of aux. variables. + +my $curr_enum; # Name of the current enumeration. +my $curr_array; # Name of the current array. +my $curr_max; # Name of the current maximum value. + +my $curr_enum_element; # Name of the current enumeration element. +my $curr_offset; # The offset relative to current aux. variable. +my $curr_elem_size; # The size of the current string or block. + +my $have_sections = 0; # Boolean; set if start of a section has been seen. +my $have_strings; # Boolean; set if current section contains strings. +my $have_blocks; # Boolean; set if current section contains blocks. + +my $have_enum_element; # Boolean; set if we have an enumeration element. +my $in_string; # Boolean; set if a string has been parsed. + +my $num_sections = 0; # Number of sections seen so far. + +my $last_aux; # Name of last auxiliary variable. + + +# Regular expressions. + +# [] [] ':' [] '\n' +my $section_re = qr/ ^ \s* (\S+) \s+ (\S+) \s+ (\S+) \s* : \s* $ /x; + +# [] [] '\n' +my $enum_element_re = qr/ ^ \s* ( [A-Za-z0-9_]+ ) \s* $ /x; + +# '#' '\n' +my $preprocessor_re = qr/ ^ \# /x; + +# '/' '/' '\n' +my $comment_re = qr| ^ // |x; + +# empty line +my $whitespace_only_re = qr/ ^ \s* $ /x; + +# [] '"' '"' [] '\n' ( doesn't contain newlines) +my $string_re = qr/ ^ \s* + " ( (?: [^"\\]++ | \\. )*+ ) " + \s* $ /x; + +# [] '{' '}' [] '\n' ( can contain newlines) +my $block_start_re = qr/ ^ \s* \{ /x; + +# We need the capturing group for `split' to make it return the separator +# tokens (i.e., the opening and closing brace) also. +my $brace_re = qr/ ( [{}] ) /x; + + +sub Warn +{ + my $message = shift; + warn "$datafile:$INPUT_LINE_NUMBER: warning: $message\n"; +} + + +sub Die +{ + my $message = shift; + die "$datafile:$INPUT_LINE_NUMBER: error: $message\n"; +} + + +my $warned_before = 0; + +sub warn_before +{ + Warn("data before first section gets ignored") unless $warned_before; + $warned_before = 1; +} + + +sub strip_newline +{ + chomp; + s/ \x0D $ //x; +} + + +sub end_curr_string +{ + # Append final null byte to string. + if ($have_strings) + { + push @{$diversions{$curr_array}}, " '\\0',\n" if $in_string; + + $curr_offset++; + $in_string = 0; + } +} + + +sub update_max_elem_size +{ + if ($curr_elem_size) + { + my $max = pop @{$diversions{$curr_max}}; + $max = $curr_elem_size if $curr_elem_size > $max; + push @{$diversions{$curr_max}}, $max; + } +} + + +sub convert_non_ascii_char +{ + # A UTF-8 character outside of the printable ASCII range, with possibly a + # leading backslash character. + my $s = shift; + + # Here we count characters, not bytes. + $curr_elem_size += length $s; + + utf8::encode($s); + $s = uc unpack 'H*', $s; + + $curr_offset += $s =~ s/\G(..)/'\\x$1', /sg; + + return $s; +} + + +sub convert_ascii_chars +{ + # A series of ASCII characters in the printable range. + my $s = shift; + + my $count = $s =~ s/\G(.)/'$1', /g; + $curr_offset += $count; + $curr_elem_size += $count; + + return $s; +} + + +sub convert_literal +{ + my $s = shift; + my $orig = $s; + + # ASCII printables and space + my $safe_re = '\x20-\x7E'; + # ASCII printables and space, no backslash + my $safe_no_backslash_re = '\x20-\x5B\x5D-\x7E'; + + $s =~ s{ + (?: \\? ( [^$safe_re] ) + | ( (?: [$safe_no_backslash_re] + | \\ [$safe_re] )+ ) ) + } + { + defined($1) ? convert_non_ascii_char($1) + : convert_ascii_chars($2) + }egx; + + # We assume that `$orig' doesn't contain `*/' + return $s . " /* $orig */"; +} + + +sub aux_name +{ + return "af_blue_" . $num_sections. "_" . join('_', reverse @name_stack); +} + + +sub aux_name_next +{ + $name_stack[$#name_stack]++; + my $name = aux_name(); + $name_stack[$#name_stack]--; + + return $name; +} + + +sub enum_val_string +{ + # Build string which holds code to save the current offset in an + # enumeration element. + my $aux = shift; + + my $add = ($last_aux eq "af_blue_" . $num_sections . "_0" ) + ? "" + : "$last_aux + "; + + return " $aux = $add$curr_offset,\n"; +} + + + +# Process data file. + +open(DATA, $datafile) || die "$prog: can't open \`$datafile': $OS_ERROR\n"; + +while () +{ + strip_newline(); + + next if /$comment_re/; + next if /$whitespace_only_re/; + + if (/$section_re/) + { + Warn("previous section is empty") if ($have_sections + && !$have_strings + && !$have_blocks); + + end_curr_string(); + update_max_elem_size(); + + # Save captured groups from `section_re'. + $curr_enum = $1; + $curr_array = $2; + $curr_max = $3; + + $curr_enum_element = ""; + $curr_offset = 0; + + Warn("overwriting already defined enumeration \`$curr_enum'") + if exists($diversions{$curr_enum}); + Warn("overwriting already defined array \`$curr_array'") + if exists($diversions{$curr_array}); + Warn("overwriting already defined maximum value \`$curr_max'") + if exists($diversions{$curr_max}); + + $diversions{$curr_enum} = []; + $diversions{$curr_array} = []; + $diversions{$curr_max} = []; + + push @{$diversions{$curr_max}}, 0; + + @name_stack = (); + push @name_stack, 0; + + $have_sections = 1; + $have_strings = 0; + $have_blocks = 0; + + $have_enum_element = 0; + $in_string = 0; + + $num_sections++; + $curr_elem_size = 0; + + $last_aux = aux_name(); + + next; + } + + if (/$preprocessor_re/) + { + if ($have_sections) + { + # Having preprocessor conditionals complicates the computation of + # correct offset values. We have to introduce auxiliary enumeration + # elements with the name `af_blue____...' which store + # offsets to be used in conditional clauses. `' is the number of + # sections seen so far, `' is the number of `#if' and `#endif' + # conditionals seen so far in the topmost level, `' the number of + # `#if' and `#endif' conditionals seen so far one level deeper, etc. + # As a consequence, uneven values are used within a clause, and even + # values after a clause, since the C standard doesn't allow the + # redefinition of an enumeration value. For example, the name + # `af_blue_5_1_6' is used to construct enumeration values in the fifth + # section after the third (second-level) if-clause within the first + # (top-level) if-clause. After the first top-level clause has + # finished, `af_blue_5_2' is used. The current offset is then + # relative to the value stored in the current auxiliary element. + + if (/ ^ \# \s* if /x) + { + push @else_stack, 0; + + $name_stack[$#name_stack]++; + + push @{$diversions{$curr_enum}}, enum_val_string(aux_name()); + $last_aux = aux_name(); + + push @name_stack, 0; + + $curr_offset = 0; + } + elsif (/ ^ \# \s* elif /x) + { + Die("unbalanced #elif") unless @else_stack; + + pop @name_stack; + + push @{$diversions{$curr_enum}}, enum_val_string(aux_name_next()); + $last_aux = aux_name(); + + push @name_stack, 0; + + $curr_offset = 0; + } + elsif (/ ^ \# \s* else /x) + { + my $prev_else = pop @else_stack; + Die("unbalanced #else") unless defined($prev_else); + Die("#else already seen") if $prev_else; + push @else_stack, 1; + + pop @name_stack; + + push @{$diversions{$curr_enum}}, enum_val_string(aux_name_next()); + $last_aux = aux_name(); + + push @name_stack, 0; + + $curr_offset = 0; + } + elsif (/ ^ \# \s* endif /x) + { + my $prev_else = pop @else_stack; + Die("unbalanced #endif") unless defined($prev_else); + + pop @name_stack; + $name_stack[$#name_stack]++; + + # If there is no else-clause for an if-clause, we add one. This is + # necessary to have correct offsets. + if (!$prev_else) + { + push @{$diversions{$curr_enum}}, enum_val_string(aux_name()) + . "#else\n"; + + $curr_offset = 0; + } + + push @{$diversions{$curr_enum}}, enum_val_string(aux_name()); + $last_aux = aux_name(); + + $curr_offset = 0; + } + + # Handle (probably continued) preprocessor lines. + CONTINUED_LOOP: + { + do + { + strip_newline(); + + push @{$diversions{$curr_enum}}, $ARG . "\n"; + push @{$diversions{$curr_array}}, $ARG . "\n"; + + last CONTINUED_LOOP unless / \\ $ /x; + + } while (); + } + } + else + { + warn_before(); + } + + next; + } + + if (/$enum_element_re/) + { + end_curr_string(); + update_max_elem_size(); + + $curr_enum_element = $1; + $have_enum_element = 1; + $curr_elem_size = 0; + + next; + } + + if (/$string_re/) + { + if ($have_sections) + { + Die("strings and blocks can't be mixed in a section") if $have_blocks; + + # Save captured group from `string_re'. + my $string = $1; + + if ($have_enum_element) + { + push @{$diversions{$curr_enum}}, enum_val_string($curr_enum_element); + $have_enum_element = 0; + } + + $string = convert_literal($string); + + push @{$diversions{$curr_array}}, " $string\n"; + + $have_strings = 1; + $in_string = 1; + } + else + { + warn_before(); + } + + next; + } + + if (/$block_start_re/) + { + if ($have_sections) + { + Die("strings and blocks can't be mixed in a section") if $have_strings; + + my $depth = 0; + my $block = ""; + my $block_end = 0; + + # Count braces while getting the block. + BRACE_LOOP: + { + do + { + strip_newline(); + + foreach my $substring (split(/$brace_re/)) + { + if ($block_end) + { + Die("invalid data after last matching closing brace") + if $substring !~ /$whitespace_only_re/; + } + + $block .= $substring; + + if ($substring eq '{') + { + $depth++; + } + elsif ($substring eq '}') + { + $depth--; + + $block_end = 1 if $depth == 0; + } + } + + # If we are here, we have run out of substrings, so get next line + # or exit. + last BRACE_LOOP if $block_end; + + $block .= "\n"; + + } while (); + } + + if ($have_enum_element) + { + push @{$diversions{$curr_enum}}, enum_val_string($curr_enum_element); + $have_enum_element = 0; + } + + push @{$diversions{$curr_array}}, $block . ",\n"; + + $curr_offset++; + $curr_elem_size++; + + $have_blocks = 1; + } + else + { + warn_before(); + } + + next; + } + + # Garbage. We weren't able to parse the data. + Die("syntax error"); +} + +# Finalize data. +end_curr_string(); +update_max_elem_size(); + + +# Filter stdin to stdout, replacing `@...@' templates. + +sub emit_diversion +{ + my $diversion_name = shift; + return (exists($diversions{$1})) ? "@{$diversions{$1}}" + : "@" . $diversion_name . "@"; +} + + +$LIST_SEPARATOR = ''; + +my $s1 = "This file has been generated by the Perl script \`$prog',"; +my $s1len = length $s1; +my $s2 = "using data from file \`$datafile'."; +my $s2len = length $s2; +my $slen = ($s1len > $s2len) ? $s1len : $s2len; + +print "/* " . $s1 . " " x ($slen - $s1len) . " */\n" + . "/* " . $s2 . " " x ($slen - $s2len) . " */\n" + . "\n"; + +while () +{ + s/ @ ( [A-Za-z0-9_]+? ) @ / emit_diversion($1) /egx; + print; +} + +# EOF diff --git a/reactos/lib/3rdparty/freetype/src/tools/chktrcmp.py b/reactos/lib/3rdparty/freetype/src/tools/chktrcmp.py index d0f342e6bdd..ce6500c7e25 100644 --- a/reactos/lib/3rdparty/freetype/src/tools/chktrcmp.py +++ b/reactos/lib/3rdparty/freetype/src/tools/chktrcmp.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # # Check trace components in FreeType 2 source. -# Author: suzuki toshiya, 2009 +# Author: suzuki toshiya, 2009, 2013 # # This code is explicitly into the public domain. @@ -15,7 +15,7 @@ USED_COMPONENT = {} KNOWN_COMPONENT = {} SRC_FILE_DIRS = [ "src" ] -TRACE_DEF_FILES = [ "include/freetype/internal/fttrace.h" ] +TRACE_DEF_FILES = [ "include/internal/fttrace.h" ] # -------------------------------------------------------------- diff --git a/reactos/lib/3rdparty/freetype/src/tools/docmaker/content.py b/reactos/lib/3rdparty/freetype/src/tools/docmaker/content.py index 26087f7b88a..98025e67e5e 100644 --- a/reactos/lib/3rdparty/freetype/src/tools/docmaker/content.py +++ b/reactos/lib/3rdparty/freetype/src/tools/docmaker/content.py @@ -1,4 +1,4 @@ -# Content (c) 2002, 2004, 2006-2009, 2012 +# Content (c) 2002, 2004, 2006-2009, 2012, 2013 # David Turner # # This file contains routines used to parse the content of documentation @@ -268,15 +268,6 @@ class DocMarkup: except: return None - def get_start( self ): - try: - result = "" - for word in self.fields[0].items[0].words: - result = result + " " + word - return result[1:] - except: - return "ERROR" - def dump( self, margin ): print " " * margin + "<" + self.tag + ">" for f in self.fields: @@ -555,14 +546,6 @@ class DocBlock: return m return None - def get_markup_name( self, tag_name ): - """return the name of a given primary markup in a block""" - try: - m = self.get_markup( tag_name ) - return m.get_name() - except: - return None - def get_markup_words( self, tag_name ): try: m = self.get_markup( tag_name ) diff --git a/reactos/lib/3rdparty/freetype/src/tools/docmaker/docmaker.py b/reactos/lib/3rdparty/freetype/src/tools/docmaker/docmaker.py index 1d9de9fbff2..bf75c5d5f01 100644 --- a/reactos/lib/3rdparty/freetype/src/tools/docmaker/docmaker.py +++ b/reactos/lib/3rdparty/freetype/src/tools/docmaker/docmaker.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -# DocMaker (c) 2002, 2004, 2008 David Turner +# DocMaker (c) 2002, 2004, 2008, 2013 David Turner # -# This program is a re-write of the original DocMaker took used +# This program is a re-write of the original DocMaker tool used # to generate the API Reference of the FreeType font engine # by converting in-source comments into structured HTML. # diff --git a/reactos/lib/3rdparty/freetype/src/tools/docmaker/sources.py b/reactos/lib/3rdparty/freetype/src/tools/docmaker/sources.py index 490ba25063a..dab83497865 100644 --- a/reactos/lib/3rdparty/freetype/src/tools/docmaker/sources.py +++ b/reactos/lib/3rdparty/freetype/src/tools/docmaker/sources.py @@ -1,4 +1,4 @@ -# Sources (c) 2002-2004, 2006-2009, 2012 +# Sources (c) 2002-2004, 2006-2009, 2012, 2013 # David Turner # # @@ -132,7 +132,7 @@ re_markup_tags = [re_markup_tag1, re_markup_tag2] # # used to detect a cross-reference, after markup tags have been stripped # -re_crossref = re.compile( r'@((?:\w|-)*)(.*)' ) +re_crossref = re.compile( r'@((?:\w|-)*)(.*)' ) # @foo # # used to detect italic and bold styles in paragraph text @@ -140,6 +140,42 @@ re_crossref = re.compile( r'@((?:\w|-)*)(.*)' ) re_italic = re.compile( r"_(\w(\w|')*)_(.*)" ) # _italic_ re_bold = re.compile( r"\*(\w(\w|')*)\*(.*)" ) # *bold* +# +# this regular expression code to identify an URL has been taken from +# +# http://mail.python.org/pipermail/tutor/2002-September/017228.html +# +# (with slight modifications) +# + +urls = r'(?:https?|telnet|gopher|file|wais|ftp)' +ltrs = r'\w' +gunk = r'/#~:.?+=&%@!\-' +punc = r'.:?\-' +any = "%(ltrs)s%(gunk)s%(punc)s" % { 'ltrs' : ltrs, + 'gunk' : gunk, + 'punc' : punc } +url = r""" + ( + \b # start at word boundary + %(urls)s : # need resource and a colon + [%(any)s] +? # followed by one or more of any valid + # character, but be conservative and + # take only what you need to... + (?= # [look-ahead non-consumptive assertion] + [%(punc)s]* # either 0 or more punctuation + (?: # [non-grouping parentheses] + [^%(any)s] | $ # followed by a non-url char + # or end of the string + ) + ) + ) + """ % {'urls' : urls, + 'any' : any, + 'punc' : punc } + +re_url = re.compile( url, re.VERBOSE | re.MULTILINE ) + # # used to detect the end of commented source lines # diff --git a/reactos/lib/3rdparty/freetype/src/tools/docmaker/tohtml.py b/reactos/lib/3rdparty/freetype/src/tools/docmaker/tohtml.py index 1cbda755b8f..7944f1c995b 100644 --- a/reactos/lib/3rdparty/freetype/src/tools/docmaker/tohtml.py +++ b/reactos/lib/3rdparty/freetype/src/tools/docmaker/tohtml.py @@ -1,4 +1,4 @@ -# ToHTML (c) 2002, 2003, 2005, 2006, 2007, 2008 +# ToHTML (c) 2002, 2003, 2005-2008, 2013 # David Turner from sources import * @@ -175,25 +175,6 @@ def html_quote( line ): return result -# same as 'html_quote', but ignores left and right brackets -def html_quote0( line ): - return string.replace( line, "&", "&" ) - - -def dump_html_code( lines, prefix = "" ): - # clean the last empty lines - l = len( self.lines ) - while l > 0 and string.strip( self.lines[l - 1] ) == "": - l = l - 1 - - # The code footer should be directly appended to the last code - # line to avoid an additional blank line. - print prefix + code_header, - for line in self.lines[0 : l + 1]: - print '\n' + prefix + html_quote( line ), - print prefix + code_footer, - - class HtmlFormatter( Formatter ): @@ -242,16 +223,6 @@ class HtmlFormatter( Formatter ): def make_block_url( self, block ): return self.make_section_url( block.section ) + "#" + block.name - def make_html_words( self, words ): - """ convert a series of simple words into some HTML text """ - line = "" - if words: - line = html_quote( words[0] ) - for w in words[1:]: - line = line + " " + html_quote( w ) - - return line - def make_html_word( self, word ): """analyze a simple word to detect cross-references and styling""" # look for cross-references @@ -291,6 +262,8 @@ class HtmlFormatter( Formatter ): line = self.make_html_word( words[0] ) for word in words[1:]: line = line + " " + self.make_html_word( word ) + # handle hyperlinks + line = re_url.sub( r'\1', line ) # convert `...' quotations into real left and right single quotes line = re.sub( r"(^|\W)`(.*?)'(\W|$)", \ r'\1‘\2’\3', \ diff --git a/reactos/lib/3rdparty/freetype/src/truetype/ttdriver.c b/reactos/lib/3rdparty/freetype/src/truetype/ttdriver.c index fb25706ab83..36d23a282e8 100644 --- a/reactos/lib/3rdparty/freetype/src/truetype/ttdriver.c +++ b/reactos/lib/3rdparty/freetype/src/truetype/ttdriver.c @@ -215,7 +215,8 @@ FT_UShort ah; - TT_Get_VMetrics( face, start + nn, &tsb, &ah ); + /* since we don't need `tsb', we use zero for `yMax' parameter */ + TT_Get_VMetrics( face, start + nn, 0, &tsb, &ah ); advances[nn] = ah; } } diff --git a/reactos/lib/3rdparty/freetype/src/truetype/ttgload.c b/reactos/lib/3rdparty/freetype/src/truetype/ttgload.c index f640a6c78ed..0d74248b80f 100644 --- a/reactos/lib/3rdparty/freetype/src/truetype/ttgload.c +++ b/reactos/lib/3rdparty/freetype/src/truetype/ttgload.c @@ -85,51 +85,36 @@ /*************************************************************************/ /* */ /* Return the vertical metrics in font units for a given glyph. */ - /* Greg Hitchcock from Microsoft told us that if there were no `vmtx' */ - /* table, typoAscender/Descender from the `OS/2' table would be used */ - /* instead, and if there were no `OS/2' table, use ascender/descender */ - /* from the `hhea' table. But that is not what Microsoft's rasterizer */ - /* apparently does: It uses the ppem value as the advance height, and */ - /* sets the top side bearing to be zero. */ + /* See macro `TT_LOADER_SET_PP' below for explanations. */ /* */ FT_LOCAL_DEF( void ) TT_Get_VMetrics( TT_Face face, FT_UInt idx, + FT_Pos yMax, FT_Short* tsb, FT_UShort* ah ) { if ( face->vertical_info ) ( (SFNT_Service)face->sfnt )->get_metrics( face, 1, idx, tsb, ah ); -#if 1 /* Empirically determined, at variance with what MS said */ - - else - { - *tsb = 0; - *ah = face->root.units_per_EM; - } - -#else /* This is what MS said to do. It isn't what they do, however. */ - else if ( face->os2.version != 0xFFFFU ) { - *tsb = face->os2.sTypoAscender; + *tsb = face->os2.sTypoAscender - yMax; *ah = face->os2.sTypoAscender - face->os2.sTypoDescender; } + else { - *tsb = face->horizontal.Ascender; + *tsb = face->horizontal.Ascender - yMax; *ah = face->horizontal.Ascender - face->horizontal.Descender; } -#endif - FT_TRACE5(( " advance height (font units): %d\n", *ah )); FT_TRACE5(( " top side bearing (font units): %d\n", *tsb )); } - static void + static FT_Error tt_get_metrics( TT_Loader loader, FT_UInt glyph_index ) { @@ -138,17 +123,28 @@ TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face ); #endif + FT_Error error; + FT_Stream stream = loader->stream; + FT_Short left_bearing = 0, top_bearing = 0; FT_UShort advance_width = 0, advance_height = 0; + /* we must preserve the stream position */ + /* (which gets altered by the metrics functions) */ + FT_ULong pos = FT_STREAM_POS(); + TT_Get_HMetrics( face, glyph_index, &left_bearing, &advance_width ); TT_Get_VMetrics( face, glyph_index, + loader->bbox.yMax, &top_bearing, &advance_height ); + if ( FT_STREAM_SEEK( pos ) ) + return error; + loader->left_bearing = left_bearing; loader->advance = advance_width; loader->top_bearing = top_bearing; @@ -171,6 +167,8 @@ loader->linear_def = 1; loader->linear = advance_width; } + + return FT_Err_Ok; } @@ -350,9 +348,9 @@ FT_GlyphLoader gloader = load->gloader; FT_Int n_contours = load->n_contours; FT_Outline* outline; - TT_Face face = (TT_Face)load->face; FT_UShort n_ins; FT_Int n_points; + FT_ULong tmp; FT_Byte *flag, *flag_limit; FT_Byte c, count; @@ -418,14 +416,7 @@ FT_TRACE5(( " Instructions size: %u\n", n_ins )); - if ( n_ins > face->max_profile.maxSizeOfInstructions ) - { - FT_TRACE0(( "TT_Load_Simple_Glyph: too many instructions (%d)\n", - n_ins )); - error = FT_THROW( Too_Many_Hints ); - goto Fail; - } - + /* check it */ if ( ( limit - p ) < n_ins ) { FT_TRACE0(( "TT_Load_Simple_Glyph: instruction count mismatch\n" )); @@ -437,6 +428,20 @@ if ( IS_HINTED( load->load_flags ) ) { + /* we don't trust `maxSizeOfInstructions' in the `maxp' table */ + /* and thus update the bytecode array size by ourselves */ + + tmp = load->exec->glyphSize; + error = Update_Max( load->exec->memory, + &tmp, + sizeof ( FT_Byte ), + (void*)&load->exec->glyphIns, + n_ins ); + + load->exec->glyphSize = (FT_UShort)tmp; + if ( error ) + return error; + load->glyph->control_len = n_ins; load->glyph->control_data = load->exec->glyphIns; @@ -745,8 +750,8 @@ #ifdef TT_USE_BYTECODE_INTERPRETER if ( loader->glyph->control_len > 0xFFFFL ) { - FT_TRACE1(( "TT_Hint_Glyph: too long instructions " )); - FT_TRACE1(( "(0x%lx byte) is truncated\n", + FT_TRACE1(( "TT_Hint_Glyph: too long instructions" )); + FT_TRACE1(( " (0x%lx byte) is truncated\n", loader->glyph->control_len )); } n_ins = (FT_UInt)( loader->glyph->control_len ); @@ -783,9 +788,13 @@ } #endif - /* round pp2 and pp4 */ + /* round phantom points */ + zone->cur[zone->n_points - 4].x = + FT_PIX_ROUND( zone->cur[zone->n_points - 4].x ); zone->cur[zone->n_points - 3].x = FT_PIX_ROUND( zone->cur[zone->n_points - 3].x ); + zone->cur[zone->n_points - 2].y = + FT_PIX_ROUND( zone->cur[zone->n_points - 2].y ); zone->cur[zone->n_points - 1].y = FT_PIX_ROUND( zone->cur[zone->n_points - 1].y ); @@ -823,13 +832,10 @@ #endif /* save glyph phantom points */ - if ( !loader->preserve_pps ) - { - loader->pp1 = zone->cur[zone->n_points - 4]; - loader->pp2 = zone->cur[zone->n_points - 3]; - loader->pp3 = zone->cur[zone->n_points - 2]; - loader->pp4 = zone->cur[zone->n_points - 1]; - } + loader->pp1 = zone->cur[zone->n_points - 4]; + loader->pp2 = zone->cur[zone->n_points - 3]; + loader->pp3 = zone->cur[zone->n_points - 2]; + loader->pp4 = zone->cur[zone->n_points - 1]; #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 ) @@ -1218,21 +1224,23 @@ max_ins = ((TT_Face)loader->face)->max_profile.maxSizeOfInstructions; if ( n_ins > max_ins ) { - /* acroread ignores this field, so we only do a rough safety check */ + /* don't trust `maxSizeOfInstructions'; */ + /* only do a rough safety check */ if ( (FT_Int)n_ins > loader->byte_len ) { - FT_TRACE1(( "TT_Process_Composite_Glyph: " - "too many instructions (%d) for glyph with length %d\n", + FT_TRACE1(( "TT_Process_Composite_Glyph:" + " too many instructions (%d) for glyph with length %d\n", n_ins, loader->byte_len )); return FT_THROW( Too_Many_Hints ); } - tmp = loader->exec->glyphSize; + tmp = loader->exec->glyphSize; error = Update_Max( loader->exec->memory, &tmp, sizeof ( FT_Byte ), (void*)&loader->exec->glyphIns, n_ins ); + loader->exec->glyphSize = (FT_UShort)tmp; if ( error ) return error; @@ -1254,7 +1262,7 @@ /* Some points are likely touched during execution of */ /* instructions on components. So let's untouch them. */ - for ( i = start_point; i < loader->zone.n_points; i++ ) + for ( i = 0; i < loader->zone.n_points; i++ ) loader->zone.tags[i] &= ~FT_CURVE_TAG_TOUCH_BOTH; loader->zone.n_points += 4; @@ -1263,21 +1271,131 @@ } - /* Calculate the four phantom points. */ - /* The first two stand for horizontal origin and advance. */ - /* The last two stand for vertical origin and advance. */ + /* + * Calculate the phantom points + * + * Defining the right side bearing (rsb) as + * + * rsb = aw - (lsb + xmax - xmin) + * + * (with `aw' the advance width, `lsb' the left side bearing, and `xmin' + * and `xmax' the glyph's minimum and maximum x value), the OpenType + * specification defines the initial position of horizontal phantom points + * as + * + * pp1 = (round(xmin - lsb), 0) , + * pp2 = (round(pp1 + aw), 0) . + * + * Note that the rounding to the grid is not documented currently in the + * specification. + * + * However, the specification lacks the precise definition of vertical + * phantom points. Greg Hitchcock provided the following explanation. + * + * - a `vmtx' table is present + * + * For any glyph, the minimum and maximum y values (`ymin' and `ymax') + * are given in the `glyf' table, the top side bearing (tsb) and advance + * height (ah) are given in the `vmtx' table. The bottom side bearing + * (bsb) is then calculated as + * + * bsb = ah - (tsb + ymax - ymin) , + * + * and the initial position of vertical phantom points is + * + * pp3 = (x, round(ymax + tsb)) , + * pp4 = (x, round(pp3 - ah)) . + * + * See below for value `x'. + * + * - no `vmtx' table in the font + * + * If there is an `OS/2' table, we set + * + * DefaultAscender = sTypoAscender , + * DefaultDescender = sTypoDescender , + * + * otherwise we use data from the `hhea' table: + * + * DefaultAscender = Ascender , + * DefaultDescender = Descender . + * + * With these two variables we can now set + * + * ah = DefaultAscender - sDefaultDescender , + * tsb = DefaultAscender - yMax , + * + * and proceed as if a `vmtx' table was present. + * + * Usually we have + * + * x = aw / 2 , (1) + * + * but there is one compatibility case where it can be set to + * + * x = -DefaultDescender - + * ((DefaultAscender - DefaultDescender - aw) / 2) . (2) + * + * and another one with + * + * x = 0 . (3) + * + * In Windows, the history of those values is quite complicated, + * depending on the hinting engine (that is, the graphics framework). + * + * framework from to formula + * ---------------------------------------------------------- + * GDI Windows 98 current (1) + * (Windows 2000 for NT) + * GDI+ Windows XP Windows 7 (2) + * GDI+ Windows 8 current (3) + * DWrite Windows 7 current (3) + * + * For simplicity, FreeType uses (1) for grayscale subpixel hinting and + * (3) for everything else. + * + */ +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + #define TT_LOADER_SET_PP( loader ) \ - do { \ + do \ + { \ + FT_Bool subpixel_ = loader->exec \ + ? loader->exec->subpixel_hinting \ + : 0; \ + FT_Bool grayscale_ = loader->exec \ + ? loader->exec->grayscale_hinting \ + : 0; \ + FT_Bool use_aw_2_ = (FT_Bool)( subpixel_ && grayscale_ ); \ + \ + \ + (loader)->pp1.x = (loader)->bbox.xMin - (loader)->left_bearing; \ + (loader)->pp1.y = 0; \ + (loader)->pp2.x = (loader)->pp1.x + (loader)->advance; \ + (loader)->pp2.y = 0; \ + (loader)->pp3.x = use_aw_2_ ? (loader)->advance / 2 : 0; \ + (loader)->pp3.y = (loader)->bbox.yMax + (loader)->top_bearing; \ + (loader)->pp4.x = use_aw_2_ ? (loader)->advance / 2 : 0; \ + (loader)->pp4.y = (loader)->pp3.y - (loader)->vadvance; \ + } while ( 0 ) + +#else /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + +#define TT_LOADER_SET_PP( loader ) \ + do \ + { \ (loader)->pp1.x = (loader)->bbox.xMin - (loader)->left_bearing; \ (loader)->pp1.y = 0; \ (loader)->pp2.x = (loader)->pp1.x + (loader)->advance; \ (loader)->pp2.y = 0; \ (loader)->pp3.x = 0; \ - (loader)->pp3.y = (loader)->top_bearing + (loader)->bbox.yMax; \ + (loader)->pp3.y = (loader)->bbox.yMax + (loader)->top_bearing; \ (loader)->pp4.x = 0; \ (loader)->pp4.y = (loader)->pp3.y - (loader)->vadvance; \ } while ( 0 ) +#endif /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + /*************************************************************************/ /* */ @@ -1341,8 +1459,6 @@ y_scale = 0x10000L; } - tt_get_metrics( loader, glyph_index ); - /* Set `offset' to the start of the glyph relative to the start of */ /* the `glyf' table, and `byte_len' to the length of the glyph in */ /* bytes. */ @@ -1402,7 +1518,17 @@ /* read glyph header first */ error = face->read_glyph_header( loader ); - if ( error || header_only ) + if ( error ) + goto Exit; + + /* the metrics must be computed after loading the glyph header */ + /* since we need the glyph's `yMax' value in case the vertical */ + /* metrics must be emulated */ + error = tt_get_metrics( loader, glyph_index ); + if ( error ) + goto Exit; + + if ( header_only ) goto Exit; } @@ -1413,6 +1539,10 @@ loader->bbox.yMin = 0; loader->bbox.yMax = 0; + error = tt_get_metrics( loader, glyph_index ); + if ( error ) + goto Exit; + if ( header_only ) goto Exit; @@ -2204,6 +2334,8 @@ error = FT_Err_Ok; + FT_TRACE1(( "TT_Load_Glyph: glyph index %d\n", glyph_index )); + #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS /* try to load embedded bitmap if any */ diff --git a/reactos/lib/3rdparty/freetype/src/truetype/ttgload.h b/reactos/lib/3rdparty/freetype/src/truetype/ttgload.h index 05f75882dc6..3f1699e6867 100644 --- a/reactos/lib/3rdparty/freetype/src/truetype/ttgload.h +++ b/reactos/lib/3rdparty/freetype/src/truetype/ttgload.h @@ -43,6 +43,7 @@ FT_BEGIN_HEADER FT_LOCAL( void ) TT_Get_VMetrics( TT_Face face, FT_UInt idx, + FT_Pos yMax, FT_Short* tsb, FT_UShort* ah ); diff --git a/reactos/lib/3rdparty/freetype/src/truetype/ttinterp.c b/reactos/lib/3rdparty/freetype/src/truetype/ttinterp.c index e7ffb987cee..92e6d43b693 100644 --- a/reactos/lib/3rdparty/freetype/src/truetype/ttinterp.c +++ b/reactos/lib/3rdparty/freetype/src/truetype/ttinterp.c @@ -1437,8 +1437,107 @@ #undef PACK -#if 1 +#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER + +#if defined( __arm__ ) && \ + ( defined( __thumb2__ ) || !defined( __thumb__ ) ) + +#define TT_MulFix14 TT_MulFix14_arm + + static FT_Int32 + TT_MulFix14_arm( FT_Int32 a, + FT_Int b ) + { + register FT_Int32 t, t2; + + +#if defined( __CC_ARM ) || defined( __ARMCC__ ) + + __asm + { + smull t2, t, b, a /* (lo=t2,hi=t) = a*b */ + mov a, t, asr #31 /* a = (hi >> 31) */ + add a, a, #0x2000 /* a += 0x2000 */ + adds t2, t2, a /* t2 += a */ + adc t, t, #0 /* t += carry */ + mov a, t2, lsr #14 /* a = t2 >> 14 */ + orr a, a, t, lsl #18 /* a |= t << 18 */ + } + +#elif defined( __GNUC__ ) + + __asm__ __volatile__ ( + "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */ + "mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */ +#ifdef __clang__ + "add.w %0, %0, #0x2000\n\t" /* %0 += 0x2000 */ +#else + "add %0, %0, #0x2000\n\t" /* %0 += 0x2000 */ +#endif + "adds %1, %1, %0\n\t" /* %1 += %0 */ + "adc %2, %2, #0\n\t" /* %2 += carry */ + "mov %0, %1, lsr #14\n\t" /* %0 = %1 >> 16 */ + "orr %0, %0, %2, lsl #18\n\t" /* %0 |= %2 << 16 */ + : "=r"(a), "=&r"(t2), "=&r"(t) + : "r"(a), "r"(b) + : "cc" ); + +#endif + + return a; + } + +#endif /* __arm__ && ( __thumb2__ || !__thumb__ ) */ + +#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */ + + +#if defined( __GNUC__ ) && \ + ( defined( __i386__ ) || defined( __x86_64__ ) ) + +#define TT_MulFix14 TT_MulFix14_long_long + + /* Temporarily disable the warning that C90 doesn't support `long long'. */ +#if ( __GNUC__ * 100 + __GNUC_MINOR__ ) >= 406 +#pragma GCC diagnostic push +#endif +#pragma GCC diagnostic ignored "-Wlong-long" + + /* This is declared `noinline' because inlining the function results */ + /* in slower code. The `pure' attribute indicates that the result */ + /* only depends on the parameters. */ + static __attribute__(( noinline )) + __attribute__(( pure )) FT_Int32 + TT_MulFix14_long_long( FT_Int32 a, + FT_Int b ) + { + + long long ret = (long long)a * b; + + /* The following line assumes that right shifting of signed values */ + /* will actually preserve the sign bit. The exact behaviour is */ + /* undefined, but this is true on x86 and x86_64. */ + long long tmp = ret >> 63; + + + ret += 0x2000 + tmp; + + return (FT_Int32)( ret >> 14 ); + } + +#if ( __GNUC__ * 100 + __GNUC_MINOR__ ) >= 406 +#pragma GCC diagnostic pop +#endif + +#endif /* __GNUC__ && ( __i386__ || __x86_64__ ) */ + + +#ifndef TT_MulFix14 + + /* Compute (a*b)/2^14 with maximum accuracy and rounding. */ + /* This is optimized to be faster than calling FT_MulFix() */ + /* for platforms where sizeof(int) == 2. */ static FT_Int32 TT_MulFix14( FT_Int32 a, FT_Int b ) @@ -1470,37 +1569,50 @@ return sign >= 0 ? (FT_Int32)mid : -(FT_Int32)mid; } -#else +#endif /* !TT_MulFix14 */ - /* compute (a*b)/2^14 with maximum accuracy and rounding */ - static FT_Int32 - TT_MulFix14( FT_Int32 a, - FT_Int b ) + +#if defined( __GNUC__ ) && \ + ( defined( __i386__ ) || \ + defined( __x86_64__ ) || \ + defined( __arm__ ) ) + +#define TT_DotFix14 TT_DotFix14_long_long + +#if ( __GNUC__ * 100 + __GNUC_MINOR__ ) >= 406 +#pragma GCC diagnostic push +#endif +#pragma GCC diagnostic ignored "-Wlong-long" + + static __attribute__(( pure )) FT_Int32 + TT_DotFix14_long_long( FT_Int32 ax, + FT_Int32 ay, + FT_Int bx, + FT_Int by ) { - FT_Int32 m, s, hi; - FT_UInt32 l, lo; + /* Temporarily disable the warning that C90 doesn't support */ + /* `long long'. */ + + long long temp1 = (long long)ax * bx; + long long temp2 = (long long)ay * by; - /* compute ax*bx as 64-bit value */ - l = (FT_UInt32)( ( a & 0xFFFFU ) * b ); - m = ( a >> 16 ) * b; + temp1 += temp2; + temp2 = temp1 >> 63; + temp1 += 0x2000 + temp2; - lo = l + ( (FT_UInt32)m << 16 ); - hi = ( m >> 16 ) + ( (FT_Int32)l >> 31 ) + ( lo < l ); + return (FT_Int32)( temp1 >> 14 ); - /* divide the result by 2^14 with rounding */ - s = hi >> 31; - l = lo + (FT_UInt32)s; - hi += s + ( l < lo ); - lo = l; - - l = lo + 0x2000U; - hi += l < lo; - - return (FT_Int32)( ( (FT_UInt32)hi << 18 ) | ( l >> 14 ) ); } + +#if ( __GNUC__ * 100 + __GNUC_MINOR__ ) >= 406 +#pragma GCC diagnostic pop #endif +#endif /* __GNUC__ && (__arm__ || __i386__ || __x86_64__) */ + + +#ifndef TT_DotFix14 /* compute (ax*bx+ay*by)/2^14 with maximum accuracy and rounding */ static FT_Int32 @@ -1543,6 +1655,8 @@ return (FT_Int32)( ( (FT_UInt32)hi << 18 ) | ( l >> 14 ) ); } +#endif /* TT_DotFix14 */ + /*************************************************************************/ /* */ @@ -3037,42 +3151,42 @@ } -#define DO_JROT \ - if ( args[1] != 0 ) \ - { \ - if ( args[0] == 0 && CUR.args == 0 ) \ - CUR.error = FT_THROW( Bad_Argument ); \ - CUR.IP += args[0]; \ - if ( CUR.IP < 0 || \ - ( CUR.callTop > 0 && \ - CUR.IP > CUR.callStack[CUR.callTop - 1].Cur_End ) ) \ - CUR.error = FT_THROW( Bad_Argument ); \ - CUR.step_ins = FALSE; \ +#define DO_JROT \ + if ( args[1] != 0 ) \ + { \ + if ( args[0] == 0 && CUR.args == 0 ) \ + CUR.error = FT_THROW( Bad_Argument ); \ + CUR.IP += args[0]; \ + if ( CUR.IP < 0 || \ + ( CUR.callTop > 0 && \ + CUR.IP > CUR.callStack[CUR.callTop - 1].Def->end ) ) \ + CUR.error = FT_THROW( Bad_Argument ); \ + CUR.step_ins = FALSE; \ } -#define DO_JMPR \ - if ( args[0] == 0 && CUR.args == 0 ) \ - CUR.error = FT_THROW( Bad_Argument ); \ - CUR.IP += args[0]; \ - if ( CUR.IP < 0 || \ - ( CUR.callTop > 0 && \ - CUR.IP > CUR.callStack[CUR.callTop - 1].Cur_End ) ) \ - CUR.error = FT_THROW( Bad_Argument ); \ +#define DO_JMPR \ + if ( args[0] == 0 && CUR.args == 0 ) \ + CUR.error = FT_THROW( Bad_Argument ); \ + CUR.IP += args[0]; \ + if ( CUR.IP < 0 || \ + ( CUR.callTop > 0 && \ + CUR.IP > CUR.callStack[CUR.callTop - 1].Def->end ) ) \ + CUR.error = FT_THROW( Bad_Argument ); \ CUR.step_ins = FALSE; -#define DO_JROF \ - if ( args[1] == 0 ) \ - { \ - if ( args[0] == 0 && CUR.args == 0 ) \ - CUR.error = FT_THROW( Bad_Argument ); \ - CUR.IP += args[0]; \ - if ( CUR.IP < 0 || \ - ( CUR.callTop > 0 && \ - CUR.IP > CUR.callStack[CUR.callTop - 1].Cur_End ) ) \ - CUR.error = FT_THROW( Bad_Argument ); \ - CUR.step_ins = FALSE; \ +#define DO_JROF \ + if ( args[1] == 0 ) \ + { \ + if ( args[0] == 0 && CUR.args == 0 ) \ + CUR.error = FT_THROW( Bad_Argument ); \ + CUR.IP += args[0]; \ + if ( CUR.IP < 0 || \ + ( CUR.callTop > 0 && \ + CUR.IP > CUR.callStack[CUR.callTop - 1].Def->end ) ) \ + CUR.error = FT_THROW( Bad_Argument ); \ + CUR.step_ins = FALSE; \ } @@ -4788,7 +4902,7 @@ if ( pRec->Cur_Count > 0 ) { CUR.callTop++; - CUR.IP = pRec->Cur_Restart; + CUR.IP = pRec->Def->start; } else /* Loop through the current function */ @@ -4878,8 +4992,7 @@ pCrec->Caller_Range = CUR.curRange; pCrec->Caller_IP = CUR.IP + 1; pCrec->Cur_Count = 1; - pCrec->Cur_Restart = def->start; - pCrec->Cur_End = def->end; + pCrec->Def = def; CUR.callTop++; @@ -4967,8 +5080,7 @@ pCrec->Caller_Range = CUR.curRange; pCrec->Caller_IP = CUR.IP + 1; pCrec->Cur_Count = (FT_Int)args[0]; - pCrec->Cur_Restart = def->start; - pCrec->Cur_End = def->end; + pCrec->Def = def; CUR.callTop++; @@ -7716,18 +7828,15 @@ if ( ( args[0] & 32 ) != 0 && CUR.grayscale_hinting ) K |= 1 << 12; - /********************************/ - /* HINTING FOR SUBPIXEL */ - /* Selector Bit: 6 */ - /* Return Bit(s): 13 */ - /* */ - if ( ( args[0] & 64 ) != 0 && - CUR.subpixel_hinting && - CUR.rasterizer_version >= 37 ) + if ( CUR.rasterizer_version >= 37 ) { - K |= 1 << 13; - - /* the stuff below is irrelevant if subpixel_hinting is not set */ + /********************************/ + /* HINTING FOR SUBPIXEL */ + /* Selector Bit: 6 */ + /* Return Bit(s): 13 */ + /* */ + if ( ( args[0] & 64 ) != 0 && CUR.subpixel_hinting ) + K |= 1 << 13; /********************************/ /* COMPATIBLE WIDTHS ENABLED */ @@ -7803,8 +7912,7 @@ call->Caller_Range = CUR.curRange; call->Caller_IP = CUR.IP + 1; call->Cur_Count = 1; - call->Cur_Restart = def->start; - call->Cur_End = def->end; + call->Def = def; INS_Goto_CodeRange( def->range, def->start ); @@ -8860,8 +8968,7 @@ callrec->Caller_Range = CUR.curRange; callrec->Caller_IP = CUR.IP + 1; callrec->Cur_Count = 1; - callrec->Cur_Restart = def->start; - callrec->Cur_End = def->end; + callrec->Def = def; if ( INS_Goto_CodeRange( def->range, def->start ) == FAILURE ) goto LErrorLabel_; diff --git a/reactos/lib/3rdparty/freetype/src/truetype/ttinterp.h b/reactos/lib/3rdparty/freetype/src/truetype/ttinterp.h index 69f5011ed40..b3916acb699 100644 --- a/reactos/lib/3rdparty/freetype/src/truetype/ttinterp.h +++ b/reactos/lib/3rdparty/freetype/src/truetype/ttinterp.h @@ -101,8 +101,8 @@ FT_BEGIN_HEADER FT_Int Caller_Range; FT_Long Caller_IP; FT_Long Cur_Count; - FT_Long Cur_Restart; - FT_Long Cur_End; + + TT_DefRecord *Def; /* either FDEF or IDEF */ } TT_CallRec, *TT_CallStack; diff --git a/reactos/lib/3rdparty/freetype/src/truetype/ttobjs.c b/reactos/lib/3rdparty/freetype/src/truetype/ttobjs.c index 7897efa77a9..4adba58f7bb 100644 --- a/reactos/lib/3rdparty/freetype/src/truetype/ttobjs.c +++ b/reactos/lib/3rdparty/freetype/src/truetype/ttobjs.c @@ -150,20 +150,21 @@ tt_check_trickyness_family( FT_String* name ) { -#define TRICK_NAMES_MAX_CHARACTERS 16 -#define TRICK_NAMES_COUNT 8 +#define TRICK_NAMES_MAX_CHARACTERS 19 +#define TRICK_NAMES_COUNT 9 static const char trick_names[TRICK_NAMES_COUNT] [TRICK_NAMES_MAX_CHARACTERS + 1] = { - "DFKaiSho-SB", /* dfkaisb.ttf */ + "DFKaiSho-SB", /* dfkaisb.ttf */ "DFKaiShu", - "DFKai-SB", /* kaiu.ttf */ - "HuaTianKaiTi?", /* htkt2.ttf */ - "HuaTianSongTi?", /* htst3.ttf */ - "MingLiU", /* mingliu.ttf & mingliu.ttc */ - "PMingLiU", /* mingliu.ttc */ - "MingLi43", /* mingli.ttf */ + "DFKai-SB", /* kaiu.ttf */ + "HuaTianKaiTi?", /* htkt2.ttf */ + "HuaTianSongTi?", /* htst3.ttf */ + "Ming(for ISO10646)", /* hkscsiic.ttf & iicore.ttf */ + "MingLiU", /* mingliu.ttf & mingliu.ttc */ + "PMingLiU", /* mingliu.ttc */ + "MingLi43", /* mingli.ttf */ }; int nn; @@ -532,6 +533,10 @@ /* check that we have a valid TrueType file */ error = sfnt->init_face( stream, face, face_index, num_params, params ); + + /* Stream may have changed. */ + stream = face->root.stream; + if ( error ) goto Exit; diff --git a/reactos/lib/3rdparty/freetype/src/type1/t1gload.c b/reactos/lib/3rdparty/freetype/src/type1/t1gload.c index 23478d12886..35f5b5795d9 100644 --- a/reactos/lib/3rdparty/freetype/src/type1/t1gload.c +++ b/reactos/lib/3rdparty/freetype/src/type1/t1gload.c @@ -300,6 +300,8 @@ goto Exit; } + FT_TRACE1(( "T1_Load_Glyph: glyph index %d\n", glyph_index )); + FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) ); if ( load_flags & FT_LOAD_NO_RECURSE ) diff --git a/reactos/lib/3rdparty/freetype/src/type1/t1load.c b/reactos/lib/3rdparty/freetype/src/type1/t1load.c index 1c834a17bb8..4b5026bfccf 100644 --- a/reactos/lib/3rdparty/freetype/src/type1/t1load.c +++ b/reactos/lib/3rdparty/freetype/src/type1/t1load.c @@ -2209,7 +2209,6 @@ if ( type1->encoding_type == T1_ENCODING_TYPE_ARRAY ) { FT_Int charcode, idx, min_char, max_char; - FT_Byte* char_name; FT_Byte* glyph_name; @@ -2224,6 +2223,9 @@ charcode = 0; for ( ; charcode < loader.encoding_table.max_elems; charcode++ ) { + FT_Byte* char_name; + + type1->encoding.char_index[charcode] = 0; type1->encoding.char_name [charcode] = (char *)".notdef"; diff --git a/reactos/lib/3rdparty/freetype/src/type42/t42objs.c b/reactos/lib/3rdparty/freetype/src/type42/t42objs.c index 18e2c0b6250..f5aa2caf2c0 100644 --- a/reactos/lib/3rdparty/freetype/src/type42/t42objs.c +++ b/reactos/lib/3rdparty/freetype/src/type42/t42objs.c @@ -171,7 +171,6 @@ FT_UNUSED( num_params ); FT_UNUSED( params ); - FT_UNUSED( face_index ); FT_UNUSED( stream ); @@ -507,7 +506,7 @@ FT_Face face = size->face; T42_Face t42face = (T42_Face)face; FT_Size ttsize; - FT_Error error = FT_Err_Ok; + FT_Error error; error = FT_New_Size( t42face->ttf_face, &ttsize ); @@ -648,6 +647,8 @@ FT_Driver_Class ttclazz = ((T42_Driver)glyph->face->driver)->ttclazz; + FT_TRACE1(( "T42_GlyphSlot_Load: glyph index %d\n", glyph_index )); + t42_glyphslot_clear( t42slot->ttslot ); error = ttclazz->load_glyph( t42slot->ttslot, t42size->ttsize, diff --git a/reactos/lib/3rdparty/freetype/src/winfonts/winfnt.c b/reactos/lib/3rdparty/freetype/src/winfonts/winfnt.c index e8055c0898e..68432438bfb 100644 --- a/reactos/lib/3rdparty/freetype/src/winfonts/winfnt.c +++ b/reactos/lib/3rdparty/freetype/src/winfonts/winfnt.c @@ -984,6 +984,8 @@ goto Exit; } + FT_TRACE1(( "FNT_Load_Glyph: glyph index %d\n", glyph_index )); + if ( glyph_index > 0 ) glyph_index--; /* revert to real index */ else @@ -1024,7 +1026,7 @@ bitmap->rows = font->header.pixel_height; bitmap->pixel_mode = FT_PIXEL_MODE_MONO; - if ( offset + pitch * bitmap->rows >= font->header.file_size ) + if ( offset + pitch * bitmap->rows > font->header.file_size ) { FT_TRACE2(( "invalid bitmap width\n" )); error = FT_THROW( Invalid_File_Format ); diff --git a/reactos/media/doc/3rd Party Files.txt b/reactos/media/doc/3rd Party Files.txt index e145d523149..180dd48a0b0 100644 --- a/reactos/media/doc/3rd Party Files.txt +++ b/reactos/media/doc/3rd Party Files.txt @@ -15,7 +15,7 @@ Used Version: 1.1 Website: http://www.geocities.com/dborca/opengl/tc.html Title: FreeType -Used Version: 2.5.0 +Used Version: 2.5.2 Website: http://www.freetype.org Title: Mesa3D diff --git a/reactos/win32ss/gdi/ntgdi/freetype.c b/reactos/win32ss/gdi/ntgdi/freetype.c index 536d5b8838f..1e761e8f6d9 100644 --- a/reactos/win32ss/gdi/ntgdi/freetype.c +++ b/reactos/win32ss/gdi/ntgdi/freetype.c @@ -13,11 +13,11 @@ #include FT_GLYPH_H #include FT_TYPE1_TABLES_H -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #define NDEBUG #include From 73100dd557ed198c035d8591a72164e166fa243e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Tue, 4 Mar 2014 21:28:25 +0000 Subject: [PATCH 058/113] [VFATLIB] - remove useless dependency to psdk svn path=/trunk/; revision=62418 --- reactos/lib/fslib/vfatlib/CMakeLists.txt | 1 - reactos/lib/fslib/vfatlib/check/io.c | 2 +- reactos/lib/fslib/vfatlib/check/lfn.c | 1 + reactos/lib/fslib/vfatlib/vfatlib.h | 1 - 4 files changed, 2 insertions(+), 3 deletions(-) diff --git a/reactos/lib/fslib/vfatlib/CMakeLists.txt b/reactos/lib/fslib/vfatlib/CMakeLists.txt index e0f18c01d9b..7df11959eb2 100644 --- a/reactos/lib/fslib/vfatlib/CMakeLists.txt +++ b/reactos/lib/fslib/vfatlib/CMakeLists.txt @@ -15,4 +15,3 @@ list(APPEND SOURCE add_library(vfatlib ${SOURCE}) add_pch(vfatlib vfatlib.h SOURCE) -add_dependencies(vfatlib psdk) diff --git a/reactos/lib/fslib/vfatlib/check/io.c b/reactos/lib/fslib/vfatlib/check/io.c index 36e0605b01f..54ac65f308e 100644 --- a/reactos/lib/fslib/vfatlib/check/io.c +++ b/reactos/lib/fslib/vfatlib/check/io.c @@ -211,7 +211,7 @@ void fs_write(loff_t pos,int size,void *data) const size_t readsize_aligned = (size % 512) ? (size + (512 - (size % 512))) : size; const loff_t seekpos_aligned = pos - (pos % 512); const size_t seek_delta = (size_t)(pos - seekpos_aligned); - boolean use_read = (seek_delta != 0) || ((readsize_aligned-size) != 0); + BOOLEAN use_read = (seek_delta != 0) || ((readsize_aligned-size) != 0); /* Aloc temp buffer if write is not aligned */ if (use_read) diff --git a/reactos/lib/fslib/vfatlib/check/lfn.c b/reactos/lib/fslib/vfatlib/check/lfn.c index fc0b7827b8d..1fdd9fc61f1 100644 --- a/reactos/lib/fslib/vfatlib/check/lfn.c +++ b/reactos/lib/fslib/vfatlib/check/lfn.c @@ -3,6 +3,7 @@ /* Written 1998 by Roman Hodek */ #include "vfatlib.h" +#include #define NDEBUG #include diff --git a/reactos/lib/fslib/vfatlib/vfatlib.h b/reactos/lib/fslib/vfatlib/vfatlib.h index d83831d6c94..2b1302f8390 100644 --- a/reactos/lib/fslib/vfatlib/vfatlib.h +++ b/reactos/lib/fslib/vfatlib/vfatlib.h @@ -14,7 +14,6 @@ #define COM_NO_WINDOWS_H #include #include -#include #define NTOS_MODE_USER #include #include From 61d834485b86061d1a9c0a7ee95307099c2341c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Wed, 5 Mar 2014 01:53:46 +0000 Subject: [PATCH 059/113] [APITESTS:kernel32] Be more specific about which last error we expect. svn path=/trunk/; revision=62419 --- rostests/apitests/kernel32/dosdev.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/rostests/apitests/kernel32/dosdev.c b/rostests/apitests/kernel32/dosdev.c index fab58ea343c..ce393248be5 100644 --- a/rostests/apitests/kernel32/dosdev.c +++ b/rostests/apitests/kernel32/dosdev.c @@ -137,7 +137,7 @@ static void test_DefineDosDeviceA(void) ok(Result, "Failed to subst drive\n"); DriveType1 = GetDriveTypeA(SUBST_DRIVE_WITH_TRAILING_PATH_SEPERATOR); ok(DriveType1 != SystemDriveType, "subst drive types match when it shouldn't\n"); - ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError() reports unexpected error code\n"); + ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Wrong last error. Expected %lu, got %lu\n", (DWORD)(ERROR_FILE_NOT_FOUND), GetLastError()); dwMaskCur = GetLogicalDrives(); ok(dwMaskCur != dwMaskPrev, "Drive masks match when it shouldn't\n"); ok((dwMaskCur & (1 << (SUBST_DRIVE_LETTER - 'A'))), "Drive bit is not set\n"); @@ -168,7 +168,7 @@ static void test_DefineDosDeviceA(void) ok(Result, "Failed to subst drive\n"); DriveType1 = GetDriveTypeA(SUBST_DRIVE_WITH_TRAILING_PATH_SEPERATOR); ok(DriveType1 != SystemDriveType, "subst drive types match when it shouldn't\n"); - ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError() reports unexpected error code\n"); + ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Wrong last error. Expected %lu, got %lu\n", (DWORD)(ERROR_FILE_NOT_FOUND), GetLastError()); dwMaskCur = GetLogicalDrives(); ok(dwMaskCur != dwMaskPrev, "Drive masks match when it shouldn't\n"); ok((dwMaskCur & (1 << (SUBST_DRIVE_LETTER - 'A'))), "Drive bit is not set\n"); @@ -203,7 +203,7 @@ static void test_DefineDosDeviceA(void) ok(Result, "Failed to subst drive\n"); DriveType1 = GetDriveTypeA(SUBST_DRIVE_WITH_TRAILING_PATH_SEPERATOR); ok(DriveType1 != SystemDriveType, "subst drive types match when it shouldn't\n"); - ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError() reports unexpected error code\n"); + ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Wrong last error. Expected %lu, got %lu\n", (DWORD)(ERROR_FILE_NOT_FOUND), GetLastError()); dwMaskCur = GetLogicalDrives(); ok(dwMaskCur != dwMaskPrev, "Drive masks match when it shouldn't\n"); ok((dwMaskCur & (1 << (SUBST_DRIVE_LETTER - 'A'))), "Drive bit is not set\n"); @@ -266,7 +266,7 @@ static void test_DefineDosDeviceA(void) ok((dwMaskCur & (1 << (SUBST_DRIVE_LETTER - 'A'))), "Drive bit is not set\n"); hnd = FindFirstFileA(SUBST_DRIVE_SEARCH, &Data); ok(hnd == INVALID_HANDLE_VALUE, "Opened subst drive when it should fail\n"); - ok(GetLastError() == ERROR_INVALID_NAME, "GetLastError() reports unexpected error code\n"); + ok(GetLastError() == ERROR_INVALID_NAME, "Wrong last error. Expected %lu, got %lu\n", (DWORD)(ERROR_INVALID_NAME), GetLastError()); if (hnd) FindClose(hnd); Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION, SUBST_DRIVE, NULL); ok(Result, "Failed to remove subst drive using NULL Target name\n"); @@ -313,7 +313,7 @@ static void test_DefineDosDeviceA(void) ok(Result, "Failed to subst drive\n"); DriveType1 = GetDriveTypeA(SUBST_DRIVE_WITH_TRAILING_PATH_SEPERATOR); ok(DriveType1 != SystemDriveType, "subst drive types match when it shouldn't\n"); - ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError() reports unexpected error code\n"); + ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Wrong last error. Expected %lu, got %lu\n", (DWORD)(ERROR_FILE_NOT_FOUND), GetLastError()); dwMaskCur = GetLogicalDrives(); ok(dwMaskCur != dwMaskPrev, "Drive masks match when it shouldn't\n"); ok((dwMaskCur & (1 << (SUBST_DRIVE_LETTER - 'A'))), "Drive bit is not set\n"); @@ -333,7 +333,7 @@ static void test_DefineDosDeviceA(void) ok(Result, "Failed to subst drive\n"); DriveType1 = GetDriveTypeA(SUBST_DRIVE_WITH_TRAILING_PATH_SEPERATOR); ok(DriveType1 != SystemDriveType, "subst drive types match when it shouldn't\n"); - ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError() reports unexpected error code\n"); + ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Wrong last error. Expected %lu, got %lu\n", (DWORD)(ERROR_FILE_NOT_FOUND), GetLastError()); dwMaskCur = GetLogicalDrives(); ok(dwMaskCur != dwMaskPrev, "Drive masks match when it shouldn't\n"); ok((dwMaskCur & (1 << (SUBST_DRIVE_LETTER - 'A'))), "Drive bit is not set\n"); @@ -362,7 +362,7 @@ static void test_QueryDosDeviceA(void) ok(Result, "Failed to subst drive\n"); Result = QueryDosDeviceA(SUBST_DRIVE, Buffer, 0); ok(!Result, "Should fail as the buffer passed is supposed to be small\n"); - ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetLastError() reports unexpected error code\n"); + ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Wrong last error. Expected %lu, got %lu\n", (DWORD)(ERROR_INSUFFICIENT_BUFFER), GetLastError()); Result = QueryDosDeviceA(SUBST_DRIVE, Buffer, MAX_PATH); ok(Result, "failed to get target path\n"); ok(_strnicmp(Buffer, "\\??\\", 4) == 0, "The target returned does have correct prefix set\n"); @@ -374,7 +374,7 @@ static void test_QueryDosDeviceA(void) /* This will try to retrieve all existing MS-DOS device names */ Result = QueryDosDeviceA(NULL, Buffer, 0); ok(!Result, "Should fail as the buffer passed is supposed to be small\n"); - ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetLastError() reports unexpected error code\n"); + ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Wrong last error. Expected %lu, got %lu\n", (DWORD)(ERROR_INSUFFICIENT_BUFFER), GetLastError()); } START_TEST(dosdev) From 47ce544479cb1317538608091989026fddadeaea Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Wed, 5 Mar 2014 10:42:27 +0000 Subject: [PATCH 060/113] [WIN-ICONV] * Import a library that provides iconv implementation using Win32 API. [LIBXML2][LIBXSLT][MSXML3] * Make use of this library to support Windows-1252 encoding. * Fixes some failed msxml:domdoc tests. CORE-6697 svn path=/trunk/; revision=62423 --- reactos/dll/3rdparty/libxslt/CMakeLists.txt | 2 +- reactos/dll/win32/msxml3/CMakeLists.txt | 2 +- reactos/lib/3rdparty/CMakeLists.txt | 1 + .../lib/3rdparty/libwin-iconv/CMakeLists.txt | 8 + reactos/lib/3rdparty/libwin-iconv/ChangeLog | 161 ++ reactos/lib/3rdparty/libwin-iconv/iconv.def | 23 + reactos/lib/3rdparty/libwin-iconv/iconv.h | 14 + reactos/lib/3rdparty/libwin-iconv/mlang.def | 11 + reactos/lib/3rdparty/libwin-iconv/mlang.h | 54 + reactos/lib/3rdparty/libwin-iconv/readme.txt | 20 + reactos/lib/3rdparty/libwin-iconv/win_iconv.c | 2075 +++++++++++++++++ .../3rdparty/libwin-iconv/win_iconv_test.c | 286 +++ reactos/lib/3rdparty/libxml2/CMakeLists.txt | 6 +- reactos/media/doc/3rd Party Files.txt | 4 + 14 files changed, 2664 insertions(+), 3 deletions(-) create mode 100644 reactos/lib/3rdparty/libwin-iconv/CMakeLists.txt create mode 100644 reactos/lib/3rdparty/libwin-iconv/ChangeLog create mode 100644 reactos/lib/3rdparty/libwin-iconv/iconv.def create mode 100644 reactos/lib/3rdparty/libwin-iconv/iconv.h create mode 100644 reactos/lib/3rdparty/libwin-iconv/mlang.def create mode 100644 reactos/lib/3rdparty/libwin-iconv/mlang.h create mode 100644 reactos/lib/3rdparty/libwin-iconv/readme.txt create mode 100644 reactos/lib/3rdparty/libwin-iconv/win_iconv.c create mode 100644 reactos/lib/3rdparty/libwin-iconv/win_iconv_test.c diff --git a/reactos/dll/3rdparty/libxslt/CMakeLists.txt b/reactos/dll/3rdparty/libxslt/CMakeLists.txt index 558305f0d0c..002daabc796 100644 --- a/reactos/dll/3rdparty/libxslt/CMakeLists.txt +++ b/reactos/dll/3rdparty/libxslt/CMakeLists.txt @@ -37,7 +37,7 @@ list(APPEND SOURCE add_library(libxslt SHARED ${SOURCE}) set_module_type(libxslt win32dll) -target_link_libraries(libxslt libxml2) +target_link_libraries(libxslt libxml2 iconv-static) add_importlibs(libxslt msvcrt ws2_32 kernel32) if(MSVC) add_importlibs(libxslt ntdll) diff --git a/reactos/dll/win32/msxml3/CMakeLists.txt b/reactos/dll/win32/msxml3/CMakeLists.txt index ce3e78b31f2..8a7ee4e69ef 100644 --- a/reactos/dll/win32/msxml3/CMakeLists.txt +++ b/reactos/dll/win32/msxml3/CMakeLists.txt @@ -66,7 +66,7 @@ add_library(msxml3 SHARED add_idl_headers(xmlparser_idlheader xmlparser.idl) set_module_type(msxml3 win32dll) -target_link_libraries(msxml3 libxml2 uuid wine) +target_link_libraries(msxml3 libxml2 iconv-static uuid wine) add_importlibs(msxml3 urlmon ws2_32 shlwapi oleaut32 ole32 user32 msvcrt kernel32 ntdll) add_dependencies(msxml3 xmlparser_idlheader stdole2) # msxml3_v1.tlb needs stdole2.tlb add_pch(msxml3 precomp.h SOURCE) diff --git a/reactos/lib/3rdparty/CMakeLists.txt b/reactos/lib/3rdparty/CMakeLists.txt index 13bef592b45..0048a9fcdb0 100644 --- a/reactos/lib/3rdparty/CMakeLists.txt +++ b/reactos/lib/3rdparty/CMakeLists.txt @@ -7,6 +7,7 @@ add_subdirectory(fullfat) add_subdirectory(libmpg123) add_subdirectory(libsamplerate) add_subdirectory(libwine) +add_subdirectory(libwin-iconv) add_subdirectory(libxml2) if(MSVC) add_subdirectory(stlport) diff --git a/reactos/lib/3rdparty/libwin-iconv/CMakeLists.txt b/reactos/lib/3rdparty/libwin-iconv/CMakeLists.txt new file mode 100644 index 00000000000..b99100162df --- /dev/null +++ b/reactos/lib/3rdparty/libwin-iconv/CMakeLists.txt @@ -0,0 +1,8 @@ + +if(MSVC) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) +endif() + +add_library(iconv-static win_iconv.c) +set_target_properties(iconv-static PROPERTIES OUTPUT_NAME "iconv") +add_dependencies(iconv-static psdk) diff --git a/reactos/lib/3rdparty/libwin-iconv/ChangeLog b/reactos/lib/3rdparty/libwin-iconv/ChangeLog new file mode 100644 index 00000000000..52f23ed9dbf --- /dev/null +++ b/reactos/lib/3rdparty/libwin-iconv/ChangeLog @@ -0,0 +1,161 @@ +2014-02-05 Yukihiro Nakadaira + + * win_iconv.c: Added alias. ISO_8859-* ISO_8859_* + * win_iconv.c, win_iconv_test.c: Fixed for compiler warning. + +2013-09-15 Yukihiro Nakadaira + + * iconv.h: Fixed c++ style comment. (Issue 21) (Thanks to bgilbert) + +2012-11-22 Yukihiro Nakadaira + + * win_iconv.c: Fix warnings. + (Issue 19) (Thanks to yselkowitz) + +2012-10-21 Yukihiro Nakadaira + + * win_iconv.c, win_iconv_test.c: Add //ignore and -c flag. + +2012-10-15 Yukihiro Nakadaira + + * win_iconv.c, win_iconv_test.c: cosmetic change. + +2012-09-19 Yukihiro Nakadaira + + * iconv.h, win_iconv.c, win_iconv_test.c: Change iconv(3) prototype. + "const char **inbuf" -> "char **inbuf" + (Issue 8) + + * win_iconv.c: Change to not use TEXT macro for GetProcAddress. + (Issue 17) (Thanks to EPienkowskia) + + * win_iconv_test.c: Fix for -DUNICODE. Use GetModuleFileNameA. + +2011-10-28 Yukihiro Nakadaira + + * win_iconv.c: Add UCS-2. + (Issue 14) (Thanks to j.g.rennison) + +2011-10-24 Yukihiro Nakadaira + + * win_iconv.c: Add Big5-HKSCS alias. + (Issue 13) (Thanks to timothy.ty.lee) + +2011-09-06 Yukihiro Nakadaira + + * Makefile: Improvement of the creation of the DLL. + (Issue 10) (Thanks to vincent.torri) + +2011-08-19 Yukihiro Nakadaira + + * win_iconv.c: Fixed a bug that assumption that + sizeof(DWORD)==sizeof(void*) in find_imported_module_by_funcname. + (Issue 7) (Thanks to j.g.rennison) + +2011-08-13 Yukihiro Nakadaira + + * win_iconv.c, win_iconv_test.c: Fixed a bug that //translit + flag does not work when transliterating to the default + character. + (Issue 9) (Thanks to j.g.rennison) + +2011-07-26 Yukihiro Nakadaira + + * CMakeLists.txt: fix dll name with mingw. + (Issue 6) (Thanks to kalevlember) + + +2011-05-19 Yukihiro Nakadaira + + * win_iconv.c: Add some more UCS aliases. + Merge from Tor Lillqvist version. + (Issue 4) (Thanks to mkbosmans) + +2011-05-15 Yukihiro Nakadaira + + * Makefile: use variable for tools in Makefile + (Issue 3) (Thanks to mkbosmans) + +2011-01-13 Yukihiro Nakadaira + + * win_iconv_test.c: Removed unused variable. + + * win_iconv_test.c: Added USE_ICONV_H flag to compile with -liconv. + (Issue 2) (Thanks to amorilia.gamebox) + +2010-04-14 Patrick von Reth + + * added c++ support + +2010-03-28 Patrick Spendrin + + * CMakeLists.txt, win_iconv.c: add CMake buildsystem, fix bug from issue tracker + +2009-07-25 Yukihiro Nakadaira + + * win_iconv.c, readme.txt: doc fix + +2009-07-06 Yukihiro Nakadaira + + * win_iconv.c, Makefile, readme.txt: doc fix + +2009-06-19 Yukihiro Nakadaira + + * win_iconv.c: cosmetic change + * win_iconv.c: Change Unicode BOM behavior + 1. Remove the BOM when "fromcode" is utf-16 or utf-32. + 2. Add the BOM when "tocode" is utf-16 or utf-32. + +2009-06-18 Yukihiro Nakadaira + + * win_iconv.c: Fixed a bug that invalid input may cause an + endless loop + +2009-06-18 Yukihiro Nakadaira + + * win_iconv.c: Fixed a bug that libiconv_iconv_open() doesn't + work (Christophe Benoit) + +2008-04-01 Yukihiro Nakadaira + + * win_iconv.c: Added //TRANSLIT option. + http://bugzilla.gnome.org/show_bug.cgi?id=524314 + +2008-03-20 Yukihiro Nakadaira + + * win_iconv.c: The dwFlags parameter to MultiByteToWideChars() + must be zero for some code pages (Tor Lillqvist) + +2008-03-19 Yukihiro Nakadaira + + * win_iconv.c: Added support for UCS-2 and GB18030 (Tor Lillqvist) + +2007-12-03 Yukihiro Nakadaira + + * iconv.h: #include to use size_t + +2007-11-28 Yukihiro Nakadaira + + * win_iconv.c: bug fix for two things (Tor Lillqvist) + 1) This is probably not important: Add a function + must_use_null_useddefaultchar() that checks for those + codepages for which the docs for WideCharToMultiByte() say + one has to use a NULL lpDefaultChar pointer. Don't know if + this is actually needed, but better to be safe than sorry. + 2) This is essential: In kernel_wctomb(), the code should first + check if bufsize is zero, and return the E2BIG error in that + case. + +2007-11-26 Yukihiro Nakadaira + + * win_iconv.c: ISO-8859-1 should be CP28591, not CP1252 (Tor + Lillqvist) + +2007-11-26 Yukihiro Nakadaira + + * win_iconv.c: patch from Tor Lillqvist (with alteration) + +2007-09-04 Yukihiro Nakadaira + + * : Initial import + diff --git a/reactos/lib/3rdparty/libwin-iconv/iconv.def b/reactos/lib/3rdparty/libwin-iconv/iconv.def new file mode 100644 index 00000000000..2497daca770 --- /dev/null +++ b/reactos/lib/3rdparty/libwin-iconv/iconv.def @@ -0,0 +1,23 @@ +EXPORTS + iconv + iconv_open + iconv_close + iconvctl + libiconv=iconv + libiconv_open=iconv_open + libiconv_close=iconv_close + libiconvctl=iconvctl +;; libiconv-1.11.dll +;; TODO for binary compatibility +; _libiconv_version @1 +; aliases2_lookup @2 +; aliases_lookup @3 +; iconv_canonicalize @4 +; libiconv @5 +; libiconv_close @6 +; libiconv_open @7 +; libiconv_relocate @8 +; libiconv_set_relocation_prefix @9 +; libiconvctl @10 +; libiconvlist @11 +; locale_charset @12 diff --git a/reactos/lib/3rdparty/libwin-iconv/iconv.h b/reactos/lib/3rdparty/libwin-iconv/iconv.h new file mode 100644 index 00000000000..7b35f1848ae --- /dev/null +++ b/reactos/lib/3rdparty/libwin-iconv/iconv.h @@ -0,0 +1,14 @@ +#ifndef _LIBICONV_H +#define _LIBICONV_H +#include +#ifdef __cplusplus +extern "C" { +#endif +typedef void* iconv_t; +iconv_t iconv_open(const char *tocode, const char *fromcode); +int iconv_close(iconv_t cd); +size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); +#ifdef __cplusplus +} +#endif +#endif diff --git a/reactos/lib/3rdparty/libwin-iconv/mlang.def b/reactos/lib/3rdparty/libwin-iconv/mlang.def new file mode 100644 index 00000000000..95026899acd --- /dev/null +++ b/reactos/lib/3rdparty/libwin-iconv/mlang.def @@ -0,0 +1,11 @@ +LIBRARY MLANG.DLL +EXPORTS + ConvertINetMultiByteToUnicode@24 + ;; ConvertINetReset (not documented) + ConvertINetString@28 + ConvertINetUnicodeToMultiByte@24 + IsConvertINetStringAvailable@8 + LcidToRfc1766A@12 + LcidToRfc1766W@12 + Rfc1766ToLcidA@8 + Rfc1766ToLcidW@8 diff --git a/reactos/lib/3rdparty/libwin-iconv/mlang.h b/reactos/lib/3rdparty/libwin-iconv/mlang.h new file mode 100644 index 00000000000..5cbf779c927 --- /dev/null +++ b/reactos/lib/3rdparty/libwin-iconv/mlang.h @@ -0,0 +1,54 @@ +HRESULT WINAPI ConvertINetString( + LPDWORD lpdwMode, + DWORD dwSrcEncoding, + DWORD dwDstEncoding, + LPCSTR lpSrcStr, + LPINT lpnSrcSize, + LPBYTE lpDstStr, + LPINT lpnDstSize +); + +HRESULT WINAPI ConvertINetMultiByteToUnicode( + LPDWORD lpdwMode, + DWORD dwSrcEncoding, + LPCSTR lpSrcStr, + LPINT lpnMultiCharCount, + LPWSTR lpDstStr, + LPINT lpnWideCharCount +); + +HRESULT WINAPI ConvertINetUnicodeToMultiByte( + LPDWORD lpdwMode, + DWORD dwEncoding, + LPCWSTR lpSrcStr, + LPINT lpnWideCharCount, + LPSTR lpDstStr, + LPINT lpnMultiCharCount +); + +HRESULT WINAPI IsConvertINetStringAvailable( + DWORD dwSrcEncoding, + DWORD dwDstEncoding +); + +HRESULT WINAPI LcidToRfc1766A( + LCID Locale, + LPSTR pszRfc1766, + int nChar +); + +HRESULT WINAPI LcidToRfc1766W( + LCID Locale, + LPWSTR pszRfc1766, + int nChar +); + +HRESULT WINAPI Rfc1766ToLcidA( + LCID *pLocale, + LPSTR pszRfc1766 +); + +HRESULT WINAPI Rfc1766ToLcidW( + LCID *pLocale, + LPWSTR pszRfc1766 +); diff --git a/reactos/lib/3rdparty/libwin-iconv/readme.txt b/reactos/lib/3rdparty/libwin-iconv/readme.txt new file mode 100644 index 00000000000..fc0616030ff --- /dev/null +++ b/reactos/lib/3rdparty/libwin-iconv/readme.txt @@ -0,0 +1,20 @@ +win_iconv is a iconv implementation using Win32 API to convert. + +win_iconv is placed in the public domain. + +ENVIRONMENT VARIABLE: + WINICONV_LIBICONV_DLL + If $WINICONV_LIBICONV_DLL is set, win_iconv uses the DLL. If + loading the DLL or iconv_open() failed, falls back to internal + conversion. If a few DLL are specified as comma separated list, + the first loadable DLL is used. The DLL should have + iconv_open(), iconv_close() and iconv(). Or libiconv_open(), + libiconv_close() and libiconv(). + (only available when USE_LIBICONV_DLL is defined at compile time) + +Win32 API does not support strict encoding conversion for some codepage. +And MLang function drop or replace invalid bytes and does not return +useful error status as iconv. This implementation cannot be used for +encoding validation purpose. + +Yukihiro Nakadaira diff --git a/reactos/lib/3rdparty/libwin-iconv/win_iconv.c b/reactos/lib/3rdparty/libwin-iconv/win_iconv.c new file mode 100644 index 00000000000..8069e8b2dc7 --- /dev/null +++ b/reactos/lib/3rdparty/libwin-iconv/win_iconv.c @@ -0,0 +1,2075 @@ +/* + * iconv implementation using Win32 API to convert. + * + * This file is placed in the public domain. + */ + +/* for WC_NO_BEST_FIT_CHARS */ +#ifndef WINVER +# define WINVER 0x0500 +#endif + +#define STRICT +#include +#include +#include +#include + +#ifdef __GNUC__ +#define UNUSED __attribute__((unused)) +#else +#define UNUSED +#endif + +/* WORKAROUND: */ +#ifndef UNDER_CE +#define GetProcAddressA GetProcAddress +#endif + +#if 0 +# define MAKE_EXE +# define MAKE_DLL +# define USE_LIBICONV_DLL +#endif + +#if !defined(DEFAULT_LIBICONV_DLL) +# define DEFAULT_LIBICONV_DLL "" +#endif + +#define MB_CHAR_MAX 16 + +#define UNICODE_MODE_BOM_DONE 1 +#define UNICODE_MODE_SWAPPED 2 + +#define FLAG_USE_BOM 1 +#define FLAG_TRANSLIT 2 /* //TRANSLIT */ +#define FLAG_IGNORE 4 /* //IGNORE */ + +typedef unsigned char uchar; +typedef unsigned short ushort; +typedef unsigned int uint; + +typedef void* iconv_t; + +iconv_t iconv_open(const char *tocode, const char *fromcode); +int iconv_close(iconv_t cd); +size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); + +/* libiconv interface for vim */ +#if defined(MAKE_DLL) +int +iconvctl (iconv_t cd, int request, void* argument) +{ + /* not supported */ + return 0; +} +#endif + +typedef struct compat_t compat_t; +typedef struct csconv_t csconv_t; +typedef struct rec_iconv_t rec_iconv_t; + +typedef iconv_t (*f_iconv_open)(const char *tocode, const char *fromcode); +typedef int (*f_iconv_close)(iconv_t cd); +typedef size_t (*f_iconv)(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); +typedef int* (*f_errno)(void); +typedef int (*f_mbtowc)(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize); +typedef int (*f_wctomb)(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize); +typedef int (*f_mblen)(csconv_t *cv, const uchar *buf, int bufsize); +typedef int (*f_flush)(csconv_t *cv, uchar *buf, int bufsize); + +#define COMPAT_IN 1 +#define COMPAT_OUT 2 + +/* unicode mapping for compatibility with other conversion table. */ +struct compat_t { + uint in; + uint out; + uint flag; +}; + +struct csconv_t { + int codepage; + int flags; + f_mbtowc mbtowc; + f_wctomb wctomb; + f_mblen mblen; + f_flush flush; + DWORD mode; + compat_t *compat; +}; + +struct rec_iconv_t { + iconv_t cd; + f_iconv_close iconv_close; + f_iconv iconv; + f_errno _errno; + csconv_t from; + csconv_t to; +#if defined(USE_LIBICONV_DLL) + HMODULE hlibiconv; +#endif +}; + +static int win_iconv_open(rec_iconv_t *cd, const char *tocode, const char *fromcode); +static int win_iconv_close(iconv_t cd); +static size_t win_iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); + +static int load_mlang(void); +static int make_csconv(const char *name, csconv_t *cv); +static int name_to_codepage(const char *name); +static uint utf16_to_ucs4(const ushort *wbuf); +static void ucs4_to_utf16(uint wc, ushort *wbuf, int *wbufsize); +static int mbtowc_flags(int codepage); +static int must_use_null_useddefaultchar(int codepage); +static char *strrstr(const char *str, const char *token); +static char *xstrndup(const char *s, size_t n); +static int seterror(int err); + +#if defined(USE_LIBICONV_DLL) +static int libiconv_iconv_open(rec_iconv_t *cd, const char *tocode, const char *fromcode); +static PVOID MyImageDirectoryEntryToData(LPVOID Base, BOOLEAN MappedAsImage, USHORT DirectoryEntry, PULONG Size); +static HMODULE find_imported_module_by_funcname(HMODULE hModule, const char *funcname); + +static HMODULE hwiniconv; +#endif + +static int sbcs_mblen(csconv_t *cv, const uchar *buf, int bufsize); +static int dbcs_mblen(csconv_t *cv, const uchar *buf, int bufsize); +static int mbcs_mblen(csconv_t *cv, const uchar *buf, int bufsize); +static int utf8_mblen(csconv_t *cv, const uchar *buf, int bufsize); +static int eucjp_mblen(csconv_t *cv, const uchar *buf, int bufsize); + +static int kernel_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize); +static int kernel_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize); +static int mlang_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize); +static int mlang_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize); +static int utf16_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize); +static int utf16_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize); +static int utf32_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize); +static int utf32_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize); +static int iso2022jp_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize); +static int iso2022jp_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize); +static int iso2022jp_flush(csconv_t *cv, uchar *buf, int bufsize); + +static struct { + int codepage; + const char *name; +} codepage_alias[] = { + {65001, "CP65001"}, + {65001, "UTF8"}, + {65001, "UTF-8"}, + + {1200, "CP1200"}, + {1200, "UTF16LE"}, + {1200, "UTF-16LE"}, + {1200, "UCS2LE"}, + {1200, "UCS-2LE"}, + + {1201, "CP1201"}, + {1201, "UTF16BE"}, + {1201, "UTF-16BE"}, + {1201, "UCS2BE"}, + {1201, "UCS-2BE"}, + {1201, "unicodeFFFE"}, + + {12000, "CP12000"}, + {12000, "UTF32LE"}, + {12000, "UTF-32LE"}, + {12000, "UCS4LE"}, + {12000, "UCS-4LE"}, + + {12001, "CP12001"}, + {12001, "UTF32BE"}, + {12001, "UTF-32BE"}, + {12001, "UCS4BE"}, + {12001, "UCS-4BE"}, + +#ifndef GLIB_COMPILATION + /* + * Default is big endian. + * See rfc2781 4.3 Interpreting text labelled as UTF-16. + */ + {1201, "UTF16"}, + {1201, "UTF-16"}, + {1201, "UCS2"}, + {1201, "UCS-2"}, + {12001, "UTF32"}, + {12001, "UTF-32"}, + {12001, "UCS-4"}, + {12001, "UCS4"}, +#else + /* Default is little endian, because the platform is */ + {1200, "UTF16"}, + {1200, "UTF-16"}, + {1200, "UCS2"}, + {1200, "UCS-2"}, + {12000, "UTF32"}, + {12000, "UTF-32"}, + {12000, "UCS4"}, + {12000, "UCS-4"}, +#endif + + /* copy from libiconv `iconv -l` */ + /* !IsValidCodePage(367) */ + {20127, "ANSI_X3.4-1968"}, + {20127, "ANSI_X3.4-1986"}, + {20127, "ASCII"}, + {20127, "CP367"}, + {20127, "IBM367"}, + {20127, "ISO-IR-6"}, + {20127, "ISO646-US"}, + {20127, "ISO_646.IRV:1991"}, + {20127, "US"}, + {20127, "US-ASCII"}, + {20127, "CSASCII"}, + + /* !IsValidCodePage(819) */ + {1252, "CP819"}, + {1252, "IBM819"}, + {28591, "ISO-8859-1"}, + {28591, "ISO-IR-100"}, + {28591, "ISO8859-1"}, + {28591, "ISO_8859-1"}, + {28591, "ISO_8859-1:1987"}, + {28591, "L1"}, + {28591, "LATIN1"}, + {28591, "CSISOLATIN1"}, + + {1250, "CP1250"}, + {1250, "MS-EE"}, + {1250, "WINDOWS-1250"}, + + {1251, "CP1251"}, + {1251, "MS-CYRL"}, + {1251, "WINDOWS-1251"}, + + {1252, "CP1252"}, + {1252, "MS-ANSI"}, + {1252, "WINDOWS-1252"}, + + {1253, "CP1253"}, + {1253, "MS-GREEK"}, + {1253, "WINDOWS-1253"}, + + {1254, "CP1254"}, + {1254, "MS-TURK"}, + {1254, "WINDOWS-1254"}, + + {1255, "CP1255"}, + {1255, "MS-HEBR"}, + {1255, "WINDOWS-1255"}, + + {1256, "CP1256"}, + {1256, "MS-ARAB"}, + {1256, "WINDOWS-1256"}, + + {1257, "CP1257"}, + {1257, "WINBALTRIM"}, + {1257, "WINDOWS-1257"}, + + {1258, "CP1258"}, + {1258, "WINDOWS-1258"}, + + {850, "850"}, + {850, "CP850"}, + {850, "IBM850"}, + {850, "CSPC850MULTILINGUAL"}, + + /* !IsValidCodePage(862) */ + {862, "862"}, + {862, "CP862"}, + {862, "IBM862"}, + {862, "CSPC862LATINHEBREW"}, + + {866, "866"}, + {866, "CP866"}, + {866, "IBM866"}, + {866, "CSIBM866"}, + + /* !IsValidCodePage(154) */ + {154, "CP154"}, + {154, "CYRILLIC-ASIAN"}, + {154, "PT154"}, + {154, "PTCP154"}, + {154, "CSPTCP154"}, + + /* !IsValidCodePage(1133) */ + {1133, "CP1133"}, + {1133, "IBM-CP1133"}, + + {874, "CP874"}, + {874, "WINDOWS-874"}, + + /* !IsValidCodePage(51932) */ + {51932, "CP51932"}, + {51932, "MS51932"}, + {51932, "WINDOWS-51932"}, + {51932, "EUC-JP"}, + + {932, "CP932"}, + {932, "MS932"}, + {932, "SHIFFT_JIS"}, + {932, "SHIFFT_JIS-MS"}, + {932, "SJIS"}, + {932, "SJIS-MS"}, + {932, "SJIS-OPEN"}, + {932, "SJIS-WIN"}, + {932, "WINDOWS-31J"}, + {932, "WINDOWS-932"}, + {932, "CSWINDOWS31J"}, + + {50221, "CP50221"}, + {50221, "ISO-2022-JP"}, + {50221, "ISO-2022-JP-MS"}, + {50221, "ISO2022-JP"}, + {50221, "ISO2022-JP-MS"}, + {50221, "MS50221"}, + {50221, "WINDOWS-50221"}, + + {936, "CP936"}, + {936, "GBK"}, + {936, "MS936"}, + {936, "WINDOWS-936"}, + + {950, "CP950"}, + {950, "BIG5"}, + {950, "BIG5HKSCS"}, + {950, "BIG5-HKSCS"}, + + {949, "CP949"}, + {949, "UHC"}, + {949, "EUC-KR"}, + + {1361, "CP1361"}, + {1361, "JOHAB"}, + + {437, "437"}, + {437, "CP437"}, + {437, "IBM437"}, + {437, "CSPC8CODEPAGE437"}, + + {737, "CP737"}, + + {775, "CP775"}, + {775, "IBM775"}, + {775, "CSPC775BALTIC"}, + + {852, "852"}, + {852, "CP852"}, + {852, "IBM852"}, + {852, "CSPCP852"}, + + /* !IsValidCodePage(853) */ + {853, "CP853"}, + + {855, "855"}, + {855, "CP855"}, + {855, "IBM855"}, + {855, "CSIBM855"}, + + {857, "857"}, + {857, "CP857"}, + {857, "IBM857"}, + {857, "CSIBM857"}, + + /* !IsValidCodePage(858) */ + {858, "CP858"}, + + {860, "860"}, + {860, "CP860"}, + {860, "IBM860"}, + {860, "CSIBM860"}, + + {861, "861"}, + {861, "CP-IS"}, + {861, "CP861"}, + {861, "IBM861"}, + {861, "CSIBM861"}, + + {863, "863"}, + {863, "CP863"}, + {863, "IBM863"}, + {863, "CSIBM863"}, + + {864, "CP864"}, + {864, "IBM864"}, + {864, "CSIBM864"}, + + {865, "865"}, + {865, "CP865"}, + {865, "IBM865"}, + {865, "CSIBM865"}, + + {869, "869"}, + {869, "CP-GR"}, + {869, "CP869"}, + {869, "IBM869"}, + {869, "CSIBM869"}, + + /* !IsValidCodePage(1152) */ + {1125, "CP1125"}, + + /* + * Code Page Identifiers + * http://msdn2.microsoft.com/en-us/library/ms776446.aspx + */ + {37, "IBM037"}, /* IBM EBCDIC US-Canada */ + {437, "IBM437"}, /* OEM United States */ + {500, "IBM500"}, /* IBM EBCDIC International */ + {708, "ASMO-708"}, /* Arabic (ASMO 708) */ + /* 709 Arabic (ASMO-449+, BCON V4) */ + /* 710 Arabic - Transparent Arabic */ + {720, "DOS-720"}, /* Arabic (Transparent ASMO); Arabic (DOS) */ + {737, "ibm737"}, /* OEM Greek (formerly 437G); Greek (DOS) */ + {775, "ibm775"}, /* OEM Baltic; Baltic (DOS) */ + {850, "ibm850"}, /* OEM Multilingual Latin 1; Western European (DOS) */ + {852, "ibm852"}, /* OEM Latin 2; Central European (DOS) */ + {855, "IBM855"}, /* OEM Cyrillic (primarily Russian) */ + {857, "ibm857"}, /* OEM Turkish; Turkish (DOS) */ + {858, "IBM00858"}, /* OEM Multilingual Latin 1 + Euro symbol */ + {860, "IBM860"}, /* OEM Portuguese; Portuguese (DOS) */ + {861, "ibm861"}, /* OEM Icelandic; Icelandic (DOS) */ + {862, "DOS-862"}, /* OEM Hebrew; Hebrew (DOS) */ + {863, "IBM863"}, /* OEM French Canadian; French Canadian (DOS) */ + {864, "IBM864"}, /* OEM Arabic; Arabic (864) */ + {865, "IBM865"}, /* OEM Nordic; Nordic (DOS) */ + {866, "cp866"}, /* OEM Russian; Cyrillic (DOS) */ + {869, "ibm869"}, /* OEM Modern Greek; Greek, Modern (DOS) */ + {870, "IBM870"}, /* IBM EBCDIC Multilingual/ROECE (Latin 2); IBM EBCDIC Multilingual Latin 2 */ + {874, "windows-874"}, /* ANSI/OEM Thai (same as 28605, ISO 8859-15); Thai (Windows) */ + {875, "cp875"}, /* IBM EBCDIC Greek Modern */ + {932, "shift_jis"}, /* ANSI/OEM Japanese; Japanese (Shift-JIS) */ + {932, "shift-jis"}, /* alternative name for it */ + {936, "gb2312"}, /* ANSI/OEM Simplified Chinese (PRC, Singapore); Chinese Simplified (GB2312) */ + {949, "ks_c_5601-1987"}, /* ANSI/OEM Korean (Unified Hangul Code) */ + {950, "big5"}, /* ANSI/OEM Traditional Chinese (Taiwan; Hong Kong SAR, PRC); Chinese Traditional (Big5) */ + {950, "big5hkscs"}, /* ANSI/OEM Traditional Chinese (Hong Kong SAR); Chinese Traditional (Big5-HKSCS) */ + {950, "big5-hkscs"}, /* alternative name for it */ + {1026, "IBM1026"}, /* IBM EBCDIC Turkish (Latin 5) */ + {1047, "IBM01047"}, /* IBM EBCDIC Latin 1/Open System */ + {1140, "IBM01140"}, /* IBM EBCDIC US-Canada (037 + Euro symbol); IBM EBCDIC (US-Canada-Euro) */ + {1141, "IBM01141"}, /* IBM EBCDIC Germany (20273 + Euro symbol); IBM EBCDIC (Germany-Euro) */ + {1142, "IBM01142"}, /* IBM EBCDIC Denmark-Norway (20277 + Euro symbol); IBM EBCDIC (Denmark-Norway-Euro) */ + {1143, "IBM01143"}, /* IBM EBCDIC Finland-Sweden (20278 + Euro symbol); IBM EBCDIC (Finland-Sweden-Euro) */ + {1144, "IBM01144"}, /* IBM EBCDIC Italy (20280 + Euro symbol); IBM EBCDIC (Italy-Euro) */ + {1145, "IBM01145"}, /* IBM EBCDIC Latin America-Spain (20284 + Euro symbol); IBM EBCDIC (Spain-Euro) */ + {1146, "IBM01146"}, /* IBM EBCDIC United Kingdom (20285 + Euro symbol); IBM EBCDIC (UK-Euro) */ + {1147, "IBM01147"}, /* IBM EBCDIC France (20297 + Euro symbol); IBM EBCDIC (France-Euro) */ + {1148, "IBM01148"}, /* IBM EBCDIC International (500 + Euro symbol); IBM EBCDIC (International-Euro) */ + {1149, "IBM01149"}, /* IBM EBCDIC Icelandic (20871 + Euro symbol); IBM EBCDIC (Icelandic-Euro) */ + {1250, "windows-1250"}, /* ANSI Central European; Central European (Windows) */ + {1251, "windows-1251"}, /* ANSI Cyrillic; Cyrillic (Windows) */ + {1252, "windows-1252"}, /* ANSI Latin 1; Western European (Windows) */ + {1253, "windows-1253"}, /* ANSI Greek; Greek (Windows) */ + {1254, "windows-1254"}, /* ANSI Turkish; Turkish (Windows) */ + {1255, "windows-1255"}, /* ANSI Hebrew; Hebrew (Windows) */ + {1256, "windows-1256"}, /* ANSI Arabic; Arabic (Windows) */ + {1257, "windows-1257"}, /* ANSI Baltic; Baltic (Windows) */ + {1258, "windows-1258"}, /* ANSI/OEM Vietnamese; Vietnamese (Windows) */ + {1361, "Johab"}, /* Korean (Johab) */ + {10000, "macintosh"}, /* MAC Roman; Western European (Mac) */ + {10001, "x-mac-japanese"}, /* Japanese (Mac) */ + {10002, "x-mac-chinesetrad"}, /* MAC Traditional Chinese (Big5); Chinese Traditional (Mac) */ + {10003, "x-mac-korean"}, /* Korean (Mac) */ + {10004, "x-mac-arabic"}, /* Arabic (Mac) */ + {10005, "x-mac-hebrew"}, /* Hebrew (Mac) */ + {10006, "x-mac-greek"}, /* Greek (Mac) */ + {10007, "x-mac-cyrillic"}, /* Cyrillic (Mac) */ + {10008, "x-mac-chinesesimp"}, /* MAC Simplified Chinese (GB 2312); Chinese Simplified (Mac) */ + {10010, "x-mac-romanian"}, /* Romanian (Mac) */ + {10017, "x-mac-ukrainian"}, /* Ukrainian (Mac) */ + {10021, "x-mac-thai"}, /* Thai (Mac) */ + {10029, "x-mac-ce"}, /* MAC Latin 2; Central European (Mac) */ + {10079, "x-mac-icelandic"}, /* Icelandic (Mac) */ + {10081, "x-mac-turkish"}, /* Turkish (Mac) */ + {10082, "x-mac-croatian"}, /* Croatian (Mac) */ + {20000, "x-Chinese_CNS"}, /* CNS Taiwan; Chinese Traditional (CNS) */ + {20001, "x-cp20001"}, /* TCA Taiwan */ + {20002, "x_Chinese-Eten"}, /* Eten Taiwan; Chinese Traditional (Eten) */ + {20003, "x-cp20003"}, /* IBM5550 Taiwan */ + {20004, "x-cp20004"}, /* TeleText Taiwan */ + {20005, "x-cp20005"}, /* Wang Taiwan */ + {20105, "x-IA5"}, /* IA5 (IRV International Alphabet No. 5, 7-bit); Western European (IA5) */ + {20106, "x-IA5-German"}, /* IA5 German (7-bit) */ + {20107, "x-IA5-Swedish"}, /* IA5 Swedish (7-bit) */ + {20108, "x-IA5-Norwegian"}, /* IA5 Norwegian (7-bit) */ + {20127, "us-ascii"}, /* US-ASCII (7-bit) */ + {20261, "x-cp20261"}, /* T.61 */ + {20269, "x-cp20269"}, /* ISO 6937 Non-Spacing Accent */ + {20273, "IBM273"}, /* IBM EBCDIC Germany */ + {20277, "IBM277"}, /* IBM EBCDIC Denmark-Norway */ + {20278, "IBM278"}, /* IBM EBCDIC Finland-Sweden */ + {20280, "IBM280"}, /* IBM EBCDIC Italy */ + {20284, "IBM284"}, /* IBM EBCDIC Latin America-Spain */ + {20285, "IBM285"}, /* IBM EBCDIC United Kingdom */ + {20290, "IBM290"}, /* IBM EBCDIC Japanese Katakana Extended */ + {20297, "IBM297"}, /* IBM EBCDIC France */ + {20420, "IBM420"}, /* IBM EBCDIC Arabic */ + {20423, "IBM423"}, /* IBM EBCDIC Greek */ + {20424, "IBM424"}, /* IBM EBCDIC Hebrew */ + {20833, "x-EBCDIC-KoreanExtended"}, /* IBM EBCDIC Korean Extended */ + {20838, "IBM-Thai"}, /* IBM EBCDIC Thai */ + {20866, "koi8-r"}, /* Russian (KOI8-R); Cyrillic (KOI8-R) */ + {20871, "IBM871"}, /* IBM EBCDIC Icelandic */ + {20880, "IBM880"}, /* IBM EBCDIC Cyrillic Russian */ + {20905, "IBM905"}, /* IBM EBCDIC Turkish */ + {20924, "IBM00924"}, /* IBM EBCDIC Latin 1/Open System (1047 + Euro symbol) */ + {20932, "EUC-JP"}, /* Japanese (JIS 0208-1990 and 0121-1990) */ + {20936, "x-cp20936"}, /* Simplified Chinese (GB2312); Chinese Simplified (GB2312-80) */ + {20949, "x-cp20949"}, /* Korean Wansung */ + {21025, "cp1025"}, /* IBM EBCDIC Cyrillic Serbian-Bulgarian */ + /* 21027 (deprecated) */ + {21866, "koi8-u"}, /* Ukrainian (KOI8-U); Cyrillic (KOI8-U) */ + {28591, "iso-8859-1"}, /* ISO 8859-1 Latin 1; Western European (ISO) */ + {28591, "iso8859-1"}, /* ISO 8859-1 Latin 1; Western European (ISO) */ + {28591, "iso_8859-1"}, + {28591, "iso_8859_1"}, + {28592, "iso-8859-2"}, /* ISO 8859-2 Central European; Central European (ISO) */ + {28592, "iso8859-2"}, /* ISO 8859-2 Central European; Central European (ISO) */ + {28592, "iso_8859-2"}, + {28592, "iso_8859_2"}, + {28593, "iso-8859-3"}, /* ISO 8859-3 Latin 3 */ + {28593, "iso8859-3"}, /* ISO 8859-3 Latin 3 */ + {28593, "iso_8859-3"}, + {28593, "iso_8859_3"}, + {28594, "iso-8859-4"}, /* ISO 8859-4 Baltic */ + {28594, "iso8859-4"}, /* ISO 8859-4 Baltic */ + {28594, "iso_8859-4"}, + {28594, "iso_8859_4"}, + {28595, "iso-8859-5"}, /* ISO 8859-5 Cyrillic */ + {28595, "iso8859-5"}, /* ISO 8859-5 Cyrillic */ + {28595, "iso_8859-5"}, + {28595, "iso_8859_5"}, + {28596, "iso-8859-6"}, /* ISO 8859-6 Arabic */ + {28596, "iso8859-6"}, /* ISO 8859-6 Arabic */ + {28596, "iso_8859-6"}, + {28596, "iso_8859_6"}, + {28597, "iso-8859-7"}, /* ISO 8859-7 Greek */ + {28597, "iso8859-7"}, /* ISO 8859-7 Greek */ + {28597, "iso_8859-7"}, + {28597, "iso_8859_7"}, + {28598, "iso-8859-8"}, /* ISO 8859-8 Hebrew; Hebrew (ISO-Visual) */ + {28598, "iso8859-8"}, /* ISO 8859-8 Hebrew; Hebrew (ISO-Visual) */ + {28598, "iso_8859-8"}, + {28598, "iso_8859_8"}, + {28599, "iso-8859-9"}, /* ISO 8859-9 Turkish */ + {28599, "iso8859-9"}, /* ISO 8859-9 Turkish */ + {28599, "iso_8859-9"}, + {28599, "iso_8859_9"}, + {28603, "iso-8859-13"}, /* ISO 8859-13 Estonian */ + {28603, "iso8859-13"}, /* ISO 8859-13 Estonian */ + {28603, "iso_8859-13"}, + {28603, "iso_8859_13"}, + {28605, "iso-8859-15"}, /* ISO 8859-15 Latin 9 */ + {28605, "iso8859-15"}, /* ISO 8859-15 Latin 9 */ + {28605, "iso_8859-15"}, + {28605, "iso_8859_15"}, + {29001, "x-Europa"}, /* Europa 3 */ + {38598, "iso-8859-8-i"}, /* ISO 8859-8 Hebrew; Hebrew (ISO-Logical) */ + {38598, "iso8859-8-i"}, /* ISO 8859-8 Hebrew; Hebrew (ISO-Logical) */ + {38598, "iso_8859-8-i"}, + {38598, "iso_8859_8-i"}, + {50220, "iso-2022-jp"}, /* ISO 2022 Japanese with no halfwidth Katakana; Japanese (JIS) */ + {50221, "csISO2022JP"}, /* ISO 2022 Japanese with halfwidth Katakana; Japanese (JIS-Allow 1 byte Kana) */ + {50222, "iso-2022-jp"}, /* ISO 2022 Japanese JIS X 0201-1989; Japanese (JIS-Allow 1 byte Kana - SO/SI) */ + {50225, "iso-2022-kr"}, /* ISO 2022 Korean */ + {50225, "iso2022-kr"}, /* ISO 2022 Korean */ + {50227, "x-cp50227"}, /* ISO 2022 Simplified Chinese; Chinese Simplified (ISO 2022) */ + /* 50229 ISO 2022 Traditional Chinese */ + /* 50930 EBCDIC Japanese (Katakana) Extended */ + /* 50931 EBCDIC US-Canada and Japanese */ + /* 50933 EBCDIC Korean Extended and Korean */ + /* 50935 EBCDIC Simplified Chinese Extended and Simplified Chinese */ + /* 50936 EBCDIC Simplified Chinese */ + /* 50937 EBCDIC US-Canada and Traditional Chinese */ + /* 50939 EBCDIC Japanese (Latin) Extended and Japanese */ + {51932, "euc-jp"}, /* EUC Japanese */ + {51936, "EUC-CN"}, /* EUC Simplified Chinese; Chinese Simplified (EUC) */ + {51949, "euc-kr"}, /* EUC Korean */ + /* 51950 EUC Traditional Chinese */ + {52936, "hz-gb-2312"}, /* HZ-GB2312 Simplified Chinese; Chinese Simplified (HZ) */ + {54936, "GB18030"}, /* Windows XP and later: GB18030 Simplified Chinese (4 byte); Chinese Simplified (GB18030) */ + {57002, "x-iscii-de"}, /* ISCII Devanagari */ + {57003, "x-iscii-be"}, /* ISCII Bengali */ + {57004, "x-iscii-ta"}, /* ISCII Tamil */ + {57005, "x-iscii-te"}, /* ISCII Telugu */ + {57006, "x-iscii-as"}, /* ISCII Assamese */ + {57007, "x-iscii-or"}, /* ISCII Oriya */ + {57008, "x-iscii-ka"}, /* ISCII Kannada */ + {57009, "x-iscii-ma"}, /* ISCII Malayalam */ + {57010, "x-iscii-gu"}, /* ISCII Gujarati */ + {57011, "x-iscii-pa"}, /* ISCII Punjabi */ + + {0, NULL} +}; + +/* + * SJIS SHIFTJIS table CP932 table + * ---- --------------------------- -------------------------------- + * 5C U+00A5 YEN SIGN U+005C REVERSE SOLIDUS + * 7E U+203E OVERLINE U+007E TILDE + * 815C U+2014 EM DASH U+2015 HORIZONTAL BAR + * 815F U+005C REVERSE SOLIDUS U+FF3C FULLWIDTH REVERSE SOLIDUS + * 8160 U+301C WAVE DASH U+FF5E FULLWIDTH TILDE + * 8161 U+2016 DOUBLE VERTICAL LINE U+2225 PARALLEL TO + * 817C U+2212 MINUS SIGN U+FF0D FULLWIDTH HYPHEN-MINUS + * 8191 U+00A2 CENT SIGN U+FFE0 FULLWIDTH CENT SIGN + * 8192 U+00A3 POUND SIGN U+FFE1 FULLWIDTH POUND SIGN + * 81CA U+00AC NOT SIGN U+FFE2 FULLWIDTH NOT SIGN + * + * EUC-JP and ISO-2022-JP should be compatible with CP932. + * + * Kernel and MLang have different Unicode mapping table. Make sure + * which API is used. + */ +static compat_t cp932_compat[] = { + {0x00A5, 0x005C, COMPAT_OUT}, + {0x203E, 0x007E, COMPAT_OUT}, + {0x2014, 0x2015, COMPAT_OUT}, + {0x301C, 0xFF5E, COMPAT_OUT}, + {0x2016, 0x2225, COMPAT_OUT}, + {0x2212, 0xFF0D, COMPAT_OUT}, + {0x00A2, 0xFFE0, COMPAT_OUT}, + {0x00A3, 0xFFE1, COMPAT_OUT}, + {0x00AC, 0xFFE2, COMPAT_OUT}, + {0, 0, 0} +}; + +static compat_t cp20932_compat[] = { + {0x00A5, 0x005C, COMPAT_OUT}, + {0x203E, 0x007E, COMPAT_OUT}, + {0x2014, 0x2015, COMPAT_OUT}, + {0xFF5E, 0x301C, COMPAT_OUT|COMPAT_IN}, + {0x2225, 0x2016, COMPAT_OUT|COMPAT_IN}, + {0xFF0D, 0x2212, COMPAT_OUT|COMPAT_IN}, + {0xFFE0, 0x00A2, COMPAT_OUT|COMPAT_IN}, + {0xFFE1, 0x00A3, COMPAT_OUT|COMPAT_IN}, + {0xFFE2, 0x00AC, COMPAT_OUT|COMPAT_IN}, + {0, 0, 0} +}; + +static compat_t *cp51932_compat = cp932_compat; + +/* cp20932_compat for kernel. cp932_compat for mlang. */ +static compat_t *cp5022x_compat = cp932_compat; + +typedef HRESULT (WINAPI *CONVERTINETSTRING)( + LPDWORD lpdwMode, + DWORD dwSrcEncoding, + DWORD dwDstEncoding, + LPCSTR lpSrcStr, + LPINT lpnSrcSize, + LPBYTE lpDstStr, + LPINT lpnDstSize +); +typedef HRESULT (WINAPI *CONVERTINETMULTIBYTETOUNICODE)( + LPDWORD lpdwMode, + DWORD dwSrcEncoding, + LPCSTR lpSrcStr, + LPINT lpnMultiCharCount, + LPWSTR lpDstStr, + LPINT lpnWideCharCount +); +typedef HRESULT (WINAPI *CONVERTINETUNICODETOMULTIBYTE)( + LPDWORD lpdwMode, + DWORD dwEncoding, + LPCWSTR lpSrcStr, + LPINT lpnWideCharCount, + LPSTR lpDstStr, + LPINT lpnMultiCharCount +); +typedef HRESULT (WINAPI *ISCONVERTINETSTRINGAVAILABLE)( + DWORD dwSrcEncoding, + DWORD dwDstEncoding +); +typedef HRESULT (WINAPI *LCIDTORFC1766A)( + LCID Locale, + LPSTR pszRfc1766, + int nChar +); +typedef HRESULT (WINAPI *LCIDTORFC1766W)( + LCID Locale, + LPWSTR pszRfc1766, + int nChar +); +typedef HRESULT (WINAPI *RFC1766TOLCIDA)( + LCID *pLocale, + LPSTR pszRfc1766 +); +typedef HRESULT (WINAPI *RFC1766TOLCIDW)( + LCID *pLocale, + LPWSTR pszRfc1766 +); +static CONVERTINETSTRING ConvertINetString; +static CONVERTINETMULTIBYTETOUNICODE ConvertINetMultiByteToUnicode; +static CONVERTINETUNICODETOMULTIBYTE ConvertINetUnicodeToMultiByte; +static ISCONVERTINETSTRINGAVAILABLE IsConvertINetStringAvailable; +static LCIDTORFC1766A LcidToRfc1766A; +static RFC1766TOLCIDA Rfc1766ToLcidA; + +static int +load_mlang(void) +{ + HMODULE h; + if (ConvertINetString != NULL) + return TRUE; + h = LoadLibrary(TEXT("mlang.dll")); + if (!h) + return FALSE; + ConvertINetString = (CONVERTINETSTRING)GetProcAddressA(h, "ConvertINetString"); + ConvertINetMultiByteToUnicode = (CONVERTINETMULTIBYTETOUNICODE)GetProcAddressA(h, "ConvertINetMultiByteToUnicode"); + ConvertINetUnicodeToMultiByte = (CONVERTINETUNICODETOMULTIBYTE)GetProcAddressA(h, "ConvertINetUnicodeToMultiByte"); + IsConvertINetStringAvailable = (ISCONVERTINETSTRINGAVAILABLE)GetProcAddressA(h, "IsConvertINetStringAvailable"); + LcidToRfc1766A = (LCIDTORFC1766A)GetProcAddressA(h, "LcidToRfc1766A"); + Rfc1766ToLcidA = (RFC1766TOLCIDA)GetProcAddressA(h, "Rfc1766ToLcidA"); + return TRUE; +} + +iconv_t +iconv_open(const char *tocode, const char *fromcode) +{ + rec_iconv_t *cd; + + cd = (rec_iconv_t *)calloc(1, sizeof(rec_iconv_t)); + if (cd == NULL) + return (iconv_t)(-1); + +#if defined(USE_LIBICONV_DLL) + errno = 0; + if (libiconv_iconv_open(cd, tocode, fromcode)) + return (iconv_t)cd; +#endif + + /* reset the errno to prevent reporting wrong error code. + * 0 for unsorted error. */ + errno = 0; + if (win_iconv_open(cd, tocode, fromcode)) + return (iconv_t)cd; + + free(cd); + + return (iconv_t)(-1); +} + +int +iconv_close(iconv_t _cd) +{ + rec_iconv_t *cd = (rec_iconv_t *)_cd; + int r = cd->iconv_close(cd->cd); + int e = *(cd->_errno()); +#if defined(USE_LIBICONV_DLL) + if (cd->hlibiconv != NULL) + FreeLibrary(cd->hlibiconv); +#endif + free(cd); + errno = e; + return r; +} + +size_t +iconv(iconv_t _cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) +{ + rec_iconv_t *cd = (rec_iconv_t *)_cd; + size_t r = cd->iconv(cd->cd, inbuf, inbytesleft, outbuf, outbytesleft); + errno = *(cd->_errno()); + return r; +} + +static int +win_iconv_open(rec_iconv_t *cd, const char *tocode, const char *fromcode) +{ + if (!make_csconv(fromcode, &cd->from) || !make_csconv(tocode, &cd->to)) + return FALSE; + cd->iconv_close = win_iconv_close; + cd->iconv = win_iconv; + cd->_errno = _errno; + cd->cd = (iconv_t)cd; + return TRUE; +} + +static int +win_iconv_close(iconv_t cd UNUSED) +{ + return 0; +} + +static size_t +win_iconv(iconv_t _cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) +{ + rec_iconv_t *cd = (rec_iconv_t *)_cd; + ushort wbuf[MB_CHAR_MAX]; /* enough room for one character */ + int insize; + int outsize; + int wsize; + DWORD frommode; + DWORD tomode; + uint wc; + compat_t *cp; + int i; + + if (inbuf == NULL || *inbuf == NULL) + { + if (outbuf != NULL && *outbuf != NULL && cd->to.flush != NULL) + { + tomode = cd->to.mode; + outsize = cd->to.flush(&cd->to, (uchar *)*outbuf, *outbytesleft); + if (outsize == -1) + { + if ((cd->to.flags & FLAG_IGNORE) && errno != E2BIG) + { + outsize = 0; + } + else + { + cd->to.mode = tomode; + return (size_t)(-1); + } + } + *outbuf += outsize; + *outbytesleft -= outsize; + } + cd->from.mode = 0; + cd->to.mode = 0; + return 0; + } + + while (*inbytesleft != 0) + { + frommode = cd->from.mode; + tomode = cd->to.mode; + wsize = MB_CHAR_MAX; + + insize = cd->from.mbtowc(&cd->from, (const uchar *)*inbuf, *inbytesleft, wbuf, &wsize); + if (insize == -1) + { + if (cd->to.flags & FLAG_IGNORE) + { + cd->from.mode = frommode; + insize = 1; + wsize = 0; + } + else + { + cd->from.mode = frommode; + return (size_t)(-1); + } + } + + if (wsize == 0) + { + *inbuf += insize; + *inbytesleft -= insize; + continue; + } + + if (cd->from.compat != NULL) + { + wc = utf16_to_ucs4(wbuf); + cp = cd->from.compat; + for (i = 0; cp[i].in != 0; ++i) + { + if ((cp[i].flag & COMPAT_IN) && cp[i].out == wc) + { + ucs4_to_utf16(cp[i].in, wbuf, &wsize); + break; + } + } + } + + if (cd->to.compat != NULL) + { + wc = utf16_to_ucs4(wbuf); + cp = cd->to.compat; + for (i = 0; cp[i].in != 0; ++i) + { + if ((cp[i].flag & COMPAT_OUT) && cp[i].in == wc) + { + ucs4_to_utf16(cp[i].out, wbuf, &wsize); + break; + } + } + } + + outsize = cd->to.wctomb(&cd->to, wbuf, wsize, (uchar *)*outbuf, *outbytesleft); + if (outsize == -1) + { + if ((cd->to.flags & FLAG_IGNORE) && errno != E2BIG) + { + cd->to.mode = tomode; + outsize = 0; + } + else + { + cd->from.mode = frommode; + cd->to.mode = tomode; + return (size_t)(-1); + } + } + + *inbuf += insize; + *outbuf += outsize; + *inbytesleft -= insize; + *outbytesleft -= outsize; + } + + return 0; +} + +static int +make_csconv(const char *_name, csconv_t *cv) +{ + CPINFO cpinfo; + int use_compat = TRUE; + int flag = 0; + char *name; + char *p; + + name = xstrndup(_name, strlen(_name)); + if (name == NULL) + return FALSE; + + /* check for option "enc_name//opt1//opt2" */ + while ((p = strrstr(name, "//")) != NULL) + { + if (_stricmp(p + 2, "nocompat") == 0) + use_compat = FALSE; + else if (_stricmp(p + 2, "translit") == 0) + flag |= FLAG_TRANSLIT; + else if (_stricmp(p + 2, "ignore") == 0) + flag |= FLAG_IGNORE; + *p = 0; + } + + cv->mode = 0; + cv->flags = flag; + cv->mblen = NULL; + cv->flush = NULL; + cv->compat = NULL; + cv->codepage = name_to_codepage(name); + if (cv->codepage == 1200 || cv->codepage == 1201) + { + cv->mbtowc = utf16_mbtowc; + cv->wctomb = utf16_wctomb; + if (_stricmp(name, "UTF-16") == 0 || _stricmp(name, "UTF16") == 0 || + _stricmp(name, "UCS-2") == 0 || _stricmp(name, "UCS2") == 0) + cv->flags |= FLAG_USE_BOM; + } + else if (cv->codepage == 12000 || cv->codepage == 12001) + { + cv->mbtowc = utf32_mbtowc; + cv->wctomb = utf32_wctomb; + if (_stricmp(name, "UTF-32") == 0 || _stricmp(name, "UTF32") == 0 || + _stricmp(name, "UCS-4") == 0 || _stricmp(name, "UCS4") == 0) + cv->flags |= FLAG_USE_BOM; + } + else if (cv->codepage == 65001) + { + cv->mbtowc = kernel_mbtowc; + cv->wctomb = kernel_wctomb; + cv->mblen = utf8_mblen; + } + else if ((cv->codepage == 50220 || cv->codepage == 50221 || cv->codepage == 50222) && load_mlang()) + { + cv->mbtowc = iso2022jp_mbtowc; + cv->wctomb = iso2022jp_wctomb; + cv->flush = iso2022jp_flush; + } + else if (cv->codepage == 51932 && load_mlang()) + { + cv->mbtowc = mlang_mbtowc; + cv->wctomb = mlang_wctomb; + cv->mblen = eucjp_mblen; + } + else if (IsValidCodePage(cv->codepage) + && GetCPInfo(cv->codepage, &cpinfo) != 0) + { + cv->mbtowc = kernel_mbtowc; + cv->wctomb = kernel_wctomb; + if (cpinfo.MaxCharSize == 1) + cv->mblen = sbcs_mblen; + else if (cpinfo.MaxCharSize == 2) + cv->mblen = dbcs_mblen; + else + cv->mblen = mbcs_mblen; + } + else + { + /* not supported */ + free(name); + errno = EINVAL; + return FALSE; + } + + if (use_compat) + { + switch (cv->codepage) + { + case 932: cv->compat = cp932_compat; break; + case 20932: cv->compat = cp20932_compat; break; + case 51932: cv->compat = cp51932_compat; break; + case 50220: case 50221: case 50222: cv->compat = cp5022x_compat; break; + } + } + + free(name); + + return TRUE; +} + +static int +name_to_codepage(const char *name) +{ + int i; + + if (*name == '\0' || + strcmp(name, "char") == 0) + return GetACP(); + else if (strcmp(name, "wchar_t") == 0) + return 1200; + else if (_strnicmp(name, "cp", 2) == 0) + return atoi(name + 2); /* CP123 */ + else if ('0' <= name[0] && name[0] <= '9') + return atoi(name); /* 123 */ + else if (_strnicmp(name, "xx", 2) == 0) + return atoi(name + 2); /* XX123 for debug */ + + for (i = 0; codepage_alias[i].name != NULL; ++i) + if (_stricmp(name, codepage_alias[i].name) == 0) + return codepage_alias[i].codepage; + return -1; +} + +/* + * http://www.faqs.org/rfcs/rfc2781.html + */ +static uint +utf16_to_ucs4(const ushort *wbuf) +{ + uint wc = wbuf[0]; + if (0xD800 <= wbuf[0] && wbuf[0] <= 0xDBFF) + wc = ((wbuf[0] & 0x3FF) << 10) + (wbuf[1] & 0x3FF) + 0x10000; + return wc; +} + +static void +ucs4_to_utf16(uint wc, ushort *wbuf, int *wbufsize) +{ + if (wc < 0x10000) + { + wbuf[0] = wc; + *wbufsize = 1; + } + else + { + wc -= 0x10000; + wbuf[0] = 0xD800 | ((wc >> 10) & 0x3FF); + wbuf[1] = 0xDC00 | (wc & 0x3FF); + *wbufsize = 2; + } +} + +/* + * Check if codepage is one of those for which the dwFlags parameter + * to MultiByteToWideChar() must be zero. Return zero or + * MB_ERR_INVALID_CHARS. The docs in Platform SDK for for Windows + * Server 2003 R2 claims that also codepage 65001 is one of these, but + * that doesn't seem to be the case. The MSDN docs for MSVS2008 leave + * out 65001 (UTF-8), and that indeed seems to be the case on XP, it + * works fine to pass MB_ERR_INVALID_CHARS in dwFlags when converting + * from UTF-8. + */ +static int +mbtowc_flags(int codepage) +{ + return (codepage == 50220 || codepage == 50221 || + codepage == 50222 || codepage == 50225 || + codepage == 50227 || codepage == 50229 || + codepage == 52936 || codepage == 54936 || + (codepage >= 57002 && codepage <= 57011) || + codepage == 65000 || codepage == 42) ? 0 : MB_ERR_INVALID_CHARS; +} + +/* + * Check if codepage is one those for which the lpUsedDefaultChar + * parameter to WideCharToMultiByte() must be NULL. The docs in + * Platform SDK for for Windows Server 2003 R2 claims that this is the + * list below, while the MSDN docs for MSVS2008 claim that it is only + * for 65000 (UTF-7) and 65001 (UTF-8). This time the earlier Platform + * SDK seems to be correct, at least for XP. + */ +static int +must_use_null_useddefaultchar(int codepage) +{ + return (codepage == 65000 || codepage == 65001 || + codepage == 50220 || codepage == 50221 || + codepage == 50222 || codepage == 50225 || + codepage == 50227 || codepage == 50229 || + codepage == 52936 || codepage == 54936 || + (codepage >= 57002 && codepage <= 57011) || + codepage == 42); +} + +static char * +strrstr(const char *str, const char *token) +{ + int len = strlen(token); + const char *p = str + strlen(str); + + while (str <= --p) + if (p[0] == token[0] && strncmp(p, token, len) == 0) + return (char *)p; + return NULL; +} + +static char * +xstrndup(const char *s, size_t n) +{ + char *p; + + p = (char *)malloc(n + 1); + if (p == NULL) + return NULL; + memcpy(p, s, n); + p[n] = '\0'; + return p; +} + +static int +seterror(int err) +{ + errno = err; + return -1; +} + +#if defined(USE_LIBICONV_DLL) +static int +libiconv_iconv_open(rec_iconv_t *cd, const char *tocode, const char *fromcode) +{ + HMODULE hlibiconv = NULL; + HMODULE hmsvcrt = NULL; + char *dllname; + const char *p; + const char *e; + f_iconv_open _iconv_open; + + /* + * always try to load dll, so that we can switch dll in runtime. + */ + + /* XXX: getenv() can't get variable set by SetEnvironmentVariable() */ + p = getenv("WINICONV_LIBICONV_DLL"); + if (p == NULL) + p = DEFAULT_LIBICONV_DLL; + /* parse comma separated value */ + for ( ; *p != 0; p = (*e == ',') ? e + 1 : e) + { + e = strchr(p, ','); + if (p == e) + continue; + else if (e == NULL) + e = p + strlen(p); + dllname = xstrndup(p, e - p); + if (dllname == NULL) + return FALSE; + hlibiconv = LoadLibraryA(dllname); + free(dllname); + if (hlibiconv != NULL) + { + if (hlibiconv == hwiniconv) + { + FreeLibrary(hlibiconv); + hlibiconv = NULL; + continue; + } + break; + } + } + + if (hlibiconv == NULL) + goto failed; + + hmsvcrt = find_imported_module_by_funcname(hlibiconv, "_errno"); + if (hmsvcrt == NULL) + goto failed; + + _iconv_open = (f_iconv_open)GetProcAddressA(hlibiconv, "libiconv_open"); + if (_iconv_open == NULL) + _iconv_open = (f_iconv_open)GetProcAddressA(hlibiconv, "iconv_open"); + cd->iconv_close = (f_iconv_close)GetProcAddressA(hlibiconv, "libiconv_close"); + if (cd->iconv_close == NULL) + cd->iconv_close = (f_iconv_close)GetProcAddressA(hlibiconv, "iconv_close"); + cd->iconv = (f_iconv)GetProcAddressA(hlibiconv, "libiconv"); + if (cd->iconv == NULL) + cd->iconv = (f_iconv)GetProcAddressA(hlibiconv, "iconv"); + cd->_errno = (f_errno)GetProcAddressA(hmsvcrt, "_errno"); + if (_iconv_open == NULL || cd->iconv_close == NULL + || cd->iconv == NULL || cd->_errno == NULL) + goto failed; + + cd->cd = _iconv_open(tocode, fromcode); + if (cd->cd == (iconv_t)(-1)) + goto failed; + + cd->hlibiconv = hlibiconv; + return TRUE; + +failed: + if (hlibiconv != NULL) + FreeLibrary(hlibiconv); + /* do not free hmsvcrt which is obtained by GetModuleHandle() */ + return FALSE; +} + +/* + * Reference: + * http://forums.belution.com/ja/vc/000/234/78s.shtml + * http://nienie.com/~masapico/api_ImageDirectoryEntryToData.html + * + * The formal way is + * imagehlp.h or dbghelp.h + * imagehlp.lib or dbghelp.lib + * ImageDirectoryEntryToData() + */ +#define TO_DOS_HEADER(base) ((PIMAGE_DOS_HEADER)(base)) +#define TO_NT_HEADERS(base) ((PIMAGE_NT_HEADERS)((LPBYTE)(base) + TO_DOS_HEADER(base)->e_lfanew)) +static PVOID +MyImageDirectoryEntryToData(LPVOID Base, BOOLEAN MappedAsImage, USHORT DirectoryEntry, PULONG Size) +{ + /* TODO: MappedAsImage? */ + PIMAGE_DATA_DIRECTORY p; + p = TO_NT_HEADERS(Base)->OptionalHeader.DataDirectory + DirectoryEntry; + if (p->VirtualAddress == 0) { + *Size = 0; + return NULL; + } + *Size = p->Size; + return (PVOID)((LPBYTE)Base + p->VirtualAddress); +} + +static HMODULE +find_imported_module_by_funcname(HMODULE hModule, const char *funcname) +{ + DWORD_PTR Base; + ULONG Size; + PIMAGE_IMPORT_DESCRIPTOR Imp; + PIMAGE_THUNK_DATA Name; /* Import Name Table */ + PIMAGE_IMPORT_BY_NAME ImpName; + + Base = (DWORD_PTR)hModule; + Imp = (PIMAGE_IMPORT_DESCRIPTOR)MyImageDirectoryEntryToData( + (LPVOID)Base, + TRUE, + IMAGE_DIRECTORY_ENTRY_IMPORT, + &Size); + if (Imp == NULL) + return NULL; + for ( ; Imp->OriginalFirstThunk != 0; ++Imp) + { + Name = (PIMAGE_THUNK_DATA)(Base + Imp->OriginalFirstThunk); + for ( ; Name->u1.Ordinal != 0; ++Name) + { + if (!IMAGE_SNAP_BY_ORDINAL(Name->u1.Ordinal)) + { + ImpName = (PIMAGE_IMPORT_BY_NAME) + (Base + (DWORD_PTR)Name->u1.AddressOfData); + if (strcmp((char *)ImpName->Name, funcname) == 0) + return GetModuleHandleA((char *)(Base + Imp->Name)); + } + } + } + return NULL; +} +#endif + +static int +sbcs_mblen(csconv_t *cv UNUSED, const uchar *buf UNUSED, int bufsize UNUSED) +{ + return 1; +} + +static int +dbcs_mblen(csconv_t *cv, const uchar *buf, int bufsize) +{ + int len = IsDBCSLeadByteEx(cv->codepage, buf[0]) ? 2 : 1; + if (bufsize < len) + return seterror(EINVAL); + return len; +} + +static int +mbcs_mblen(csconv_t *cv, const uchar *buf, int bufsize) +{ + int len = 0; + + if (cv->codepage == 54936) { + if (buf[0] <= 0x7F) len = 1; + else if (buf[0] >= 0x81 && buf[0] <= 0xFE && + bufsize >= 2 && + ((buf[1] >= 0x40 && buf[1] <= 0x7E) || + (buf[1] >= 0x80 && buf[1] <= 0xFE))) len = 2; + else if (buf[0] >= 0x81 && buf[0] <= 0xFE && + bufsize >= 4 && + buf[1] >= 0x30 && buf[1] <= 0x39) len = 4; + else + return seterror(EINVAL); + return len; + } + else + return seterror(EINVAL); +} + +static int +utf8_mblen(csconv_t *cv UNUSED, const uchar *buf, int bufsize) +{ + int len = 0; + + if (buf[0] < 0x80) len = 1; + else if ((buf[0] & 0xE0) == 0xC0) len = 2; + else if ((buf[0] & 0xF0) == 0xE0) len = 3; + else if ((buf[0] & 0xF8) == 0xF0) len = 4; + else if ((buf[0] & 0xFC) == 0xF8) len = 5; + else if ((buf[0] & 0xFE) == 0xFC) len = 6; + + if (len == 0) + return seterror(EILSEQ); + else if (bufsize < len) + return seterror(EINVAL); + return len; +} + +static int +eucjp_mblen(csconv_t *cv UNUSED, const uchar *buf, int bufsize) +{ + if (buf[0] < 0x80) /* ASCII */ + return 1; + else if (buf[0] == 0x8E) /* JIS X 0201 */ + { + if (bufsize < 2) + return seterror(EINVAL); + else if (!(0xA1 <= buf[1] && buf[1] <= 0xDF)) + return seterror(EILSEQ); + return 2; + } + else if (buf[0] == 0x8F) /* JIS X 0212 */ + { + if (bufsize < 3) + return seterror(EINVAL); + else if (!(0xA1 <= buf[1] && buf[1] <= 0xFE) + || !(0xA1 <= buf[2] && buf[2] <= 0xFE)) + return seterror(EILSEQ); + return 3; + } + else /* JIS X 0208 */ + { + if (bufsize < 2) + return seterror(EINVAL); + else if (!(0xA1 <= buf[0] && buf[0] <= 0xFE) + || !(0xA1 <= buf[1] && buf[1] <= 0xFE)) + return seterror(EILSEQ); + return 2; + } +} + +static int +kernel_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize) +{ + int len; + + len = cv->mblen(cv, buf, bufsize); + if (len == -1) + return -1; + *wbufsize = MultiByteToWideChar(cv->codepage, mbtowc_flags (cv->codepage), + (const char *)buf, len, (wchar_t *)wbuf, *wbufsize); + if (*wbufsize == 0) + return seterror(EILSEQ); + return len; +} + +static int +kernel_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize) +{ + BOOL usedDefaultChar = 0; + BOOL *p = NULL; + int flags = 0; + int len; + + if (bufsize == 0) + return seterror(E2BIG); + if (!must_use_null_useddefaultchar(cv->codepage)) + { + p = &usedDefaultChar; +#ifdef WC_NO_BEST_FIT_CHARS + if (!(cv->flags & FLAG_TRANSLIT)) + flags |= WC_NO_BEST_FIT_CHARS; +#endif + } + len = WideCharToMultiByte(cv->codepage, flags, + (const wchar_t *)wbuf, wbufsize, (char *)buf, bufsize, NULL, p); + if (len == 0) + { + if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) + return seterror(E2BIG); + return seterror(EILSEQ); + } + else if (usedDefaultChar && !(cv->flags & FLAG_TRANSLIT)) + return seterror(EILSEQ); + else if (cv->mblen(cv, buf, len) != len) /* validate result */ + return seterror(EILSEQ); + return len; +} + +/* + * It seems that the mode (cv->mode) is fixnum. + * For example, when converting iso-2022-jp(cp50221) to unicode: + * in ascii sequence: mode=0xC42C0000 + * in jisx0208 sequence: mode=0xC42C0001 + * "C42C" is same for each convert session. + * It should be: ((codepage-1)<<16)|state + */ +static int +mlang_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize) +{ + int len; + int insize; + HRESULT hr; + + len = cv->mblen(cv, buf, bufsize); + if (len == -1) + return -1; + insize = len; + hr = ConvertINetMultiByteToUnicode(&cv->mode, cv->codepage, + (const char *)buf, &insize, (wchar_t *)wbuf, wbufsize); + if (hr != S_OK || insize != len) + return seterror(EILSEQ); + return len; +} + +static int +mlang_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize) +{ + char tmpbuf[MB_CHAR_MAX]; /* enough room for one character */ + int tmpsize = MB_CHAR_MAX; + int insize = wbufsize; + HRESULT hr; + + hr = ConvertINetUnicodeToMultiByte(&cv->mode, cv->codepage, + (const wchar_t *)wbuf, &wbufsize, tmpbuf, &tmpsize); + if (hr != S_OK || insize != wbufsize) + return seterror(EILSEQ); + else if (bufsize < tmpsize) + return seterror(E2BIG); + else if (cv->mblen(cv, (uchar *)tmpbuf, tmpsize) != tmpsize) + return seterror(EILSEQ); + memcpy(buf, tmpbuf, tmpsize); + return tmpsize; +} + +static int +utf16_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize) +{ + int codepage = cv->codepage; + + /* swap endian: 1200 <-> 1201 */ + if (cv->mode & UNICODE_MODE_SWAPPED) + codepage ^= 1; + + if (bufsize < 2) + return seterror(EINVAL); + if (codepage == 1200) /* little endian */ + wbuf[0] = (buf[1] << 8) | buf[0]; + else if (codepage == 1201) /* big endian */ + wbuf[0] = (buf[0] << 8) | buf[1]; + + if ((cv->flags & FLAG_USE_BOM) && !(cv->mode & UNICODE_MODE_BOM_DONE)) + { + cv->mode |= UNICODE_MODE_BOM_DONE; + if (wbuf[0] == 0xFFFE) + { + cv->mode |= UNICODE_MODE_SWAPPED; + *wbufsize = 0; + return 2; + } + else if (wbuf[0] == 0xFEFF) + { + *wbufsize = 0; + return 2; + } + } + + if (0xDC00 <= wbuf[0] && wbuf[0] <= 0xDFFF) + return seterror(EILSEQ); + if (0xD800 <= wbuf[0] && wbuf[0] <= 0xDBFF) + { + if (bufsize < 4) + return seterror(EINVAL); + if (codepage == 1200) /* little endian */ + wbuf[1] = (buf[3] << 8) | buf[2]; + else if (codepage == 1201) /* big endian */ + wbuf[1] = (buf[2] << 8) | buf[3]; + if (!(0xDC00 <= wbuf[1] && wbuf[1] <= 0xDFFF)) + return seterror(EILSEQ); + *wbufsize = 2; + return 4; + } + *wbufsize = 1; + return 2; +} + +static int +utf16_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize) +{ + if ((cv->flags & FLAG_USE_BOM) && !(cv->mode & UNICODE_MODE_BOM_DONE)) + { + int r; + + cv->mode |= UNICODE_MODE_BOM_DONE; + if (bufsize < 2) + return seterror(E2BIG); + if (cv->codepage == 1200) /* little endian */ + memcpy(buf, "\xFF\xFE", 2); + else if (cv->codepage == 1201) /* big endian */ + memcpy(buf, "\xFE\xFF", 2); + + r = utf16_wctomb(cv, wbuf, wbufsize, buf + 2, bufsize - 2); + if (r == -1) + return -1; + return r + 2; + } + + if (bufsize < 2) + return seterror(E2BIG); + if (cv->codepage == 1200) /* little endian */ + { + buf[0] = (wbuf[0] & 0x00FF); + buf[1] = (wbuf[0] & 0xFF00) >> 8; + } + else if (cv->codepage == 1201) /* big endian */ + { + buf[0] = (wbuf[0] & 0xFF00) >> 8; + buf[1] = (wbuf[0] & 0x00FF); + } + if (0xD800 <= wbuf[0] && wbuf[0] <= 0xDBFF) + { + if (bufsize < 4) + return seterror(E2BIG); + if (cv->codepage == 1200) /* little endian */ + { + buf[2] = (wbuf[1] & 0x00FF); + buf[3] = (wbuf[1] & 0xFF00) >> 8; + } + else if (cv->codepage == 1201) /* big endian */ + { + buf[2] = (wbuf[1] & 0xFF00) >> 8; + buf[3] = (wbuf[1] & 0x00FF); + } + return 4; + } + return 2; +} + +static int +utf32_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize) +{ + int codepage = cv->codepage; + uint wc; + + /* swap endian: 12000 <-> 12001 */ + if (cv->mode & UNICODE_MODE_SWAPPED) + codepage ^= 1; + + if (bufsize < 4) + return seterror(EINVAL); + if (codepage == 12000) /* little endian */ + wc = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; + else if (codepage == 12001) /* big endian */ + wc = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; + + if ((cv->flags & FLAG_USE_BOM) && !(cv->mode & UNICODE_MODE_BOM_DONE)) + { + cv->mode |= UNICODE_MODE_BOM_DONE; + if (wc == 0xFFFE0000) + { + cv->mode |= UNICODE_MODE_SWAPPED; + *wbufsize = 0; + return 4; + } + else if (wc == 0x0000FEFF) + { + *wbufsize = 0; + return 4; + } + } + + if ((0xD800 <= wc && wc <= 0xDFFF) || 0x10FFFF < wc) + return seterror(EILSEQ); + ucs4_to_utf16(wc, wbuf, wbufsize); + return 4; +} + +static int +utf32_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize) +{ + uint wc; + + if ((cv->flags & FLAG_USE_BOM) && !(cv->mode & UNICODE_MODE_BOM_DONE)) + { + int r; + + cv->mode |= UNICODE_MODE_BOM_DONE; + if (bufsize < 4) + return seterror(E2BIG); + if (cv->codepage == 12000) /* little endian */ + memcpy(buf, "\xFF\xFE\x00\x00", 4); + else if (cv->codepage == 12001) /* big endian */ + memcpy(buf, "\x00\x00\xFE\xFF", 4); + + r = utf32_wctomb(cv, wbuf, wbufsize, buf + 4, bufsize - 4); + if (r == -1) + return -1; + return r + 4; + } + + if (bufsize < 4) + return seterror(E2BIG); + wc = utf16_to_ucs4(wbuf); + if (cv->codepage == 12000) /* little endian */ + { + buf[0] = wc & 0x000000FF; + buf[1] = (wc & 0x0000FF00) >> 8; + buf[2] = (wc & 0x00FF0000) >> 16; + buf[3] = (wc & 0xFF000000) >> 24; + } + else if (cv->codepage == 12001) /* big endian */ + { + buf[0] = (wc & 0xFF000000) >> 24; + buf[1] = (wc & 0x00FF0000) >> 16; + buf[2] = (wc & 0x0000FF00) >> 8; + buf[3] = wc & 0x000000FF; + } + return 4; +} + +/* + * 50220: ISO 2022 Japanese with no halfwidth Katakana; Japanese (JIS) + * 50221: ISO 2022 Japanese with halfwidth Katakana; Japanese (JIS-Allow + * 1 byte Kana) + * 50222: ISO 2022 Japanese JIS X 0201-1989; Japanese (JIS-Allow 1 byte + * Kana - SO/SI) + * + * MultiByteToWideChar() and WideCharToMultiByte() behave differently + * depending on Windows version. On XP, WideCharToMultiByte() doesn't + * terminate result sequence with ascii escape. But Vista does. + * Use MLang instead. + */ + +#define ISO2022_MODE(cs, shift) (((cs) << 8) | (shift)) +#define ISO2022_MODE_CS(mode) (((mode) >> 8) & 0xFF) +#define ISO2022_MODE_SHIFT(mode) ((mode) & 0xFF) + +#define ISO2022_SI 0 +#define ISO2022_SO 1 + +/* shift in */ +static const char iso2022_SI_seq[] = "\x0F"; +/* shift out */ +static const char iso2022_SO_seq[] = "\x0E"; + +typedef struct iso2022_esc_t iso2022_esc_t; +struct iso2022_esc_t { + const char *esc; + int esc_len; + int len; + int cs; +}; + +#define ISO2022JP_CS_ASCII 0 +#define ISO2022JP_CS_JISX0201_ROMAN 1 +#define ISO2022JP_CS_JISX0201_KANA 2 +#define ISO2022JP_CS_JISX0208_1978 3 +#define ISO2022JP_CS_JISX0208_1983 4 +#define ISO2022JP_CS_JISX0212 5 + +static iso2022_esc_t iso2022jp_esc[] = { + {"\x1B\x28\x42", 3, 1, ISO2022JP_CS_ASCII}, + {"\x1B\x28\x4A", 3, 1, ISO2022JP_CS_JISX0201_ROMAN}, + {"\x1B\x28\x49", 3, 1, ISO2022JP_CS_JISX0201_KANA}, + {"\x1B\x24\x40", 3, 2, ISO2022JP_CS_JISX0208_1983}, /* unify 1978 with 1983 */ + {"\x1B\x24\x42", 3, 2, ISO2022JP_CS_JISX0208_1983}, + {"\x1B\x24\x28\x44", 4, 2, ISO2022JP_CS_JISX0212}, + {NULL, 0, 0, 0} +}; + +static int +iso2022jp_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize) +{ + iso2022_esc_t *iesc = iso2022jp_esc; + char tmp[MB_CHAR_MAX]; + int insize; + HRESULT hr; + DWORD dummy = 0; + int len; + int esc_len; + int cs; + int shift; + int i; + + if (buf[0] == 0x1B) + { + for (i = 0; iesc[i].esc != NULL; ++i) + { + esc_len = iesc[i].esc_len; + if (bufsize < esc_len) + { + if (strncmp((char *)buf, iesc[i].esc, bufsize) == 0) + return seterror(EINVAL); + } + else + { + if (strncmp((char *)buf, iesc[i].esc, esc_len) == 0) + { + cv->mode = ISO2022_MODE(iesc[i].cs, ISO2022_SI); + *wbufsize = 0; + return esc_len; + } + } + } + /* not supported escape sequence */ + return seterror(EILSEQ); + } + else if (buf[0] == iso2022_SO_seq[0]) + { + cv->mode = ISO2022_MODE(ISO2022_MODE_CS(cv->mode), ISO2022_SO); + *wbufsize = 0; + return 1; + } + else if (buf[0] == iso2022_SI_seq[0]) + { + cv->mode = ISO2022_MODE(ISO2022_MODE_CS(cv->mode), ISO2022_SI); + *wbufsize = 0; + return 1; + } + + cs = ISO2022_MODE_CS(cv->mode); + shift = ISO2022_MODE_SHIFT(cv->mode); + + /* reset the mode for informal sequence */ + if (buf[0] < 0x20) + { + cs = ISO2022JP_CS_ASCII; + shift = ISO2022_SI; + } + + len = iesc[cs].len; + if (bufsize < len) + return seterror(EINVAL); + for (i = 0; i < len; ++i) + if (!(buf[i] < 0x80)) + return seterror(EILSEQ); + esc_len = iesc[cs].esc_len; + memcpy(tmp, iesc[cs].esc, esc_len); + if (shift == ISO2022_SO) + { + memcpy(tmp + esc_len, iso2022_SO_seq, 1); + esc_len += 1; + } + memcpy(tmp + esc_len, buf, len); + + if ((cv->codepage == 50220 || cv->codepage == 50221 + || cv->codepage == 50222) && shift == ISO2022_SO) + { + /* XXX: shift-out cannot be used for mbtowc (both kernel and + * mlang) */ + esc_len = iesc[ISO2022JP_CS_JISX0201_KANA].esc_len; + memcpy(tmp, iesc[ISO2022JP_CS_JISX0201_KANA].esc, esc_len); + memcpy(tmp + esc_len, buf, len); + } + + insize = len + esc_len; + hr = ConvertINetMultiByteToUnicode(&dummy, cv->codepage, + (const char *)tmp, &insize, (wchar_t *)wbuf, wbufsize); + if (hr != S_OK || insize != len + esc_len) + return seterror(EILSEQ); + + /* Check for conversion error. Assuming defaultChar is 0x3F. */ + /* ascii should be converted from ascii */ + if (wbuf[0] == buf[0] + && cv->mode != ISO2022_MODE(ISO2022JP_CS_ASCII, ISO2022_SI)) + return seterror(EILSEQ); + + /* reset the mode for informal sequence */ + if (cv->mode != ISO2022_MODE(cs, shift)) + cv->mode = ISO2022_MODE(cs, shift); + + return len; +} + +static int +iso2022jp_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize) +{ + iso2022_esc_t *iesc = iso2022jp_esc; + char tmp[MB_CHAR_MAX]; + int tmpsize = MB_CHAR_MAX; + int insize = wbufsize; + HRESULT hr; + DWORD dummy = 0; + int len; + int esc_len; + int cs; + int shift; + int i; + + /* + * MultiByte = [escape sequence] + character + [escape sequence] + * + * Whether trailing escape sequence is added depends on which API is + * used (kernel or MLang, and its version). + */ + hr = ConvertINetUnicodeToMultiByte(&dummy, cv->codepage, + (const wchar_t *)wbuf, &wbufsize, tmp, &tmpsize); + if (hr != S_OK || insize != wbufsize) + return seterror(EILSEQ); + else if (bufsize < tmpsize) + return seterror(E2BIG); + + if (tmpsize == 1) + { + cs = ISO2022JP_CS_ASCII; + esc_len = 0; + } + else + { + for (i = 1; iesc[i].esc != NULL; ++i) + { + esc_len = iesc[i].esc_len; + if (strncmp(tmp, iesc[i].esc, esc_len) == 0) + { + cs = iesc[i].cs; + break; + } + } + if (iesc[i].esc == NULL) + /* not supported escape sequence */ + return seterror(EILSEQ); + } + + shift = ISO2022_SI; + if (tmp[esc_len] == iso2022_SO_seq[0]) + { + shift = ISO2022_SO; + esc_len += 1; + } + + len = iesc[cs].len; + + /* Check for converting error. Assuming defaultChar is 0x3F. */ + /* ascii should be converted from ascii */ + if (cs == ISO2022JP_CS_ASCII && !(wbuf[0] < 0x80)) + return seterror(EILSEQ); + else if (tmpsize < esc_len + len) + return seterror(EILSEQ); + + if (cv->mode == ISO2022_MODE(cs, shift)) + { + /* remove escape sequence */ + if (esc_len != 0) + memmove(tmp, tmp + esc_len, len); + esc_len = 0; + } + else + { + if (cs == ISO2022JP_CS_ASCII) + { + esc_len = iesc[ISO2022JP_CS_ASCII].esc_len; + memmove(tmp + esc_len, tmp, len); + memcpy(tmp, iesc[ISO2022JP_CS_ASCII].esc, esc_len); + } + if (ISO2022_MODE_SHIFT(cv->mode) == ISO2022_SO) + { + /* shift-in before changing to other mode */ + memmove(tmp + 1, tmp, len + esc_len); + memcpy(tmp, iso2022_SI_seq, 1); + esc_len += 1; + } + } + + if (bufsize < len + esc_len) + return seterror(E2BIG); + memcpy(buf, tmp, len + esc_len); + cv->mode = ISO2022_MODE(cs, shift); + return len + esc_len; +} + +static int +iso2022jp_flush(csconv_t *cv, uchar *buf, int bufsize) +{ + iso2022_esc_t *iesc = iso2022jp_esc; + int esc_len; + + if (cv->mode != ISO2022_MODE(ISO2022JP_CS_ASCII, ISO2022_SI)) + { + esc_len = 0; + if (ISO2022_MODE_SHIFT(cv->mode) != ISO2022_SI) + esc_len += 1; + if (ISO2022_MODE_CS(cv->mode) != ISO2022JP_CS_ASCII) + esc_len += iesc[ISO2022JP_CS_ASCII].esc_len; + if (bufsize < esc_len) + return seterror(E2BIG); + + esc_len = 0; + if (ISO2022_MODE_SHIFT(cv->mode) != ISO2022_SI) + { + memcpy(buf, iso2022_SI_seq, 1); + esc_len += 1; + } + if (ISO2022_MODE_CS(cv->mode) != ISO2022JP_CS_ASCII) + { + memcpy(buf + esc_len, iesc[ISO2022JP_CS_ASCII].esc, + iesc[ISO2022JP_CS_ASCII].esc_len); + esc_len += iesc[ISO2022JP_CS_ASCII].esc_len; + } + return esc_len; + } + return 0; +} + +#if defined(MAKE_DLL) && defined(USE_LIBICONV_DLL) +BOOL WINAPI +DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) +{ + switch( fdwReason ) + { + case DLL_PROCESS_ATTACH: + hwiniconv = (HMODULE)hinstDLL; + break; + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} +#endif + +#if defined(MAKE_EXE) +#include +#include +#include +int +main(int argc, char **argv) +{ + char *fromcode = NULL; + char *tocode = NULL; + int i; + char inbuf[BUFSIZ]; + char outbuf[BUFSIZ]; + const char *pin; + char *pout; + size_t inbytesleft; + size_t outbytesleft; + size_t rest = 0; + iconv_t cd; + size_t r; + FILE *in = stdin; + FILE *out = stdout; + int ignore = 0; + char *p; + + _setmode(_fileno(stdin), _O_BINARY); + _setmode(_fileno(stdout), _O_BINARY); + + for (i = 1; i < argc; ++i) + { + if (strcmp(argv[i], "-l") == 0) + { + for (i = 0; codepage_alias[i].name != NULL; ++i) + printf("%s\n", codepage_alias[i].name); + return 0; + } + + if (strcmp(argv[i], "-f") == 0) + fromcode = argv[++i]; + else if (strcmp(argv[i], "-t") == 0) + tocode = argv[++i]; + else if (strcmp(argv[i], "-c") == 0) + ignore = 1; + else if (strcmp(argv[i], "--output") == 0) + { + out = fopen(argv[++i], "wb"); + if(out == NULL) + { + fprintf(stderr, "cannot open %s\n", argv[i]); + return 1; + } + } + else + { + in = fopen(argv[i], "rb"); + if (in == NULL) + { + fprintf(stderr, "cannot open %s\n", argv[i]); + return 1; + } + break; + } + } + + if (fromcode == NULL || tocode == NULL) + { + printf("usage: %s [-c] -f from-enc -t to-enc [file]\n", argv[0]); + return 0; + } + + if (ignore) + { + p = tocode; + tocode = (char *)malloc(strlen(p) + strlen("//IGNORE") + 1); + if (tocode == NULL) + { + perror("fatal error"); + return 1; + } + strcpy(tocode, p); + strcat(tocode, "//IGNORE"); + } + + cd = iconv_open(tocode, fromcode); + if (cd == (iconv_t)(-1)) + { + perror("iconv_open error"); + return 1; + } + + while ((inbytesleft = fread(inbuf + rest, 1, sizeof(inbuf) - rest, in)) != 0 + || rest != 0) + { + inbytesleft += rest; + pin = inbuf; + pout = outbuf; + outbytesleft = sizeof(outbuf); + r = iconv(cd, &pin, &inbytesleft, &pout, &outbytesleft); + fwrite(outbuf, 1, sizeof(outbuf) - outbytesleft, out); + if (r == (size_t)(-1) && errno != E2BIG && (errno != EINVAL || feof(in))) + { + perror("conversion error"); + return 1; + } + memmove(inbuf, pin, inbytesleft); + rest = inbytesleft; + } + pout = outbuf; + outbytesleft = sizeof(outbuf); + r = iconv(cd, NULL, NULL, &pout, &outbytesleft); + fwrite(outbuf, 1, sizeof(outbuf) - outbytesleft, out); + if (r == (size_t)(-1)) + { + perror("conversion error"); + return 1; + } + + iconv_close(cd); + + return 0; +} +#endif + diff --git a/reactos/lib/3rdparty/libwin-iconv/win_iconv_test.c b/reactos/lib/3rdparty/libwin-iconv/win_iconv_test.c new file mode 100644 index 00000000000..99a4bfc0939 --- /dev/null +++ b/reactos/lib/3rdparty/libwin-iconv/win_iconv_test.c @@ -0,0 +1,286 @@ + +#ifdef USE_ICONV_H +#include +#include +#include +#include +#include +#else +#include "win_iconv.c" +#endif + +#include + +const char * +tohex(const char *str, int size) +{ + static char buf[BUFSIZ]; + char *pbuf = buf; + int i; + buf[0] = 0; + for (i = 0; i < size; ++i) + pbuf += sprintf(pbuf, "%02X", str[i] & 0xFF); + return buf; +} + +const char * +errstr(int errcode) +{ + static char buf[BUFSIZ]; + switch (errcode) + { + case 0: return "NOERROR"; + case EINVAL: return "EINVAL"; + case EILSEQ: return "EILSEQ"; + case E2BIG: return "E2BIG"; + } + sprintf(buf, "%d\n", errcode); + return buf; +} + +#ifdef USE_LIBICONV_DLL +int use_dll; + +int +setdll(const char *dllpath) +{ + char buf[BUFSIZ]; + rec_iconv_t cd; + + sprintf(buf, "WINICONV_LIBICONV_DLL=%s", dllpath); + putenv(buf); + if (libiconv_iconv_open(&cd, "ascii", "ascii")) + { + FreeLibrary(cd.hlibiconv); + use_dll = TRUE; + return TRUE; + } + use_dll = FALSE; + return FALSE; +} +#endif + +/* + * We can test the codepage that is installed in the system. + */ +int +check_enc(const char *encname, int codepage) +{ + iconv_t cd; + int cp; + cd = iconv_open("utf-8", encname); + if (cd == (iconv_t)(-1)) + { + printf("%s(%d) IS NOT SUPPORTED: SKIP THE TEST\n", encname, codepage); + return FALSE; + } +#ifndef USE_ICONV_H + cp = ((rec_iconv_t *)cd)->from.codepage; + if (cp != codepage) + { + printf("%s(%d) ALIAS IS MAPPED TO DIFFERENT CODEPAGE (%d)\n", encname, codepage, cp); + exit(1); + } +#endif + iconv_close(cd); + return TRUE; +} + +void +test(const char *from, const char *fromstr, int fromsize, const char *to, const char *tostr, int tosize, int errcode, int bufsize, int line) +{ + char outbuf[BUFSIZ]; + const char *pin; + char *pout; + size_t inbytesleft; + size_t outbytesleft; + iconv_t cd; + size_t r; +#ifdef USE_LIBICONV_DLL + char dllpath[_MAX_PATH]; +#endif + + cd = iconv_open(to, from); + if (cd == (iconv_t)(-1)) + { + printf("%s -> %s: NG: INVALID ENCODING NAME: line=%d\n", from, to, line); + exit(1); + } + +#ifdef USE_LIBICONV_DLL + if (((rec_iconv_t *)cd)->hlibiconv != NULL) + GetModuleFileNameA(((rec_iconv_t *)cd)->hlibiconv, dllpath, sizeof(dllpath)); + + if (use_dll && ((rec_iconv_t *)cd)->hlibiconv == NULL) + { + printf("%s: %s -> %s: NG: FAILED TO USE DLL: line=%d\n", dllpath, from, to, line); + exit(1); + } + else if (!use_dll && ((rec_iconv_t *)cd)->hlibiconv != NULL) + { + printf("%s: %s -> %s: NG: DLL IS LOADED UNEXPECTEDLY: line=%d\n", dllpath, from, to, line); + exit(1); + } +#endif + + errno = 0; + + pin = (char *)fromstr; + pout = outbuf; + inbytesleft = fromsize; + outbytesleft = bufsize; + r = iconv(cd, &pin, &inbytesleft, &pout, &outbytesleft); + if (r != (size_t)(-1)) + r = iconv(cd, NULL, NULL, &pout, &outbytesleft); + *pout = 0; + +#ifdef USE_LIBICONV_DLL + if (use_dll) + printf("%s: ", dllpath); +#endif + printf("%s(%s) -> ", from, tohex(fromstr, fromsize)); + printf("%s(%s%s%s): ", to, tohex(tostr, tosize), + errcode == 0 ? "" : ":", + errcode == 0 ? "" : errstr(errcode)); + if (strcmp(outbuf, tostr) == 0 && errno == errcode) + printf("OK\n"); + else + { + printf("RESULT(%s:%s): ", tohex(outbuf, sizeof(outbuf) - outbytesleft), + errstr(errno)); + printf("NG: line=%d\n", line); + exit(1); + } +} + +#define STATIC_STRLEN(arr) (sizeof(arr) - 1) + +#define success(from, fromstr, to, tostr) test(from, fromstr, STATIC_STRLEN(fromstr), to, tostr, STATIC_STRLEN(tostr), 0, BUFSIZ, __LINE__) +#define einval(from, fromstr, to, tostr) test(from, fromstr, STATIC_STRLEN(fromstr), to, tostr, STATIC_STRLEN(tostr), EINVAL, BUFSIZ, __LINE__) +#define eilseq(from, fromstr, to, tostr) test(from, fromstr, STATIC_STRLEN(fromstr), to, tostr, STATIC_STRLEN(tostr), EILSEQ, BUFSIZ, __LINE__) +#define e2big(from, fromstr, to, tostr, bufsize) test(from, fromstr, STATIC_STRLEN(fromstr), to, tostr, STATIC_STRLEN(tostr), E2BIG, bufsize, __LINE__) + +int +main(int argc, char **argv) +{ +#ifdef USE_LIBICONV_DLL + /* test use of dll if $DEFAULT_LIBICONV_DLL was defined. */ + if (setdll("")) + { + success("ascii", "ABC", "ascii", "ABC"); + success("ascii", "ABC", "utf-16be", "\x00\x41\x00\x42\x00\x43"); + } + else + { + printf("\nDLL TEST IS SKIPPED\n\n"); + } + + setdll("none"); +#endif + + if (check_enc("ascii", 20127)) + { + success("ascii", "ABC", "ascii", "ABC"); + /* MSB is dropped. Hmm... */ + success("ascii", "\x80\xFF", "ascii", "\x00\x7F"); + } + + /* unicode (CP1200 CP1201 CP12000 CP12001 CP65001) */ + if (check_enc("utf-8", 65001) + && check_enc("utf-16be", 1201) && check_enc("utf-16le", 1200) + && check_enc("utf-32be", 12001) && check_enc("utf-32le", 12000) + ) + { + /* Test the BOM behavior + * 1. Remove the BOM when "fromcode" is utf-16 or utf-32. + * 2. Add the BOM when "tocode" is utf-16 or utf-32. */ + success("utf-16", "\xFE\xFF\x01\x02", "utf-16be", "\x01\x02"); + success("utf-16", "\xFF\xFE\x02\x01", "utf-16be", "\x01\x02"); + success("utf-32", "\x00\x00\xFE\xFF\x00\x00\x01\x02", "utf-32be", "\x00\x00\x01\x02"); + success("utf-32", "\xFF\xFE\x00\x00\x02\x01\x00\x00", "utf-32be", "\x00\x00\x01\x02"); + success("utf-16", "\xFE\xFF\x00\x01", "utf-8", "\x01"); +#ifndef GLIB_COMPILATION + success("utf-8", "\x01", "utf-16", "\xFE\xFF\x00\x01"); + success("utf-8", "\x01", "utf-32", "\x00\x00\xFE\xFF\x00\x00\x00\x01"); +#else + success("utf-8", "\x01", "utf-16", "\xFF\xFE\x01\x00"); + success("utf-8", "\x01", "utf-32", "\xFF\xFE\x00\x00\x01\x00\x00\x00"); +#endif + + success("utf-16be", "\xFE\xFF\x01\x02", "utf-16be", "\xFE\xFF\x01\x02"); + success("utf-16le", "\xFF\xFE\x02\x01", "utf-16be", "\xFE\xFF\x01\x02"); + success("utf-32be", "\x00\x00\xFE\xFF\x00\x00\x01\x02", "utf-32be", "\x00\x00\xFE\xFF\x00\x00\x01\x02"); + success("utf-32le", "\xFF\xFE\x00\x00\x02\x01\x00\x00", "utf-32be", "\x00\x00\xFE\xFF\x00\x00\x01\x02"); + success("utf-16be", "\xFE\xFF\x00\x01", "utf-8", "\xEF\xBB\xBF\x01"); + success("utf-8", "\xEF\xBB\xBF\x01", "utf-8", "\xEF\xBB\xBF\x01"); + + success("utf-16be", "\x01\x02", "utf-16le", "\x02\x01"); + success("utf-16le", "\x02\x01", "utf-16be", "\x01\x02"); + success("utf-16be", "\xFE\xFF", "utf-16le", "\xFF\xFE"); + success("utf-16le", "\xFF\xFE", "utf-16be", "\xFE\xFF"); + success("utf-32be", "\x00\x00\x03\x04", "utf-32le", "\x04\x03\x00\x00"); + success("utf-32le", "\x04\x03\x00\x00", "utf-32be", "\x00\x00\x03\x04"); + success("utf-32be", "\x00\x00\xFF\xFF", "utf-16be", "\xFF\xFF"); + success("utf-16be", "\xFF\xFF", "utf-32be", "\x00\x00\xFF\xFF"); + success("utf-32be", "\x00\x01\x00\x00", "utf-16be", "\xD8\x00\xDC\x00"); + success("utf-16be", "\xD8\x00\xDC\x00", "utf-32be", "\x00\x01\x00\x00"); + success("utf-32be", "\x00\x10\xFF\xFF", "utf-16be", "\xDB\xFF\xDF\xFF"); + success("utf-16be", "\xDB\xFF\xDF\xFF", "utf-32be", "\x00\x10\xFF\xFF"); + eilseq("utf-32be", "\x00\x11\x00\x00", "utf-16be", ""); + eilseq("utf-16be", "\xDB\xFF\xE0\x00", "utf-32be", ""); + success("utf-8", "\xE3\x81\x82", "utf-16be", "\x30\x42"); + einval("utf-8", "\xE3", "utf-16be", ""); + } + + /* Japanese (CP932 CP20932 CP50220 CP50221 CP50222 CP51932) */ + if (check_enc("cp932", 932) + && check_enc("cp20932", 20932) && check_enc("euc-jp", 51932) + && check_enc("cp50220", 50220) && check_enc("cp50221", 50221) + && check_enc("cp50222", 50222) && check_enc("iso-2022-jp", 50221)) + { + /* Test the compatibility for each other Japanese codepage. + * And validate the escape sequence handling for iso-2022-jp. */ + success("utf-16be", "\xFF\x5E", "cp932", "\x81\x60"); + success("utf-16be", "\x30\x1C", "cp932", "\x81\x60"); + success("utf-16be", "\xFF\x5E", "cp932//nocompat", "\x81\x60"); + eilseq("utf-16be", "\x30\x1C", "cp932//nocompat", ""); + success("euc-jp", "\xA4\xA2", "utf-16be", "\x30\x42"); + einval("euc-jp", "\xA4\xA2\xA4", "utf-16be", "\x30\x42"); + eilseq("euc-jp", "\xA4\xA2\xFF\xFF", "utf-16be", "\x30\x42"); + success("cp932", "\x81\x60", "iso-2022-jp", "\x1B\x24\x42\x21\x41\x1B\x28\x42"); + success("UTF-16BE", "\xFF\x5E", "iso-2022-jp", "\x1B\x24\x42\x21\x41\x1B\x28\x42"); + eilseq("UTF-16BE", "\x30\x1C", "iso-2022-jp//nocompat", ""); + success("UTF-16BE", "\x30\x42\x30\x44", "iso-2022-jp", "\x1B\x24\x42\x24\x22\x24\x24\x1B\x28\x42"); + success("iso-2022-jp", "\x1B\x24\x42\x21\x41\x1B\x28\x42", "UTF-16BE", "\xFF\x5E"); + } + + /* + * test for //translit + * U+FF41 (FULLWIDTH LATIN SMALL LETTER A) <-> U+0062 (LATIN SMALL LETTER A) + */ + eilseq("UTF-16BE", "\xFF\x41", "iso-8859-1", ""); + success("UTF-16BE", "\xFF\x41", "iso-8859-1//translit", "a"); + + /* + * test for //translit + * Some character, not in "to" encoding -> DEFAULT CHARACTER (maybe "?") + */ + eilseq("UTF-16BE", "\x30\x42", "ascii", ""); + success("UTF-16BE", "\x30\x42", "ascii//translit", "?"); + + /* + * test for //ignore + */ + eilseq("UTF-8", "\xFF A \xFF B", "ascii//ignore", " A B"); + eilseq("UTF-8", "\xEF\xBC\xA1 A \xEF\xBC\xA2 B", "ascii//ignore", " A B"); + eilseq("UTF-8", "\xEF\x01 A \xEF\x02 B", "ascii//ignore", "\x01 A \x02 B"); + + /* + * TODO: + * Test for state after iconv() failed. + * Ensure iconv() error is safe and continuable. + */ + + return 0; +} + diff --git a/reactos/lib/3rdparty/libxml2/CMakeLists.txt b/reactos/lib/3rdparty/libxml2/CMakeLists.txt index af789cb429b..a983a3659d8 100644 --- a/reactos/lib/3rdparty/libxml2/CMakeLists.txt +++ b/reactos/lib/3rdparty/libxml2/CMakeLists.txt @@ -1,5 +1,7 @@ -include_directories(include) +include_directories( + include + ${REACTOS_SOURCE_DIR}/lib/3rdparty/libwin-iconv) add_definitions( -D__MINGW32__ @@ -10,6 +12,8 @@ add_definitions( -D_WINDOWS -DWIN32 -DHAVE_CONFIG_H + -DLIBXML_ICONV_ENABLED + -DICONV_CONST=const -D_DLL -D__USE_CRTIMP) list(APPEND SOURCE diff --git a/reactos/media/doc/3rd Party Files.txt b/reactos/media/doc/3rd Party Files.txt index 180dd48a0b0..e22f8b4c4e3 100644 --- a/reactos/media/doc/3rd Party Files.txt +++ b/reactos/media/doc/3rd Party Files.txt @@ -61,3 +61,7 @@ Website: http://www.mpg123.de/ Title: STLport Used Version: 5.2.1 Website: http://stlport.sourceforge.net/ + +Title: win-iconv +Used Version: r44 +Website: https://code.google.com/p/win-iconv/ From 41202d274f63ecca8ebd3f5c2e321c65f6550e43 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Wed, 5 Mar 2014 11:39:15 +0000 Subject: [PATCH 061/113] [CMAKE] * User the proper target var name. CORE-7959 svn path=/trunk/; revision=62424 --- reactos/cmake/CMakeMacros.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reactos/cmake/CMakeMacros.cmake b/reactos/cmake/CMakeMacros.cmake index 1229654bab5..f22723bbbef 100644 --- a/reactos/cmake/CMakeMacros.cmake +++ b/reactos/cmake/CMakeMacros.cmake @@ -460,11 +460,11 @@ function(set_module_type MODULE TYPE) # Handle hotpatchable images. # GCC has this as a function attribute so we're handling it using DECLSPEC_HOTPATCH if(__module_HOTPATCHABLE AND MSVC) - set_property(TARGET ${_target} APPEND_STRING PROPERTY COMPILE_FLAGS " /hotpatch") + set_property(TARGET ${MODULE} APPEND_STRING PROPERTY COMPILE_FLAGS " /hotpatch") if(ARCH STREQUAL "i386") - set_property(TARGET ${_target} APPEND_STRING PROPERTY LINK_FLAGS " /FUNCTIONPADMIN:5") + set_property(TARGET ${MODULE} APPEND_STRING PROPERTY LINK_FLAGS " /FUNCTIONPADMIN:5") elseif(ARCH STREQUAL "amd64") - set_property(TARGET ${_target} APPEND_STRING PROPERTY LINK_FLAGS " /FUNCTIONPADMIN:6") + set_property(TARGET ${MODULE} APPEND_STRING PROPERTY LINK_FLAGS " /FUNCTIONPADMIN:6") endif() endif() From 4e25055d9149ac19b2452fa5a2216d016c741d00 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Wed, 5 Mar 2014 11:45:39 +0000 Subject: [PATCH 062/113] [KERNEL32] * Mark as hotpatchable. CORE-7959 svn path=/trunk/; revision=62425 --- reactos/dll/win32/kernel32/CMakeLists.txt | 2 +- reactos/dll/win32/kernel32/client/loader.c | 10 +++++++++- reactos/dll/win32/kernel32/client/proc.c | 2 ++ reactos/dll/win32/kernel32/client/synch.c | 18 ++++++++++++++++++ reactos/dll/win32/kernel32/client/thread.c | 1 + 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/reactos/dll/win32/kernel32/CMakeLists.txt b/reactos/dll/win32/kernel32/CMakeLists.txt index 35a3707dcb2..04982904dfa 100644 --- a/reactos/dll/win32/kernel32/CMakeLists.txt +++ b/reactos/dll/win32/kernel32/CMakeLists.txt @@ -99,7 +99,7 @@ add_library(kernel32 SHARED kernel32.rc ${CMAKE_CURRENT_BINARY_DIR}/kernel32.def) -set_module_type(kernel32 win32dll ENTRYPOINT DllMain 12) +set_module_type(kernel32 win32dll HOTPATCHABLE ENTRYPOINT DllMain 12) ############################################# ## HACK FOR MSVC COMPILATION WITH win32dll ## set_subsystem(kernel32 console) diff --git a/reactos/dll/win32/kernel32/client/loader.c b/reactos/dll/win32/kernel32/client/loader.c index d2dfce9a623..4f33ff775cc 100644 --- a/reactos/dll/win32/kernel32/client/loader.c +++ b/reactos/dll/win32/kernel32/client/loader.c @@ -107,6 +107,7 @@ DisableThreadLibraryCalls( */ HINSTANCE WINAPI +DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName) { LPSTR PathBuffer; @@ -152,6 +153,7 @@ LoadLibraryA(LPCSTR lpLibFileName) */ HINSTANCE WINAPI +DECLSPEC_HOTPATCH LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags) @@ -171,6 +173,7 @@ LoadLibraryExA(LPCSTR lpLibFileName, */ HINSTANCE WINAPI +DECLSPEC_HOTPATCH LoadLibraryW(LPCWSTR lpLibFileName) { /* Call Ex version of the API */ @@ -279,6 +282,7 @@ BasepLoadLibraryAsDatafile(PWSTR Path, LPCWSTR Name, HMODULE *hModule) */ HINSTANCE WINAPI +DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags) @@ -447,7 +451,10 @@ GetProcAddress(HMODULE hModule, LPCSTR lpProcName) /* * @implemented */ -BOOL WINAPI FreeLibrary(HINSTANCE hLibModule) +BOOL +WINAPI +DECLSPEC_HOTPATCH +FreeLibrary(HINSTANCE hLibModule) { NTSTATUS Status; PIMAGE_NT_HEADERS NtHeaders; @@ -806,6 +813,7 @@ quickie: */ HMODULE WINAPI +DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName) { PUNICODE_STRING ModuleNameW; diff --git a/reactos/dll/win32/kernel32/client/proc.c b/reactos/dll/win32/kernel32/client/proc.c index 6c44e99069a..3725e27e273 100644 --- a/reactos/dll/win32/kernel32/client/proc.c +++ b/reactos/dll/win32/kernel32/client/proc.c @@ -4605,6 +4605,7 @@ Quickie: */ BOOL WINAPI +DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, @@ -4773,6 +4774,7 @@ CreateProcessInternalA(HANDLE hToken, */ BOOL WINAPI +DECLSPEC_HOTPATCH CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, diff --git a/reactos/dll/win32/kernel32/client/synch.c b/reactos/dll/win32/kernel32/client/synch.c index 629e23adeca..4c51449e491 100644 --- a/reactos/dll/win32/kernel32/client/synch.c +++ b/reactos/dll/win32/kernel32/client/synch.c @@ -426,6 +426,7 @@ CancelWaitableTimer(IN HANDLE hTimer) */ HANDLE WINAPI +DECLSPEC_HOTPATCH CreateSemaphoreA(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, @@ -439,6 +440,7 @@ CreateSemaphoreA(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, */ HANDLE WINAPI +DECLSPEC_HOTPATCH CreateSemaphoreW(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, @@ -456,6 +458,7 @@ CreateSemaphoreW(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, */ HANDLE WINAPI +DECLSPEC_HOTPATCH OpenSemaphoreA(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCSTR lpName) @@ -468,6 +471,7 @@ OpenSemaphoreA(IN DWORD dwDesiredAccess, */ HANDLE WINAPI +DECLSPEC_HOTPATCH OpenSemaphoreW(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName) @@ -480,6 +484,7 @@ OpenSemaphoreW(IN DWORD dwDesiredAccess, */ BOOL WINAPI +DECLSPEC_HOTPATCH ReleaseSemaphore(IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount) @@ -500,6 +505,7 @@ ReleaseSemaphore(IN HANDLE hSemaphore, */ HANDLE WINAPI +DECLSPEC_HOTPATCH CreateMutexA(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCSTR lpName OPTIONAL) @@ -512,6 +518,7 @@ CreateMutexA(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, */ HANDLE WINAPI +DECLSPEC_HOTPATCH CreateMutexW(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCWSTR lpName OPTIONAL) @@ -527,6 +534,7 @@ CreateMutexW(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, */ HANDLE WINAPI +DECLSPEC_HOTPATCH OpenMutexA(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCSTR lpName) @@ -539,6 +547,7 @@ OpenMutexA(IN DWORD dwDesiredAccess, */ HANDLE WINAPI +DECLSPEC_HOTPATCH OpenMutexW(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName) @@ -551,6 +560,7 @@ OpenMutexW(IN DWORD dwDesiredAccess, */ BOOL WINAPI +DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex) { NTSTATUS Status; @@ -569,6 +579,7 @@ ReleaseMutex(IN HANDLE hMutex) */ HANDLE WINAPI +DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, @@ -582,6 +593,7 @@ CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, */ HANDLE WINAPI +DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, @@ -599,6 +611,7 @@ CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, */ HANDLE WINAPI +DECLSPEC_HOTPATCH OpenEventA(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCSTR lpName) @@ -611,6 +624,7 @@ OpenEventA(IN DWORD dwDesiredAccess, */ HANDLE WINAPI +DECLSPEC_HOTPATCH OpenEventW(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName) @@ -623,6 +637,7 @@ OpenEventW(IN DWORD dwDesiredAccess, */ BOOL WINAPI +DECLSPEC_HOTPATCH PulseEvent(IN HANDLE hEvent) { NTSTATUS Status; @@ -641,6 +656,7 @@ PulseEvent(IN HANDLE hEvent) */ BOOL WINAPI +DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent) { NTSTATUS Status; @@ -659,6 +675,7 @@ ResetEvent(IN HANDLE hEvent) */ BOOL WINAPI +DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent) { NTSTATUS Status; @@ -715,6 +732,7 @@ InitializeCriticalSectionAndSpinCount(OUT LPCRITICAL_SECTION lpCriticalSection, */ VOID WINAPI +DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds) { /* Call the new API */ diff --git a/reactos/dll/win32/kernel32/client/thread.c b/reactos/dll/win32/kernel32/client/thread.c index e89eefd753c..dd610533947 100644 --- a/reactos/dll/win32/kernel32/client/thread.c +++ b/reactos/dll/win32/kernel32/client/thread.c @@ -131,6 +131,7 @@ BaseDispatchApc(IN PAPCFUNC ApcRoutine, */ HANDLE WINAPI +DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, From 19962054f97e7971b281cb76f51e3a51ed55ee97 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Wed, 5 Mar 2014 12:06:28 +0000 Subject: [PATCH 063/113] [NTDLL] * Mark as hotpatchable. CORE-7959 svn path=/trunk/; revision=62427 --- reactos/dll/ntdll/CMakeLists.txt | 2 +- reactos/dll/ntdll/ldr/ldrapi.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/reactos/dll/ntdll/CMakeLists.txt b/reactos/dll/ntdll/CMakeLists.txt index 8a7f11b1004..afa15fd2c24 100644 --- a/reactos/dll/ntdll/CMakeLists.txt +++ b/reactos/dll/ntdll/CMakeLists.txt @@ -42,7 +42,7 @@ add_library(ntdll SHARED def/ntdll.rc ${CMAKE_CURRENT_BINARY_DIR}/ntdll.def) -set_module_type(ntdll win32dll ENTRYPOINT 0) +set_module_type(ntdll win32dll HOTPATCHABLE ENTRYPOINT 0) ############################################# ## HACK FOR MSVC COMPILATION WITH win32dll ## set_subsystem(ntdll console) diff --git a/reactos/dll/ntdll/ldr/ldrapi.c b/reactos/dll/ntdll/ldr/ldrapi.c index a7b25f032d4..a6af75f230e 100644 --- a/reactos/dll/ntdll/ldr/ldrapi.c +++ b/reactos/dll/ntdll/ldr/ldrapi.c @@ -307,6 +307,7 @@ LdrLockLoaderLock(IN ULONG Flags, */ NTSTATUS NTAPI +DECLSPEC_HOTPATCH LdrLoadDll(IN PWSTR SearchPath OPTIONAL, IN PULONG DllCharacteristics OPTIONAL, IN PUNICODE_STRING DllName, From 1116c00fa258bed0dde3d531de07480b7a3a9baa Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Wed, 5 Mar 2014 12:12:05 +0000 Subject: [PATCH 064/113] [SHELL32] * Mark as hotpatchable. CORE-7959 svn path=/trunk/; revision=62428 --- reactos/dll/win32/shell32/CMakeLists.txt | 2 +- reactos/dll/win32/shell32/shlexec.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/reactos/dll/win32/shell32/CMakeLists.txt b/reactos/dll/win32/shell32/CMakeLists.txt index f0c920e3409..89c5417e74c 100644 --- a/reactos/dll/win32/shell32/CMakeLists.txt +++ b/reactos/dll/win32/shell32/CMakeLists.txt @@ -80,7 +80,7 @@ add_library(shell32 SHARED ${CMAKE_CURRENT_BINARY_DIR}/shell32_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/shell32.def) -set_module_type(shell32 win32dll UNICODE) +set_module_type(shell32 win32dll UNICODE HOTPATCHABLE) target_link_libraries(shell32 atlnew diff --git a/reactos/dll/win32/shell32/shlexec.cpp b/reactos/dll/win32/shell32/shlexec.cpp index cbfcabe7aff..a2707112b1e 100644 --- a/reactos/dll/win32/shell32/shlexec.cpp +++ b/reactos/dll/win32/shell32/shlexec.cpp @@ -2025,7 +2025,10 @@ HINSTANCE WINAPI ShellExecuteA(HWND hWnd, LPCSTR lpOperation, LPCSTR lpFile, * ShellExecuteExA [SHELL32.292] * */ -BOOL WINAPI ShellExecuteExA(LPSHELLEXECUTEINFOA sei) +BOOL +WINAPI +DECLSPEC_HOTPATCH +ShellExecuteExA(LPSHELLEXECUTEINFOA sei) { SHELLEXECUTEINFOW seiW; BOOL ret; @@ -2072,7 +2075,10 @@ BOOL WINAPI ShellExecuteExA(LPSHELLEXECUTEINFOA sei) * ShellExecuteExW [SHELL32.293] * */ -BOOL WINAPI ShellExecuteExW(LPSHELLEXECUTEINFOW sei) +BOOL +WINAPI +DECLSPEC_HOTPATCH +ShellExecuteExW(LPSHELLEXECUTEINFOW sei) { return SHELL_execute(sei, SHELL_ExecuteW); } From ec1dcd341ec942e8d233211d3714216d0f06a2b9 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Wed, 5 Mar 2014 12:36:04 +0000 Subject: [PATCH 065/113] [USER32] * Mark some APIs as hotpatchable. CORE-7959 svn path=/trunk/; revision=62430 --- .../win32ss/user/user32/controls/scrollbar.c | 29 ++++++++++++++----- reactos/win32ss/user/user32/misc/stubs.c | 2 ++ reactos/win32ss/user/user32/windows/class.c | 1 + .../win32ss/user/user32/windows/cursoricon.c | 2 ++ reactos/win32ss/user/user32/windows/defwnd.c | 8 +++-- reactos/win32ss/user/user32/windows/input.c | 8 +++-- reactos/win32ss/user/user32/windows/message.c | 21 ++++++++++---- .../win32ss/user/user32/windows/nonclient.c | 8 +++-- reactos/win32ss/user/user32/windows/window.c | 20 +++++++++---- 9 files changed, 76 insertions(+), 23 deletions(-) diff --git a/reactos/win32ss/user/user32/controls/scrollbar.c b/reactos/win32ss/user/user32/controls/scrollbar.c index 7edd2226589..222ec43e2e0 100644 --- a/reactos/win32ss/user/user32/controls/scrollbar.c +++ b/reactos/win32ss/user/user32/controls/scrollbar.c @@ -1438,7 +1438,10 @@ ScrollBarWndProcA(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam) /* * @implemented */ -BOOL WINAPI EnableScrollBar( HWND hwnd, UINT nBar, UINT flags ) +BOOL +WINAPI +DECLSPEC_HOTPATCH +EnableScrollBar( HWND hwnd, UINT nBar, UINT flags ) { BOOL Hook, Ret = FALSE; @@ -1499,7 +1502,9 @@ RealGetScrollInfo(HWND Wnd, INT SBType, LPSCROLLINFO Info) /* * @implemented */ -BOOL WINAPI +BOOL +WINAPI +DECLSPEC_HOTPATCH GetScrollInfo(HWND Wnd, INT SBType, LPSCROLLINFO Info) { BOOL Hook, Ret = FALSE; @@ -1528,7 +1533,9 @@ GetScrollInfo(HWND Wnd, INT SBType, LPSCROLLINFO Info) /* * @implemented */ -INT WINAPI +INT +WINAPI +DECLSPEC_HOTPATCH GetScrollPos(HWND Wnd, INT Bar) { PWND pwnd; @@ -1563,7 +1570,9 @@ GetScrollPos(HWND Wnd, INT Bar) /* * @implemented */ -BOOL WINAPI +BOOL +WINAPI +DECLSPEC_HOTPATCH GetScrollRange(HWND Wnd, int Bar, LPINT MinPos, LPINT MaxPos) { PWND pwnd; @@ -1615,7 +1624,9 @@ RealSetScrollInfo(HWND Wnd, int SBType, LPCSCROLLINFO Info, BOOL bRedraw) /* * @implemented */ -INT WINAPI +INT +WINAPI +DECLSPEC_HOTPATCH SetScrollInfo(HWND Wnd, int SBType, LPCSCROLLINFO Info, BOOL bRedraw) { BOOL Hook; @@ -1646,7 +1657,9 @@ SetScrollInfo(HWND Wnd, int SBType, LPCSCROLLINFO Info, BOOL bRedraw) /* * @implemented */ -INT WINAPI +INT +WINAPI +DECLSPEC_HOTPATCH SetScrollPos(HWND hWnd, INT nBar, INT nPos, BOOL bRedraw) { SCROLLINFO ScrollInfo; @@ -1661,7 +1674,9 @@ SetScrollPos(HWND hWnd, INT nBar, INT nPos, BOOL bRedraw) /* * @implemented */ -BOOL WINAPI +BOOL +WINAPI +DECLSPEC_HOTPATCH SetScrollRange(HWND hWnd, INT nBar, INT nMinPos, INT nMaxPos, BOOL bRedraw) { PWND pWnd; diff --git a/reactos/win32ss/user/user32/misc/stubs.c b/reactos/win32ss/user/user32/misc/stubs.c index d349de50d70..aa445c91b12 100644 --- a/reactos/win32ss/user/user32/misc/stubs.c +++ b/reactos/win32ss/user/user32/misc/stubs.c @@ -297,6 +297,7 @@ DefRawInputProc( */ UINT WINAPI +DECLSPEC_HOTPATCH GetRawInputBuffer( PRAWINPUT pData, PUINT pcbSize, @@ -359,6 +360,7 @@ GetRegisteredRawInputDevices( */ BOOL WINAPI +DECLSPEC_HOTPATCH RegisterRawInputDevices( PCRAWINPUTDEVICE pRawInputDevices, UINT uiNumDevices, diff --git a/reactos/win32ss/user/user32/windows/class.c b/reactos/win32ss/user/user32/windows/class.c index 4a5e6b31f63..00d84cfa5b2 100644 --- a/reactos/win32ss/user/user32/windows/class.c +++ b/reactos/win32ss/user/user32/windows/class.c @@ -1832,6 +1832,7 @@ SetWindowWord ( HWND hWnd,int nIndex,WORD wNewWord ) */ LONG WINAPI +DECLSPEC_HOTPATCH SetWindowLongA( HWND hWnd, int nIndex, diff --git a/reactos/win32ss/user/user32/windows/cursoricon.c b/reactos/win32ss/user/user32/windows/cursoricon.c index cfe5aa0dd43..150b56f714f 100644 --- a/reactos/win32ss/user/user32/windows/cursoricon.c +++ b/reactos/win32ss/user/user32/windows/cursoricon.c @@ -2112,6 +2112,7 @@ CursorIconToCursor(HICON hIcon, */ BOOL WINAPI +DECLSPEC_HOTPATCH SetCursorPos(int X, int Y) { return NtUserxSetCursorPos(X,Y); @@ -2122,6 +2123,7 @@ SetCursorPos(int X, int Y) */ BOOL WINAPI +DECLSPEC_HOTPATCH GetCursorPos(LPPOINT lpPoint) { BOOL res; diff --git a/reactos/win32ss/user/user32/windows/defwnd.c b/reactos/win32ss/user/user32/windows/defwnd.c index e6d2e1bbba7..b15d15ba3ce 100644 --- a/reactos/win32ss/user/user32/windows/defwnd.c +++ b/reactos/win32ss/user/user32/windows/defwnd.c @@ -36,7 +36,9 @@ static short iMenuSysKey = 0; /* * @implemented */ -DWORD WINAPI +DWORD +WINAPI +DECLSPEC_HOTPATCH GetSysColor(int nIndex) { if(nIndex >= 0 && nIndex < NUM_SYSCOLORS) @@ -51,7 +53,9 @@ GetSysColor(int nIndex) /* * @implemented */ -HBRUSH WINAPI +HBRUSH +WINAPI +DECLSPEC_HOTPATCH GetSysColorBrush(int nIndex) { if(nIndex >= 0 && nIndex < NUM_SYSCOLORS) diff --git a/reactos/win32ss/user/user32/windows/input.c b/reactos/win32ss/user/user32/windows/input.c index 3e50a2901ce..78bfb670970 100644 --- a/reactos/win32ss/user/user32/windows/input.c +++ b/reactos/win32ss/user/user32/windows/input.c @@ -114,7 +114,9 @@ EnableWindow(HWND hWnd, BOOL bEnable) /* * @implemented */ -SHORT WINAPI +SHORT +WINAPI +DECLSPEC_HOTPATCH GetAsyncKeyState(int vKey) { if (vKey < 0 || vKey > 256) @@ -185,7 +187,9 @@ GetKeyNameTextW(LONG lParam, /* * @implemented */ -SHORT WINAPI +SHORT +WINAPI +DECLSPEC_HOTPATCH GetKeyState(int nVirtKey) { return (SHORT)NtUserGetKeyState((DWORD)nVirtKey); diff --git a/reactos/win32ss/user/user32/windows/message.c b/reactos/win32ss/user/user32/windows/message.c index 7e0f0b25784..afd066e1eff 100644 --- a/reactos/win32ss/user/user32/windows/message.c +++ b/reactos/win32ss/user/user32/windows/message.c @@ -1908,7 +1908,9 @@ CallWindowProcW(WNDPROC lpPrevWndFunc, /* * @implemented */ -LRESULT WINAPI +LRESULT +WINAPI +DECLSPEC_HOTPATCH DispatchMessageA(CONST MSG *lpmsg) { LRESULT Ret = 0; @@ -2000,7 +2002,9 @@ DispatchMessageA(CONST MSG *lpmsg) /* * @implemented */ -LRESULT WINAPI +LRESULT +WINAPI +DECLSPEC_HOTPATCH DispatchMessageW(CONST MSG *lpmsg) { LRESULT Ret = 0; @@ -2100,7 +2104,9 @@ IntConvertMsgToAnsi(LPMSG lpMsg) /* * @implemented */ -BOOL WINAPI +BOOL +WINAPI +DECLSPEC_HOTPATCH GetMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, @@ -2128,7 +2134,9 @@ GetMessageA(LPMSG lpMsg, /* * @implemented */ -BOOL WINAPI +BOOL +WINAPI +DECLSPEC_HOTPATCH GetMessageW(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, @@ -2191,7 +2199,9 @@ PeekMessageWorker( PMSG pMsg, /* * @implemented */ -BOOL WINAPI +BOOL +WINAPI +DECLSPEC_HOTPATCH PeekMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, @@ -2217,6 +2227,7 @@ PeekMessageA(LPMSG lpMsg, */ BOOL WINAPI +DECLSPEC_HOTPATCH PeekMessageW( LPMSG lpMsg, HWND hWnd, diff --git a/reactos/win32ss/user/user32/windows/nonclient.c b/reactos/win32ss/user/user32/windows/nonclient.c index 1f8803a4aa5..890bc2af5e3 100644 --- a/reactos/win32ss/user/user32/windows/nonclient.c +++ b/reactos/win32ss/user/user32/windows/nonclient.c @@ -1233,7 +1233,9 @@ RealAdjustWindowRectEx(LPRECT lpRect, /* * @implemented */ -BOOL WINAPI +BOOL +WINAPI +DECLSPEC_HOTPATCH AdjustWindowRectEx(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, @@ -1266,7 +1268,9 @@ AdjustWindowRectEx(LPRECT lpRect, /* * @implemented */ -BOOL WINAPI +BOOL +WINAPI +DECLSPEC_HOTPATCH AdjustWindowRect(LPRECT lpRect, DWORD dwStyle, BOOL bMenu) diff --git a/reactos/win32ss/user/user32/windows/window.c b/reactos/win32ss/user/user32/windows/window.c index 1b479294e4b..452237951ee 100644 --- a/reactos/win32ss/user/user32/windows/window.c +++ b/reactos/win32ss/user/user32/windows/window.c @@ -322,7 +322,9 @@ cleanup: /* * @implemented */ -HWND WINAPI +HWND +WINAPI +DECLSPEC_HOTPATCH CreateWindowExA(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, @@ -445,7 +447,9 @@ CreateWindowExA(DWORD dwExStyle, /* * @implemented */ -HWND WINAPI +HWND +WINAPI +DECLSPEC_HOTPATCH CreateWindowExW(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, @@ -1143,7 +1147,9 @@ GetTopWindow(HWND hWnd) /* * @implemented */ -BOOL WINAPI +BOOL +WINAPI +DECLSPEC_HOTPATCH GetWindowInfo(HWND hWnd, PWINDOWINFO pwi) { @@ -1636,7 +1642,9 @@ return NtUserCallOneParam( (DWORD_PTR)dwDefaultLayout, ONEPARAM_ROUTINE_SETPROCD /* * @implemented */ -BOOL WINAPI +BOOL +WINAPI +DECLSPEC_HOTPATCH SetWindowTextA(HWND hWnd, LPCSTR lpString) { @@ -1659,7 +1667,9 @@ SetWindowTextA(HWND hWnd, /* * @implemented */ -BOOL WINAPI +BOOL +WINAPI +DECLSPEC_HOTPATCH SetWindowTextW(HWND hWnd, LPCWSTR lpString) { From eb5a260b2e08688d3f26ee71a8349e100c1317c8 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Wed, 5 Mar 2014 12:46:34 +0000 Subject: [PATCH 066/113] [WINMM] * Mark as hotpatchable. CORE-7959 svn path=/trunk/; revision=62431 --- reactos/dll/win32/winmm/CMakeLists.txt | 2 +- reactos/dll/win32/winmm/joystick.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/reactos/dll/win32/winmm/CMakeLists.txt b/reactos/dll/win32/winmm/CMakeLists.txt index 2394e2c9eac..507427c6829 100644 --- a/reactos/dll/win32/winmm/CMakeLists.txt +++ b/reactos/dll/win32/winmm/CMakeLists.txt @@ -22,7 +22,7 @@ add_library(winmm SHARED winmm_res.rc ${CMAKE_CURRENT_BINARY_DIR}/winmm.def) -set_module_type(winmm win32dll) +set_module_type(winmm win32dll HOTPATCHABLE) target_link_libraries(winmm wine ${PSEH_LIB}) add_importlibs(winmm advapi32 user32 msvcrt kernel32 ntdll) add_pch(winmm winemm.h SOURCE) diff --git a/reactos/dll/win32/winmm/joystick.c b/reactos/dll/win32/winmm/joystick.c index e8232ceed71..ed6054bfbf7 100644 --- a/reactos/dll/win32/winmm/joystick.c +++ b/reactos/dll/win32/winmm/joystick.c @@ -123,7 +123,7 @@ MMRESULT WINAPI joyConfigChanged(DWORD flags) /************************************************************************** * joyGetNumDevs [WINMM.@] */ -UINT WINAPI joyGetNumDevs(void) +UINT WINAPI DECLSPEC_HOTPATCH joyGetNumDevs(void) { UINT ret = 0; int i; @@ -139,7 +139,7 @@ UINT WINAPI joyGetNumDevs(void) /************************************************************************** * joyGetDevCapsW [WINMM.@] */ -MMRESULT WINAPI joyGetDevCapsW(UINT_PTR wID, LPJOYCAPSW lpCaps, UINT wSize) +MMRESULT WINAPI DECLSPEC_HOTPATCH joyGetDevCapsW(UINT_PTR wID, LPJOYCAPSW lpCaps, UINT wSize) { if (wID >= MAXJOYSTICK) return JOYERR_PARMS; if (!JOY_LoadDriver(wID)) return MMSYSERR_NODRIVER; @@ -153,7 +153,7 @@ MMRESULT WINAPI joyGetDevCapsW(UINT_PTR wID, LPJOYCAPSW lpCaps, UINT wSize) /************************************************************************** * joyGetDevCapsA [WINMM.@] */ -MMRESULT WINAPI joyGetDevCapsA(UINT_PTR wID, LPJOYCAPSA lpCaps, UINT wSize) +MMRESULT WINAPI DECLSPEC_HOTPATCH joyGetDevCapsA(UINT_PTR wID, LPJOYCAPSA lpCaps, UINT wSize) { JOYCAPSW jcw; MMRESULT ret; @@ -202,7 +202,7 @@ MMRESULT WINAPI joyGetDevCapsA(UINT_PTR wID, LPJOYCAPSA lpCaps, UINT wSize) /************************************************************************** * joyGetPosEx [WINMM.@] */ -MMRESULT WINAPI joyGetPosEx(UINT wID, LPJOYINFOEX lpInfo) +MMRESULT WINAPI DECLSPEC_HOTPATCH joyGetPosEx(UINT wID, LPJOYINFOEX lpInfo) { TRACE("(%d, %p);\n", wID, lpInfo); From ce66ff505682ee7cbd160cabc126fe3d94adb8cb Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Wed, 5 Mar 2014 14:31:26 +0000 Subject: [PATCH 067/113] [XINPUT1_3] * Mark as hotpatchable. CORE-7959 svn path=/trunk/; revision=62434 --- reactos/dll/win32/xinput1_3/CMakeLists.txt | 2 +- reactos/dll/win32/xinput1_3/xinput1_3_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/dll/win32/xinput1_3/CMakeLists.txt b/reactos/dll/win32/xinput1_3/CMakeLists.txt index 6ec93c2284f..4dd157bc34a 100644 --- a/reactos/dll/win32/xinput1_3/CMakeLists.txt +++ b/reactos/dll/win32/xinput1_3/CMakeLists.txt @@ -8,7 +8,7 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/xinput1_3.def) add_library(xinput1_3 SHARED ${SOURCE} version.rc) -set_module_type(xinput1_3 win32dll) +set_module_type(xinput1_3 win32dll HOTPATCHABLE) target_link_libraries(xinput1_3 wine) add_importlibs(xinput1_3 msvcrt kernel32 ntdll) add_cd_file(TARGET xinput1_3 DESTINATION reactos/system32 FOR all) diff --git a/reactos/dll/win32/xinput1_3/xinput1_3_main.c b/reactos/dll/win32/xinput1_3/xinput1_3_main.c index fa31d0f0194..c8595e2a69f 100644 --- a/reactos/dll/win32/xinput1_3/xinput1_3_main.c +++ b/reactos/dll/win32/xinput1_3/xinput1_3_main.c @@ -65,7 +65,7 @@ DWORD WINAPI XInputSetState(DWORD dwUserIndex, XINPUT_VIBRATION* pVibration) return ERROR_BAD_ARGUMENTS; } -DWORD WINAPI XInputGetState(DWORD dwUserIndex, XINPUT_STATE* pState) +DWORD WINAPI DECLSPEC_HOTPATCH XInputGetState(DWORD dwUserIndex, XINPUT_STATE* pState) { static int warn_once; From 623048035a2cde733481f45fcafa6b092304461e Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Fri, 7 Mar 2014 19:33:38 +0000 Subject: [PATCH 068/113] [NTOSKRNL] - Implement FsRtlNotifyFilterReportChange - Implement FsRtlNotifyUpdateBuffer - Implement FsRtlCancelNotify - Implement FsRtlNotifyGetLastPartOffset - Fix implementation of FsRtlNotifyFilterChangeDirectory This finishes the implementation of file system notifications inside the kernel. Data are properly returned to the caller on changes. CORE-2582 svn path=/trunk/; revision=62442 --- reactos/ntoskrnl/fsrtl/notify.c | 777 ++++++++++++++++++++-- reactos/ntoskrnl/include/internal/fsrtl.h | 4 +- 2 files changed, 730 insertions(+), 51 deletions(-) diff --git a/reactos/ntoskrnl/fsrtl/notify.c b/reactos/ntoskrnl/fsrtl/notify.c index f70a598902a..6c4be5b4d07 100644 --- a/reactos/ntoskrnl/fsrtl/notify.c +++ b/reactos/ntoskrnl/fsrtl/notify.c @@ -12,6 +12,55 @@ #define NDEBUG #include +/* INLINED FUNCTIONS *********************************************************/ + +/* + * @implemented + */ +FORCEINLINE +VOID +FsRtlNotifyAcquireFastMutex(IN PREAL_NOTIFY_SYNC RealNotifySync) +{ + ULONG_PTR CurrentThread = (ULONG_PTR)KeGetCurrentThread(); + + /* Only acquire fast mutex if it's not already acquired by the current thread */ + if (RealNotifySync->OwningThread != CurrentThread) + { + ExAcquireFastMutexUnsafe(&(RealNotifySync->FastMutex)); + RealNotifySync->OwningThread = CurrentThread; + } + /* Whatever the case, keep trace of the attempt to acquire fast mutex */ + RealNotifySync->OwnerCount++; +} + +/* + * @implemented + */ +FORCEINLINE +VOID +FsRtlNotifyReleaseFastMutex(IN PREAL_NOTIFY_SYNC RealNotifySync) +{ + RealNotifySync->OwnerCount--; + /* Release the fast mutex only if no other instance needs it */ + if (!RealNotifySync->OwnerCount) + { + ExReleaseFastMutexUnsafe(&(RealNotifySync->FastMutex)); + RealNotifySync->OwningThread = (ULONG_PTR)0; + } +} + +#define FsRtlNotifyGetLastPartOffset(FullLen, TargLen, Type, Chr) \ + for (FullPosition = 0; FullPosition < FullLen; ++FullPosition) \ + if (((Type)NotifyChange->FullDirectoryName->Buffer)[FullPosition] == Chr) \ + ++FullNumberOfParts; \ + for (LastPartOffset = 0; LastPartOffset < TargLen; ++LastPartOffset) { \ + if ( ((Type)TargetDirectory.Buffer)[LastPartOffset] == Chr) { \ + ++TargetNumberOfParts; \ + if (TargetNumberOfParts == FullNumberOfParts) \ + break; \ + } \ + } + /* PRIVATE FUNCTIONS *********************************************************/ VOID @@ -22,13 +71,161 @@ BOOLEAN FsRtlNotifySetCancelRoutine(IN PIRP Irp, IN PNOTIFY_CHANGE NotifyChange OPTIONAL); +/* + * @implemented + */ VOID NTAPI FsRtlCancelNotify(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { + PVOID Buffer; + PIRP NotifyIrp; + ULONG BufferLength; + PIO_STACK_LOCATION Stack; + PNOTIFY_CHANGE NotifyChange; + PREAL_NOTIFY_SYNC RealNotifySync; + PSECURITY_SUBJECT_CONTEXT SubjectContext = NULL; + + /* Get the NOTIFY_CHANGE struct and reset it */ + NotifyChange = (PNOTIFY_CHANGE)Irp->IoStatus.Information; + Irp->IoStatus.Information = 0; + /* Reset the cancel routine */ + IoSetCancelRoutine(Irp, NULL); + /* And release lock */ IoReleaseCancelSpinLock(Irp->CancelIrql); - UNIMPLEMENTED; + /* Get REAL_NOTIFY_SYNC struct */ + RealNotifySync = NotifyChange->NotifySync; + + FsRtlNotifyAcquireFastMutex(RealNotifySync); + + _SEH2_TRY + { + /* Remove the IRP from the notifications list and mark it pending */ + RemoveEntryList(&(Irp->Tail.Overlay.ListEntry)); + IoMarkIrpPending(Irp); + + /* Now, the tricky part - let's find a buffer big enough to hold the return data */ + if (NotifyChange->Buffer && NotifyChange->AllocatedBuffer == NULL && + ((Irp->MdlAddress && MmGetSystemAddressForMdl(Irp->MdlAddress) == NotifyChange->Buffer) || + NotifyChange->Buffer == Irp->AssociatedIrp.SystemBuffer)) + { + /* Assume we didn't find any */ + Buffer = NULL; + BufferLength = 0; + + /* If we don't have IRPs, check if current buffer is big enough */ + if (IsListEmpty(&NotifyChange->NotifyIrps)) + { + if (NotifyChange->BufferLength >= NotifyChange->DataLength) + { + BufferLength = NotifyChange->BufferLength; + } + } + else + { + /* Otherwise, try to look at next IRP available */ + NotifyIrp = CONTAINING_RECORD(NotifyChange->NotifyIrps.Flink, IRP, Tail.Overlay.ListEntry); + Stack = IoGetCurrentIrpStackLocation(NotifyIrp); + + /* If its buffer is big enough, get it */ + if (Stack->Parameters.NotifyDirectory.Length >= NotifyChange->BufferLength) + { + /* Is it MDL? */ + if (NotifyIrp->AssociatedIrp.SystemBuffer == NULL) + { + if (NotifyIrp->MdlAddress != NULL) + { + Buffer = MmGetSystemAddressForMdl(NotifyIrp->MdlAddress); + } + } + else + { + Buffer = NotifyIrp->AssociatedIrp.MasterIrp; + } + + /* Backup our accepted buffer length */ + BufferLength = Stack->Parameters.NotifyDirectory.Length; + if (BufferLength > NotifyChange->BufferLength) + { + BufferLength = NotifyChange->BufferLength; + } + } + } + + /* At that point, we *may* have a buffer */ + + /* If it has null length, then note that we won't use it */ + if (BufferLength == 0) + { + NotifyChange->Flags |= NOTIFY_IMMEDIATELY; + } + else + { + /* If we have a buffer length, but no buffer then allocate one */ + if (Buffer == NULL) + { + PsChargePoolQuota(NotifyChange->OwningProcess, PagedPool, BufferLength); + Buffer = ExAllocatePoolWithTag(PagedPool | POOL_RAISE_IF_ALLOCATION_FAILURE, BufferLength, 'NrSF'); + NotifyChange->AllocatedBuffer = Buffer; + } + + /* Copy data in that buffer */ + RtlCopyMemory(Buffer, NotifyChange->Buffer, NotifyChange->DataLength); + NotifyChange->ThisBufferLength = BufferLength; + NotifyChange->Buffer = Buffer; + } + + /* If we don't have valide buffer, ensure everything is 0-ed out */ + if (NotifyChange->Flags & NOTIFY_IMMEDIATELY) + { + NotifyChange->Buffer = 0; + NotifyChange->AllocatedBuffer = 0; + NotifyChange->LastEntry = 0; + NotifyChange->DataLength = 0; + NotifyChange->ThisBufferLength = 0; + } + } + + /* It's now time to complete - data are ready */ + + /* Set appropriate status and complete */ + Irp->IoStatus.Status = STATUS_CANCELLED; + IofCompleteRequest(Irp, EVENT_INCREMENT); + + /* If that notification isn't referenced any longer, drop it */ + if (!InterlockedDecrement((PLONG)&(NotifyChange->ReferenceCount))) + { + /* If it had an allocated buffer, delete */ + if (NotifyChange->AllocatedBuffer) + { + PsReturnProcessPagedPoolQuota(NotifyChange->OwningProcess, NotifyChange->ThisBufferLength); + ExFreePoolWithTag(NotifyChange->AllocatedBuffer, 'NrSF'); + } + + /* In case of full name, remember subject context for later deletion */ + if (NotifyChange->FullDirectoryName) + { + SubjectContext = NotifyChange->SubjectContext; + } + + /* We mustn't have ANY change left anymore */ + ASSERT(NotifyChange->NotifyList.Flink == NULL); + ExFreePoolWithTag(NotifyChange, 0); + } + } + _SEH2_FINALLY + { + FsRtlNotifyReleaseFastMutex(RealNotifySync); + + /* If the subject security context was captured, release and free it */ + if (SubjectContext) + { + SeReleaseSubjectContext(SubjectContext); + ExFreePool(SubjectContext); + } + } + _SEH2_END; } /* @@ -58,6 +255,9 @@ FsRtlCheckNotifyForDelete(IN PLIST_ENTRY NotifyList, } } +/* + *@implemented + */ PNOTIFY_CHANGE FsRtlIsNotifyOnList(IN PLIST_ENTRY NotifyList, IN PVOID FsContext) @@ -83,22 +283,6 @@ FsRtlIsNotifyOnList(IN PLIST_ENTRY NotifyList, return NULL; } -FORCEINLINE -VOID -FsRtlNotifyAcquireFastMutex(IN PREAL_NOTIFY_SYNC RealNotifySync) -{ - ULONG_PTR CurrentThread = (ULONG_PTR)KeGetCurrentThread(); - - /* Only acquire fast mutex if it's not already acquired by the current thread */ - if (RealNotifySync->OwningThread != CurrentThread) - { - ExAcquireFastMutexUnsafe(&(RealNotifySync->FastMutex)); - RealNotifySync->OwningThread = CurrentThread; - } - /* Whatever the case, keep trace of the attempt to acquire fast mutex */ - RealNotifySync->OwnerCount++; -} - /* * @implemented */ @@ -216,7 +400,7 @@ FsRtlNotifyCompleteIrpList(IN PNOTIFY_CHANGE NotifyChange, DataLength = NotifyChange->DataLength; - NotifyChange->Flags &= (INVALIDATE_BUFFERS | WATCH_TREE); + NotifyChange->Flags &= (NOTIFY_IMMEDIATELY | WATCH_TREE); NotifyChange->DataLength = 0; NotifyChange->LastEntry = 0; @@ -233,19 +417,6 @@ FsRtlNotifyCompleteIrpList(IN PNOTIFY_CHANGE NotifyChange, } } -FORCEINLINE -VOID -FsRtlNotifyReleaseFastMutex(IN PREAL_NOTIFY_SYNC RealNotifySync) -{ - RealNotifySync->OwnerCount--; - /* Release the fast mutex only if no other instance needs it */ - if (!RealNotifySync->OwnerCount) - { - ExReleaseFastMutexUnsafe(&(RealNotifySync->FastMutex)); - RealNotifySync->OwningThread = (ULONG_PTR)0; - } -} - /* * @implemented */ @@ -295,6 +466,91 @@ FsRtlNotifySetCancelRoutine(IN PIRP Irp, return FALSE; } +/* + * @implemented + */ +BOOLEAN +FsRtlNotifyUpdateBuffer(OUT PFILE_NOTIFY_INFORMATION OutputBuffer, + IN ULONG Action, + IN PSTRING ParentName, + IN PSTRING TargetName, + IN PSTRING StreamName, + IN BOOLEAN IsUnicode, + IN ULONG DataLength) +{ + /* Unless there's an issue with buffers, there's no reason to fail */ + BOOLEAN Succeed = TRUE; + ULONG AlreadyWritten = 0, ResultSize; + + PAGED_CODE(); + + /* Update user buffer with the change that occured + * First copy parent name if any + * Then copy target name, there's always one + * And finally, copy stream name if any + * If these names aren't unicode, then convert first + */ + _SEH2_TRY + { + OutputBuffer->NextEntryOffset = 0; + OutputBuffer->Action = Action; + OutputBuffer->FileNameLength = DataLength - sizeof(FILE_NOTIFY_INFORMATION); + if (IsUnicode) + { + if (ParentName->Length) + { + RtlCopyMemory(OutputBuffer->FileName, ParentName->Buffer, ParentName->Length); + OutputBuffer->FileName[ParentName->Length / sizeof(WCHAR)] = L'\\'; + AlreadyWritten = ParentName->Length + sizeof(WCHAR); + } + RtlCopyMemory(OutputBuffer->FileName + AlreadyWritten, TargetName->Buffer, TargetName->Length); + if (StreamName) + { + AlreadyWritten += TargetName->Length; + OutputBuffer->FileName[AlreadyWritten / sizeof(WCHAR)] = L':'; + RtlCopyMemory(OutputBuffer->FileName + AlreadyWritten + sizeof(WCHAR), + StreamName->Buffer, StreamName->Length); + } + } + else + { + if (!ParentName->Length) + { + ASSERT(StreamName); + RtlCopyMemory(OutputBuffer->FileName, StreamName->Buffer, StreamName->Length); + } + else + { + RtlOemToUnicodeN(OutputBuffer->FileName, OutputBuffer->FileNameLength, + &ResultSize, ParentName->Buffer, + ParentName->Length); + OutputBuffer->FileName[ResultSize / sizeof(WCHAR)] = L'\\'; + AlreadyWritten = ResultSize + sizeof(WCHAR); + + RtlOemToUnicodeN(OutputBuffer->FileName + AlreadyWritten, + OutputBuffer->FileNameLength, &ResultSize, + TargetName->Buffer, TargetName->Length); + + if (StreamName) + { + AlreadyWritten += ResultSize; + OutputBuffer->FileName[AlreadyWritten / sizeof(WCHAR)] = L':'; + RtlOemToUnicodeN(OutputBuffer->FileName + AlreadyWritten + sizeof(WCHAR), + OutputBuffer->FileNameLength, &ResultSize, + StreamName->Buffer, StreamName->Length); + } + } + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Succeed = FALSE; + } + _SEH2_END; + + return Succeed; +} + /* PUBLIC FUNCTIONS **********************************************************/ /*++ @@ -445,7 +701,7 @@ FsRtlNotifyCleanup(IN PNOTIFY_SYNC NotifySync, /*++ * @name FsRtlNotifyFilterChangeDirectory - * @unimplemented + * @implemented * * FILLME * @@ -559,16 +815,16 @@ FsRtlNotifyFilterChangeDirectory(IN PNOTIFY_SYNC NotifySync, NotifyIrp->IoStatus.Status = STATUS_DELETE_PENDING; IoCompleteRequest(NotifyIrp, EVENT_INCREMENT); } - /* Complete if there is directory enumeration and no buffer available any more */ - if ((NotifyChange->Flags & INVALIDATE_BUFFERS) && (NotifyChange->Flags & ENUMERATE_DIR)) + /* Complete now if asked to (and not asked to notify later on) */ + if ((NotifyChange->Flags & NOTIFY_IMMEDIATELY) && !(NotifyChange->Flags & NOTIFY_LATER)) { - NotifyChange->Flags &= ~INVALIDATE_BUFFERS; + NotifyChange->Flags &= ~NOTIFY_IMMEDIATELY; IoMarkIrpPending(NotifyIrp); NotifyIrp->IoStatus.Status = STATUS_NOTIFY_ENUM_DIR; IoCompleteRequest(NotifyIrp, EVENT_INCREMENT); } - /* If no data yet, or directory enumeration, handle */ - else if (NotifyChange->DataLength == 0 || (NotifyChange->Flags & ENUMERATE_DIR)) + /* If no data yet, or asked to notify later on, handle */ + else if (NotifyChange->DataLength == 0 || (NotifyChange->Flags & NOTIFY_LATER)) { goto HandleIRP; } @@ -612,20 +868,13 @@ FsRtlNotifyFilterChangeDirectory(IN PNOTIFY_SYNC NotifySync, else { /* If it can't contain WCHAR, it's ANSI */ - if (FullDirectoryName->Length < sizeof(WCHAR)) + if (FullDirectoryName->Length < sizeof(WCHAR) || ((CHAR*)FullDirectoryName->Buffer)[1] != 0) { NotifyChange->CharacterSize = sizeof(CHAR); } - /* First char is \, so in unicode, right part is 0 - * whereas in ANSI it contains next char - */ - else if (((CHAR*)FullDirectoryName->Buffer)[1] == 0) - { - NotifyChange->CharacterSize = sizeof(WCHAR); - } else { - NotifyChange->CharacterSize = sizeof(CHAR); + NotifyChange->CharacterSize = sizeof(WCHAR); } /* Now, check is user is willing to watch root */ @@ -668,7 +917,7 @@ HandleIRP: FsRtlNotifyReleaseFastMutex(RealNotifySync); /* If the subject security context was captured and there's no notify */ - if (SubjectContext && (!NotifyChange || FullDirectoryName)) + if (SubjectContext && (!NotifyChange || NotifyChange->FullDirectoryName)) { SeReleaseSubjectContext(SubjectContext); ExFreePool(SubjectContext); @@ -679,7 +928,7 @@ HandleIRP: /*++ * @name FsRtlNotifyFilterReportChange - * @unimplemented + * @implemented * * FILLME * @@ -731,7 +980,437 @@ FsRtlNotifyFilterReportChange(IN PNOTIFY_SYNC NotifySync, IN PVOID TargetContext, IN PVOID FilterContext) { - KeBugCheck(FILE_SYSTEM); + PIRP Irp; + PVOID OutputBuffer; + USHORT FullPosition; + PLIST_ENTRY NextEntry; + PIO_STACK_LOCATION Stack; + PNOTIFY_CHANGE NotifyChange; + PREAL_NOTIFY_SYNC RealNotifySync; + PFILE_NOTIFY_INFORMATION FileNotifyInfo; + BOOLEAN IsStream, IsParent, PoolQuotaCharged; + STRING TargetDirectory, TargetName, ParentName, IntNormalizedParentName; + ULONG NumberOfBytes, TargetNumberOfParts, FullNumberOfParts, LastPartOffset, ParentNameOffset, ParentNameLength; + ULONG DataLength, TargetNameLength, AlignedDataLength; + + TargetDirectory.Length = 0; + TargetDirectory.MaximumLength = 0; + TargetDirectory.Buffer = NULL; + TargetName.Length = 0; + TargetName.MaximumLength = 0; + TargetName.Buffer = NULL; + ParentName.Length = 0; + ParentName.MaximumLength = 0; + ParentName.Buffer = NULL; + IsStream = FALSE; + + PAGED_CODE(); + + DPRINT("FsRtlNotifyFilterReportChange(%p, %p, %p, %u, %p, %p, %p, %x, %x, %p, %p)\n", + NotifySync, NotifyList, FullTargetName, TargetNameOffset, StreamName, NormalizedParentName, + FilterMatch, Action, TargetContext, FilterContext); + + /* We need offset in name */ + if (!TargetNameOffset && FullTargetName) + { + return; + } + + /* Get real structure hidden behind the opaque pointer */ + RealNotifySync = (PREAL_NOTIFY_SYNC)NotifySync; + /* Acquire lock - will be released in finally block */ + FsRtlNotifyAcquireFastMutex(RealNotifySync); + _SEH2_TRY + { + /* Browse all the registered notifications we have */ + for (NextEntry = NotifyList->Flink; NextEntry != NotifyList; + NextEntry = NextEntry->Flink) + { + /* Try to find an entry matching our change */ + NotifyChange = CONTAINING_RECORD(NextEntry, NOTIFY_CHANGE, NotifyList); + if (FullTargetName != NULL) + { + ASSERT(NotifyChange->FullDirectoryName != NULL); + if (!NotifyChange->FullDirectoryName->Length) + { + continue; + } + + if (!(FilterMatch & NotifyChange->CompletionFilter)) + { + continue; + } + + /* If no normalized name provided, construct it from full target name */ + if (NormalizedParentName == NULL) + { + IntNormalizedParentName.Buffer = FullTargetName->Buffer; + if (TargetNameOffset != NotifyChange->CharacterSize) + { + IntNormalizedParentName.MaximumLength = + IntNormalizedParentName.Length = TargetNameOffset - NotifyChange->CharacterSize; + } + else + { + IntNormalizedParentName.MaximumLength = + IntNormalizedParentName.Length = TargetNameOffset; + } + NormalizedParentName = &IntNormalizedParentName; + } + + /* heh? Watched directory bigger than changed file? */ + if (NormalizedParentName->Length < NotifyChange->FullDirectoryName->Length) + { + continue; + } + + /* Same len => parent */ + if (NormalizedParentName->Length == NotifyChange->FullDirectoryName->Length) + { + IsParent = TRUE; + } + /* If not, then, we have to be watching the tree, otherwise we don't have to report such changes */ + else if (!(NotifyChange->Flags & WATCH_TREE)) + { + continue; + } + /* And finally, we've to check we're properly \-terminated */ + else + { + if (!(NotifyChange->Flags & WATCH_ROOT)) + { + if (NotifyChange->CharacterSize == sizeof(CHAR)) + { + if (((PSTR)NormalizedParentName->Buffer)[NotifyChange->FullDirectoryName->Length] != '\\') + { + continue; + } + } + else + { + if (((PWSTR)NormalizedParentName->Buffer)[NotifyChange->FullDirectoryName->Length / sizeof (WCHAR)] != L'\\') + { + continue; + } + } + } + + IsParent = FALSE; + } + + /* If len matches, then check that both name are equal */ + if (!RtlEqualMemory(NormalizedParentName->Buffer, NotifyChange->FullDirectoryName->Buffer, + NotifyChange->FullDirectoryName->Length)) + { + continue; + } + + /* Call traverse callback (only if we have to traverse ;-)) */ + if (!IsParent + && NotifyChange->TraverseCallback != NULL + && !NotifyChange->TraverseCallback(NotifyChange->FsContext, + TargetContext, + NotifyChange->SubjectContext)) + { + continue; + } + + /* And then, filter callback if provided */ + if (NotifyChange->FilterCallback != NULL + && FilterContext != NULL + && !NotifyChange->FilterCallback(NotifyChange->FsContext, FilterContext)) + { + continue; + } + } + /* We have a stream! */ + else + { + ASSERT(NotifyChange->FullDirectoryName == NULL); + if (TargetContext != NotifyChange->SubjectContext) + { + continue; + } + + ParentName.Buffer = NULL; + ParentName.Length = 0; + IsStream = TRUE; + IsParent = FALSE; + } + + /* If we don't have to notify immediately, prepare for output */ + if (!(NotifyChange->Flags & NOTIFY_IMMEDIATELY)) + { + /* If we have something to output... */ + if (NotifyChange->BufferLength) + { + /* Get size of the output */ + NumberOfBytes = 0; + Irp = NULL; + if (!NotifyChange->ThisBufferLength) + { + if (IsListEmpty(&NotifyChange->NotifyIrps)) + { + NumberOfBytes = NotifyChange->BufferLength; + } + else + { + Irp = CONTAINING_RECORD(NotifyChange->NotifyIrps.Flink, IRP, Tail.Overlay.ListEntry); + Stack = IoGetCurrentIrpStackLocation(Irp); + NumberOfBytes = Stack->Parameters.NotifyDirectory.Length; + } + } + else + { + NumberOfBytes = NotifyChange->ThisBufferLength; + } + + /* If we're matching parent, we don't care about parent (redundant) */ + if (IsParent) + { + ParentName.Length = 0; + } + else + { + /* If we don't deal with streams, some more work is required */ + if (!IsStream) + { + if (NotifyChange->Flags & WATCH_ROOT || + (NormalizedParentName->Buffer != FullTargetName->Buffer)) + { + /* Construct TargetDirectory if we don't have it yet */ + if (TargetDirectory.Buffer == NULL) + { + TargetDirectory.Buffer = FullTargetName->Buffer; + TargetDirectory.Length = TargetNameOffset; + if (TargetNameOffset != NotifyChange->CharacterSize) + { + TargetDirectory.Length = TargetNameOffset - NotifyChange->CharacterSize; + } + TargetDirectory.MaximumLength = TargetDirectory.Length; + } + /* Now, we start looking for matching parts (unless we watch root) */ + TargetNumberOfParts = 0; + if (!(NotifyChange->Flags & WATCH_ROOT)) + { + FullNumberOfParts = 1; + if (NotifyChange->CharacterSize == sizeof(CHAR)) + { + FsRtlNotifyGetLastPartOffset(NotifyChange->FullDirectoryName->Length, + TargetDirectory.Length, PSTR, '\\'); + } + else + { + FsRtlNotifyGetLastPartOffset(NotifyChange->FullDirectoryName->Length / sizeof(WCHAR), + TargetDirectory.Length / sizeof(WCHAR), PWSTR, L'\\'); + LastPartOffset *= NotifyChange->CharacterSize; + } + } + + /* Then, we can construct proper parent name */ + ParentNameOffset = NotifyChange->CharacterSize + LastPartOffset; + ParentName.Buffer = &TargetDirectory.Buffer[ParentNameOffset]; + ParentNameLength = TargetDirectory.Length; + } + else + { + /* Construct parent name even for streams */ + ParentName.Buffer = &NormalizedParentName->Buffer[NotifyChange->FullDirectoryName->Length] + NotifyChange->CharacterSize; + ParentNameLength = NormalizedParentName->Length - NotifyChange->FullDirectoryName->Length; + ParentNameOffset = NotifyChange->CharacterSize; + } + ParentNameLength -= ParentNameOffset; + ParentName.Length = ParentNameLength; + ParentName.MaximumLength = ParentNameLength; + } + } + + /* Start to count amount of data to write, we've first the structure itself */ + DataLength = FIELD_OFFSET(FILE_NOTIFY_INFORMATION, FileName); + + /* If stream, we'll just append stream name */ + if (IsStream) + { + ASSERT(StreamName != NULL); + DataLength += StreamName->Length; + } + else + { + /* If not parent, we've to append parent name */ + if (!IsParent) + { + if (NotifyChange->CharacterSize == sizeof(CHAR)) + { + DataLength += RtlOemStringToCountedUnicodeSize(&ParentName); + } + else + { + DataLength += ParentName.Length; + } + DataLength += sizeof(WCHAR); + } + + /* Look for target name & construct it, if required */ + if (TargetName.Buffer) + { + TargetNameLength = TargetName.Length; + } + else + { + TargetName.Buffer = &FullTargetName->Buffer[TargetNameOffset]; + TargetNameLength = FullTargetName->Length - TargetNameOffset; + TargetName.Length = TargetNameLength; + TargetName.MaximumLength = TargetNameLength; + } + + /* Then, we will append it as well */ + if (NotifyChange->CharacterSize == sizeof(CHAR)) + { + DataLength += RtlOemStringToCountedUnicodeSize(&TargetName); + } + else + { + DataLength += TargetName.Length; + } + + /* If we also had a stream name, then we can append it as well */ + if (StreamName != NULL) + { + if (NotifyChange->CharacterSize == sizeof(WCHAR)) + { + DataLength += StreamName->Length + sizeof(WCHAR); + } + else + { + DataLength = DataLength + RtlOemStringToCountedUnicodeSize(&TargetName) + sizeof(CHAR); + } + } + } + + /* Get the position where we can put our data (aligned!) */ + AlignedDataLength = ROUND_UP(NotifyChange->DataLength, sizeof(ULONG)); + /* If it's higher than buffer length, then, bail out without outputing */ + if (DataLength > NumberOfBytes || AlignedDataLength + DataLength > NumberOfBytes) + { + NotifyChange->Flags |= NOTIFY_IMMEDIATELY; + } + else + { + OutputBuffer = 0; + FileNotifyInfo = 0; + /* If we already had a buffer, update last entry position */ + if (NotifyChange->Buffer != NULL) + { + FileNotifyInfo = (PVOID)((ULONG_PTR)NotifyChange->Buffer + NotifyChange->LastEntry); + FileNotifyInfo->NextEntryOffset = AlignedDataLength - NotifyChange->LastEntry; + NotifyChange->LastEntry = AlignedDataLength; + /* And get our output buffer */ + OutputBuffer = (PVOID)((ULONG_PTR)NotifyChange->Buffer + AlignedDataLength); + } + /* If we hadn't buffer, try to find one */ + else if (Irp != NULL) + { + if (Irp->AssociatedIrp.SystemBuffer != NULL) + { + OutputBuffer = Irp->AssociatedIrp.SystemBuffer; + } + else if (Irp->MdlAddress != NULL) + { + OutputBuffer = MmGetSystemAddressForMdl(Irp->MdlAddress); + } + + NotifyChange->Buffer = OutputBuffer; + NotifyChange->ThisBufferLength = NumberOfBytes; + } + + /* If we couldn't find one, then allocate one */ + if (NotifyChange->Buffer == NULL) + { + PoolQuotaCharged = FALSE; + _SEH2_TRY + { + PsChargePoolQuota(NotifyChange->OwningProcess, PagedPool, NumberOfBytes); + PoolQuotaCharged = TRUE; + OutputBuffer = ExAllocatePoolWithTag(PagedPool | POOL_RAISE_IF_ALLOCATION_FAILURE, + NumberOfBytes, 'NrSF'); + NotifyChange->Buffer = OutputBuffer; + NotifyChange->AllocatedBuffer = OutputBuffer; + } + /* If something went wrong during allocation, notify immediately instead of outputing */ + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + if (PoolQuotaCharged) + { + PsReturnProcessPagedPoolQuota(NotifyChange->OwningProcess, NumberOfBytes); + } + NotifyChange->Flags |= NOTIFY_IMMEDIATELY; + } + _SEH2_END; + } + + /* Finally, if we have a buffer, fill it in! */ + if (OutputBuffer != NULL) + { + if (FsRtlNotifyUpdateBuffer((FILE_NOTIFY_INFORMATION *)OutputBuffer, + Action, &ParentName, &TargetName, + StreamName, NotifyChange->CharacterSize == sizeof(WCHAR), + DataLength)) + { + NotifyChange->DataLength = DataLength + AlignedDataLength; + } + /* If it failed, notify immediately */ + else + { + NotifyChange->Flags |= NOTIFY_IMMEDIATELY; + } + } + } + + /* If we have to notify right now (something went wrong?) */ + if (NotifyChange->Flags & NOTIFY_IMMEDIATELY) + { + /* Ensure that all our buffers are NULL */ + if (NotifyChange->Buffer != NULL) + { + if (NotifyChange->AllocatedBuffer != NULL) + { + PsReturnProcessPagedPoolQuota(NotifyChange->OwningProcess, NotifyChange->ThisBufferLength); + ExFreePoolWithTag(NotifyChange->AllocatedBuffer, 'NrSF'); + } + + NotifyChange->Buffer = NULL; + NotifyChange->AllocatedBuffer = NULL; + NotifyChange->LastEntry = 0; + NotifyChange->DataLength = 0; + NotifyChange->ThisBufferLength = 0; + } + } + } + } + + /* If asking for old name in case of a rename, notify later on, + * so that we can wait for new name. + * http://msdn.microsoft.com/en-us/library/dn392331.aspx + */ + if (Action == FILE_ACTION_RENAMED_OLD_NAME) + { + NotifyChange->Flags |= NOTIFY_LATER; + } + else + { + NotifyChange->Flags &= ~NOTIFY_LATER; + if (!IsListEmpty(&NotifyChange->NotifyIrps)) + { + FsRtlNotifyCompleteIrpList(NotifyChange, STATUS_SUCCESS); + } + } + } + } + _SEH2_FINALLY + { + FsRtlNotifyReleaseFastMutex(RealNotifySync); + } + _SEH2_END; } /*++ diff --git a/reactos/ntoskrnl/include/internal/fsrtl.h b/reactos/ntoskrnl/include/internal/fsrtl.h index 5dd98dc0697..cca4e8faeb1 100644 --- a/reactos/ntoskrnl/include/internal/fsrtl.h +++ b/reactos/ntoskrnl/include/internal/fsrtl.h @@ -53,9 +53,9 @@ // Notifications flags // #define WATCH_TREE 0x01 -#define INVALIDATE_BUFFERS 0x02 +#define NOTIFY_IMMEDIATELY 0x02 #define CLEANUP_IN_PROCESS 0x04 -#define ENUMERATE_DIR 0x08 +#define NOTIFY_LATER 0x08 #define WATCH_ROOT 0x10 #define DELETE_IN_PROCESS 0x20 From 0ef03fcf25d31701b5baf7fd2aad3e6fd6e17ad0 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Fri, 7 Mar 2014 19:38:35 +0000 Subject: [PATCH 069/113] [FASTFAT] Add required fields to handle file system notifications to device extension/VCB and properly initialize them on volume mount svn path=/trunk/; revision=62443 --- reactos/drivers/filesystems/fastfat/fsctl.c | 2 ++ reactos/drivers/filesystems/fastfat/vfat.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/reactos/drivers/filesystems/fastfat/fsctl.c b/reactos/drivers/filesystems/fastfat/fsctl.c index 24feadd906e..35e67d3893b 100644 --- a/reactos/drivers/filesystems/fastfat/fsctl.c +++ b/reactos/drivers/filesystems/fastfat/fsctl.c @@ -600,6 +600,8 @@ VfatMount( VolumeFcb->Flags |= VCB_IS_DIRTY; FsRtlNotifyVolumeEvent(DeviceExt->FATFileObject, FSRTL_VOLUME_MOUNT); + FsRtlNotifyInitializeSync(&DeviceExt->NotifySync); + InitializeListHead(&DeviceExt->NotifyList); Status = STATUS_SUCCESS; diff --git a/reactos/drivers/filesystems/fastfat/vfat.h b/reactos/drivers/filesystems/fastfat/vfat.h index 791daf29449..28a047a5b1e 100644 --- a/reactos/drivers/filesystems/fastfat/vfat.h +++ b/reactos/drivers/filesystems/fastfat/vfat.h @@ -291,6 +291,10 @@ typedef struct DEVICE_EXTENSION ULONG BaseDateYear; LIST_ENTRY VolumeListEntry; + + /* Notifications */ + LIST_ENTRY NotifyList; + PNOTIFY_SYNC NotifySync; } DEVICE_EXTENSION, VCB, *PVCB; typedef struct From d315b7bb39f5e044b4759c0674d54b752a7d776b Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Fri, 7 Mar 2014 19:42:54 +0000 Subject: [PATCH 070/113] [FASTFAT] - Implement VfatNotifyChangeDirectory which handles file system notifications registration - Also add support to dispatch routine for not queuing IRPs when pending and not required CORE-2582 svn path=/trunk/; revision=62444 --- reactos/drivers/filesystems/fastfat/dir.c | 35 +++++++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/reactos/drivers/filesystems/fastfat/dir.c b/reactos/drivers/filesystems/fastfat/dir.c index 2b5d8f1da52..57fda52556f 100644 --- a/reactos/drivers/filesystems/fastfat/dir.c +++ b/reactos/drivers/filesystems/fastfat/dir.c @@ -584,6 +584,32 @@ DoQuery( return Status; } +NTSTATUS VfatNotifyChangeDirectory(PVFAT_IRP_CONTEXT * IrpContext) +{ + PVCB pVcb; + PVFATFCB pFcb; + PIO_STACK_LOCATION Stack; + Stack = (*IrpContext)->Stack; + pVcb = (*IrpContext)->DeviceExt; + pFcb = (PVFATFCB) (*IrpContext)->FileObject->FsContext; + + FsRtlNotifyFullChangeDirectory(pVcb->NotifySync, + &(pVcb->NotifyList), + (*IrpContext)->FileObject->FsContext2, + (PSTRING)&(pFcb->PathNameU), + BooleanFlagOn(Stack->Flags, SL_WATCH_TREE), + FALSE, + Stack->Parameters.NotifyDirectory.CompletionFilter, + (*IrpContext)->Irp, + NULL, + NULL); + + /* We don't need the IRP context as we won't handle IRP completion */ + VfatFreeIrpContext(*IrpContext); + *IrpContext = NULL; + + return STATUS_PENDING; +} /* * FUNCTION: directory control : read/write directory informations @@ -603,8 +629,7 @@ VfatDirectoryControl( break; case IRP_MN_NOTIFY_CHANGE_DIRECTORY: - DPRINT("VFAT, dir : change\n"); - Status = STATUS_NOT_IMPLEMENTED; + Status = VfatNotifyChangeDirectory(&IrpContext); break; default: @@ -617,7 +642,11 @@ VfatDirectoryControl( if (Status == STATUS_PENDING) { - Status = VfatQueueRequest(IrpContext); + /* Only queue if there's IRP context */ + if (IrpContext) + { + Status = VfatQueueRequest(IrpContext); + } } else { From 3d38a135430f6efe5179032e948314a99453b845 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Fri, 7 Mar 2014 19:46:37 +0000 Subject: [PATCH 071/113] [FASTFAT] Add really limited support for file system notifications. In case of file creation, we report this. More cases are missing, such as: dir creation, attributes change, size change, last write change. See: http://msdn.microsoft.com/en-us/library/windows/desktop/aa364417%28v=vs.85%29.aspx as a reference CORE-2582 svn path=/trunk/; revision=62445 --- reactos/drivers/filesystems/fastfat/create.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/reactos/drivers/filesystems/fastfat/create.c b/reactos/drivers/filesystems/fastfat/create.c index fbd5231c9a5..841b7aee753 100644 --- a/reactos/drivers/filesystems/fastfat/create.c +++ b/reactos/drivers/filesystems/fastfat/create.c @@ -754,6 +754,19 @@ VfatCreateFile( &pFcb->FCBShareAccess); } + if (Irp->IoStatus.Information == FILE_CREATED) + { + FsRtlNotifyFullReportChange(DeviceExt->NotifySync, + &(DeviceExt->NotifyList), + (PSTRING)&pFcb->PathNameU, + pFcb->PathNameU.Length - pFcb->LongNameU.Length, + NULL, + NULL, + FILE_NOTIFY_CHANGE_FILE_NAME, + FILE_ACTION_ADDED, + NULL); + } + pFcb->OpenHandleCount++; /* FIXME : test write access if requested */ From a101d80ab667337ca2999bca1d15974a9abb8898 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Fri, 7 Mar 2014 20:30:29 +0000 Subject: [PATCH 072/113] [FASTFAT] Properly handle directories when notifying the kernel about creation. This makes the MS test application fully passing on ReactOS. You can find it at: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365261%28v=vs.85%29.aspx CORE-2582 svn path=/trunk/; revision=62446 --- reactos/drivers/filesystems/fastfat/create.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reactos/drivers/filesystems/fastfat/create.c b/reactos/drivers/filesystems/fastfat/create.c index 841b7aee753..0e27105aefb 100644 --- a/reactos/drivers/filesystems/fastfat/create.c +++ b/reactos/drivers/filesystems/fastfat/create.c @@ -762,7 +762,8 @@ VfatCreateFile( pFcb->PathNameU.Length - pFcb->LongNameU.Length, NULL, NULL, - FILE_NOTIFY_CHANGE_FILE_NAME, + ((*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY) ? + FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME), FILE_ACTION_ADDED, NULL); } From 70dc7b586e2ceb524c1b4be661e8bb34b6b9a21e Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Fri, 7 Mar 2014 21:51:11 +0000 Subject: [PATCH 073/113] [NOTSKRNL] Fix Frenchism, spotted by Christoph svn path=/trunk/; revision=62447 --- reactos/ntoskrnl/fsrtl/notify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/fsrtl/notify.c b/reactos/ntoskrnl/fsrtl/notify.c index 6c4be5b4d07..d06b81e4394 100644 --- a/reactos/ntoskrnl/fsrtl/notify.c +++ b/reactos/ntoskrnl/fsrtl/notify.c @@ -176,7 +176,7 @@ FsRtlCancelNotify(IN PDEVICE_OBJECT DeviceObject, NotifyChange->Buffer = Buffer; } - /* If we don't have valide buffer, ensure everything is 0-ed out */ + /* If we have to notify immediately, ensure that any buffer is 0-ed out */ if (NotifyChange->Flags & NOTIFY_IMMEDIATELY) { NotifyChange->Buffer = 0; From ed057abe8613503cf4c6e84a4853eb8de8dbe3cb Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sat, 8 Mar 2014 08:47:03 +0000 Subject: [PATCH 074/113] [VGAFONTEDIT] - Fix CMake script (for PCH) [IMAGESOFT] - Fix CMake script (for PCH) [GREEN] - Add header guard - Fix CMake script (for PCH) This fixes rosapps build with RosBE 2.1.1 CORE-7716 svn path=/trunk/; revision=62454 --- rosapps/applications/devutils/vgafontedit/CMakeLists.txt | 4 ++-- rosapps/applications/imagesoft/CMakeLists.txt | 5 +++-- rosapps/drivers/green/CMakeLists.txt | 4 ++-- rosapps/drivers/green/green.h | 5 +++++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/rosapps/applications/devutils/vgafontedit/CMakeLists.txt b/rosapps/applications/devutils/vgafontedit/CMakeLists.txt index 98408f5ed97..43bab70abbb 100644 --- a/rosapps/applications/devutils/vgafontedit/CMakeLists.txt +++ b/rosapps/applications/devutils/vgafontedit/CMakeLists.txt @@ -8,10 +8,10 @@ list(APPEND SOURCE mainwnd.c misc.c opensave.c - vgafontedit.rc) + precomp.h) +add_executable(vgafontedit ${SOURCE} vgafontedit.rc) add_pch(vgafontedit precomp.h SOURCE) -add_executable(vgafontedit ${SOURCE}) set_module_type(vgafontedit win32gui UNICODE) add_importlibs(vgafontedit user32 gdi32 comdlg32 msvcrt kernel32) add_cd_file(TARGET vgafontedit DESTINATION reactos/system32 FOR all) diff --git a/rosapps/applications/imagesoft/CMakeLists.txt b/rosapps/applications/imagesoft/CMakeLists.txt index a0f22750f34..e673619d3c3 100644 --- a/rosapps/applications/imagesoft/CMakeLists.txt +++ b/rosapps/applications/imagesoft/CMakeLists.txt @@ -13,10 +13,11 @@ list(APPEND SOURCE misc.c opensave.c tooldock.c - imagesoft.rc) + precomp.h + ) +add_executable(imagesoft ${SOURCE} imagesoft.rc) add_pch(imagesoft precomp.h SOURCE) -add_executable(imagesoft ${SOURCE}) set_module_type(imagesoft win32gui UNICODE) add_importlibs(imagesoft gdi32 user32 advapi32 version comctl32 shell32 comdlg32 msvcrt kernel32) add_cd_file(TARGET imagesoft DESTINATION reactos/system32 FOR all) diff --git a/rosapps/drivers/green/CMakeLists.txt b/rosapps/drivers/green/CMakeLists.txt index 679deef762b..7c76830e83a 100644 --- a/rosapps/drivers/green/CMakeLists.txt +++ b/rosapps/drivers/green/CMakeLists.txt @@ -8,9 +8,9 @@ list(APPEND SOURCE pnp.c power.c screen.c - green.rc) + green.h) -add_library(green SHARED ${SOURCE}) +add_library(green SHARED ${SOURCE} green.rc) add_pch(green green.h SOURCE) set_module_type(green kernelmodedriver) add_importlibs(green ntoskrnl hal) diff --git a/rosapps/drivers/green/green.h b/rosapps/drivers/green/green.h index 5c3f1b20084..3eaf1696a4b 100644 --- a/rosapps/drivers/green/green.h +++ b/rosapps/drivers/green/green.h @@ -1,3 +1,6 @@ +#ifndef __GREEN_H__ +#define __GREEN_H__ + #include #include #include @@ -191,3 +194,5 @@ GreenDuplicateUnicodeString( IN ULONG Flags, IN PCUNICODE_STRING SourceString, OUT PUNICODE_STRING DestinationString); + +#endif From b4a3df8d3f09c302d4a76afc51353b02e9e98f52 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sat, 8 Mar 2014 09:03:59 +0000 Subject: [PATCH 075/113] [NTOSKRNL] Integrate Timo's review: - Fix pointer arithmetic - Remove unless variable CORE-2582 svn path=/trunk/; revision=62455 --- reactos/ntoskrnl/fsrtl/notify.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/reactos/ntoskrnl/fsrtl/notify.c b/reactos/ntoskrnl/fsrtl/notify.c index d06b81e4394..1018edfdaef 100644 --- a/reactos/ntoskrnl/fsrtl/notify.c +++ b/reactos/ntoskrnl/fsrtl/notify.c @@ -503,12 +503,13 @@ FsRtlNotifyUpdateBuffer(OUT PFILE_NOTIFY_INFORMATION OutputBuffer, OutputBuffer->FileName[ParentName->Length / sizeof(WCHAR)] = L'\\'; AlreadyWritten = ParentName->Length + sizeof(WCHAR); } - RtlCopyMemory(OutputBuffer->FileName + AlreadyWritten, TargetName->Buffer, TargetName->Length); + RtlCopyMemory((PVOID)((ULONG_PTR)OutputBuffer->FileName + AlreadyWritten), + TargetName->Buffer, TargetName->Length); if (StreamName) { AlreadyWritten += TargetName->Length; OutputBuffer->FileName[AlreadyWritten / sizeof(WCHAR)] = L':'; - RtlCopyMemory(OutputBuffer->FileName + AlreadyWritten + sizeof(WCHAR), + RtlCopyMemory((PVOID)((ULONG_PTR)OutputBuffer->FileName + AlreadyWritten + sizeof(WCHAR)), StreamName->Buffer, StreamName->Length); } } @@ -527,7 +528,7 @@ FsRtlNotifyUpdateBuffer(OUT PFILE_NOTIFY_INFORMATION OutputBuffer, OutputBuffer->FileName[ResultSize / sizeof(WCHAR)] = L'\\'; AlreadyWritten = ResultSize + sizeof(WCHAR); - RtlOemToUnicodeN(OutputBuffer->FileName + AlreadyWritten, + RtlOemToUnicodeN((PVOID)((ULONG_PTR)OutputBuffer->FileName + AlreadyWritten), OutputBuffer->FileNameLength, &ResultSize, TargetName->Buffer, TargetName->Length); @@ -535,7 +536,7 @@ FsRtlNotifyUpdateBuffer(OUT PFILE_NOTIFY_INFORMATION OutputBuffer, { AlreadyWritten += ResultSize; OutputBuffer->FileName[AlreadyWritten / sizeof(WCHAR)] = L':'; - RtlOemToUnicodeN(OutputBuffer->FileName + AlreadyWritten + sizeof(WCHAR), + RtlOemToUnicodeN((PVOID)((ULONG_PTR)OutputBuffer->FileName + AlreadyWritten + sizeof(WCHAR)), OutputBuffer->FileNameLength, &ResultSize, StreamName->Buffer, StreamName->Length); } @@ -991,7 +992,7 @@ FsRtlNotifyFilterReportChange(IN PNOTIFY_SYNC NotifySync, BOOLEAN IsStream, IsParent, PoolQuotaCharged; STRING TargetDirectory, TargetName, ParentName, IntNormalizedParentName; ULONG NumberOfBytes, TargetNumberOfParts, FullNumberOfParts, LastPartOffset, ParentNameOffset, ParentNameLength; - ULONG DataLength, TargetNameLength, AlignedDataLength; + ULONG DataLength, AlignedDataLength; TargetDirectory.Length = 0; TargetDirectory.MaximumLength = 0; @@ -1251,16 +1252,11 @@ FsRtlNotifyFilterReportChange(IN PNOTIFY_SYNC NotifySync, } /* Look for target name & construct it, if required */ - if (TargetName.Buffer) - { - TargetNameLength = TargetName.Length; - } - else + if (TargetName.Buffer == NULL) { TargetName.Buffer = &FullTargetName->Buffer[TargetNameOffset]; - TargetNameLength = FullTargetName->Length - TargetNameOffset; - TargetName.Length = TargetNameLength; - TargetName.MaximumLength = TargetNameLength; + TargetName.Length = + TargetName.MaximumLength = FullTargetName->Length - TargetNameOffset; } /* Then, we will append it as well */ @@ -1296,8 +1292,8 @@ FsRtlNotifyFilterReportChange(IN PNOTIFY_SYNC NotifySync, } else { - OutputBuffer = 0; - FileNotifyInfo = 0; + OutputBuffer = NULL; + FileNotifyInfo = NULL; /* If we already had a buffer, update last entry position */ if (NotifyChange->Buffer != NULL) { From 4ff9f64d52c05616d5a59f8590a1325c3d772261 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 8 Mar 2014 11:28:21 +0000 Subject: [PATCH 076/113] [ACPI] Silence some debug prints svn path=/trunk/; revision=62456 --- reactos/drivers/bus/acpi/buspdo.c | 8 ++++---- reactos/drivers/bus/acpi/main.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/reactos/drivers/bus/acpi/buspdo.c b/reactos/drivers/bus/acpi/buspdo.c index e0809bb031b..cb5965f5072 100644 --- a/reactos/drivers/bus/acpi/buspdo.c +++ b/reactos/drivers/bus/acpi/buspdo.c @@ -496,8 +496,8 @@ Bus_PDO_QueryDeviceId( { acpi_bus_get_device(DeviceData->AcpiHandle, &Device); - DPRINT1("Device name: %s\n", Device->pnp.device_name); - DPRINT1("Hardware ID: %s\n", Device->pnp.hardware_id); + DPRINT("Device name: %s\n", Device->pnp.device_name); + DPRINT("Hardware ID: %s\n", Device->pnp.hardware_id); if (strcmp(Device->pnp.hardware_id, "Processor") == 0) { @@ -755,10 +755,10 @@ Bus_PDO_QueryResources( } else { - DPRINT1("Using _BBN for bus number\n"); + DPRINT("Using _BBN for bus number\n"); } - DPRINT1("Found PCI root hub: %d\n", BusNumber); + DPRINT("Found PCI root hub: %d\n", BusNumber); ResourceListSize = sizeof(CM_RESOURCE_LIST); ResourceList = (PCM_RESOURCE_LIST)ExAllocatePoolWithTag(PagedPool, ResourceListSize, 'IPCA'); diff --git a/reactos/drivers/bus/acpi/main.c b/reactos/drivers/bus/acpi/main.c index b2da79cbd67..72879a68347 100644 --- a/reactos/drivers/bus/acpi/main.c +++ b/reactos/drivers/bus/acpi/main.c @@ -457,7 +457,7 @@ GetProcessorInformation(VOID) PWCHAR Ptr; NTSTATUS Status; - DPRINT1("GetProcessorInformation()\n"); + DPRINT("GetProcessorInformation()\n"); /* Open the key for CPU 0 */ Status = AcpiRegOpenKey(NULL, From dc64b5bd63a03cf72db1107112a09461d4bb2b11 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 8 Mar 2014 11:37:03 +0000 Subject: [PATCH 077/113] [NPFS/NTOSKRNL] Silence 2 more debug prints that are not so useful. svn path=/trunk/; revision=62457 --- reactos/drivers/filesystems/npfs/main.c | 2 +- reactos/ntoskrnl/mm/ARM3/expool.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/drivers/filesystems/npfs/main.c b/reactos/drivers/filesystems/npfs/main.c index d45e00deb72..7aeff7767a0 100644 --- a/reactos/drivers/filesystems/npfs/main.c +++ b/reactos/drivers/filesystems/npfs/main.c @@ -330,7 +330,7 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject, NTSTATUS Status; UNREFERENCED_PARAMETER(RegistryPath); - DPRINT1("Next-Generation NPFS-Advanced\n"); + DPRINT("Next-Generation NPFS-Advanced\n"); Status = NpInitializeAliases(); if (!NT_SUCCESS(Status)) diff --git a/reactos/ntoskrnl/mm/ARM3/expool.c b/reactos/ntoskrnl/mm/ARM3/expool.c index 43dce905cca..4558bfa97e6 100644 --- a/reactos/ntoskrnl/mm/ARM3/expool.c +++ b/reactos/ntoskrnl/mm/ARM3/expool.c @@ -1336,7 +1336,7 @@ ExpAddTagForBigPages(IN PVOID Va, InterlockedIncrementUL(&ExpPoolBigEntriesInUse); if ((i >= 16) && (ExpPoolBigEntriesInUse > (TableSize / 4))) { - DPRINT1("Should attempt expansion since we now have %lu entries\n", + DPRINT("Should attempt expansion since we now have %lu entries\n", ExpPoolBigEntriesInUse); } From c2f825a0fec533faf9ab099a5ed62a3de7cc3a23 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 8 Mar 2014 11:51:51 +0000 Subject: [PATCH 078/113] [PSEH3] Enforce the use of a frame pointer in all functions that use PSEH, even when -fomit-frame-pointer option was specified. This way we don't need to explicitly tell PSEH with a global define, whether we have a frame pointer or not, which would also probably not have worked together with alloca(). svn path=/trunk/; revision=62458 --- reactos/include/reactos/libs/pseh/pseh3.h | 31 ++++++++++++----------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/reactos/include/reactos/libs/pseh/pseh3.h b/reactos/include/reactos/libs/pseh/pseh3.h index 16a179089a8..3ae316f6c5c 100644 --- a/reactos/include/reactos/libs/pseh/pseh3.h +++ b/reactos/include/reactos/libs/pseh/pseh3.h @@ -94,6 +94,9 @@ void * __cdecl __attribute__((error("Can only be used inside an exception filter /* CLANG specific definitions! */ #ifdef __clang__ +/* CLANG thinks it is smart and optimizes the alloca away if it is 0 and with it the use of a frame register */ +#define _SEH3$_EnforceFramePointer() asm volatile ("#\n" : : "m"(*(char*)__builtin_alloca(4)) : "%esp", "memory") + /* CLANG doesn't have asm goto! */ #define _SEH3$_ASM_GOTO(_Label, ...) @@ -137,35 +140,31 @@ _SEH3$_RegisterTryLevelWithNonVolatiles( #else /* !__clang__ */ +/* This will make GCC use ebp, even if it was disabled by -fomit-frame-pointer */ +#define _SEH3$_EnforceFramePointer() asm volatile ("#\n" : : "m"(*(char*)__builtin_alloca(0)) : "%esp", "memory") + #define _SEH3$_ASM_GOTO(_Label, ...) asm goto ("#\n" : : : "memory", ## __VA_ARGS__ : _Label) /* This is an asm wrapper around _SEH3$_RegisterFrame */ #define _SEH3$_RegisterFrame_(_TrylevelFrame, _DataTable) \ - asm goto ("leal %1, %%edx\n" \ + asm goto ("leal %0, %%eax\n" \ + "leal %1, %%edx\n" \ "call __SEH3$_RegisterFrame\n" \ : \ - : "a" (_TrylevelFrame), "m" (*(_DataTable)) \ + : "m" (*(_TrylevelFrame)), "m" (*(_DataTable)) \ : "ecx", "edx", "memory" \ : _SEH3$_l_HandlerTarget) /* This is an asm wrapper around _SEH3$_RegisterTryLevel */ #define _SEH3$_RegisterTryLevel_(_TrylevelFrame, _DataTable) \ - asm goto ("leal %1, %%edx\n" \ + asm goto ("leal %0, %%eax\n" \ + "leal %1, %%edx\n" \ "call __SEH3$_RegisterTryLevel\n" \ : \ - : "a" (_TrylevelFrame), "m" (*(_DataTable)) \ + : "m" (*(_TrylevelFrame)), "m" (*(_DataTable)) \ : "ecx", "edx", "memory" \ : _SEH3$_l_HandlerTarget) -/* Define the registers that get clobbered, when reaching the __except block. - We specify ebp on optimized builds without frame pointer, since it will be - used by GCC as a general purpose register then. */ -#if defined(__OPTIMIZE__) && defined(_ALLOW_OMIT_FRAME_POINTER) -#define _SEH3$_CLOBBER_ON_EXCEPTION "ebp", "ebx", "ecx", "edx", "esi", "edi", "flags", "memory" -#else -#define _SEH3$_CLOBBER_ON_EXCEPTION "ebx", "ecx", "edx", "esi", "edi", "flags", "memory" -#endif - /* This construct scares GCC so much, that it will stop moving code around into places that are never executed. */ #define _SEH3$_SCARE_GCC() \ @@ -174,7 +173,7 @@ _SEH3$_RegisterTryLevelWithNonVolatiles( _SEH3$_ASM_GOTO(_SEH3$_l_HandlerTarget); \ _SEH3$_ASM_GOTO(_SEH3$_l_OnException); \ asm volatile ("#" : "=a"(plabel) : "p"(&&_SEH3$_l_BeforeTry), "p"(&&_SEH3$_l_HandlerTarget), "p"(&&_SEH3$_l_OnException) \ - : _SEH3$_CLOBBER_ON_EXCEPTION ); \ + : "ebx", "ecx", "edx", "esi", "edi", "flags", "memory" ); \ goto _SEH3$_l_OnException; #endif /* __clang__ */ @@ -317,11 +316,12 @@ _SEH3$_Unregister( _SEH3$_DEFINE_DUMMY_FINALLY(_SEH3$_FinallyFunction) \ \ /* Allow intrinsics for __except to be used */ \ - _SEH3$_DECLARE_EXCEPT_INTRINSICS() \ + _SEH3$_DECLARE_EXCEPT_INTRINSICS(); \ \ goto _SEH3$_l_DoTry; \ \ _SEH3$_l_HandlerTarget: (void)0; \ + _SEH3$_EnforceFramePointer(); \ \ if (1) \ { \ @@ -355,6 +355,7 @@ _SEH3$_Unregister( goto _SEH3$_l_DoTry; \ \ _SEH3$_l_HandlerTarget: (void)0; \ + _SEH3$_EnforceFramePointer(); \ \ _SEH3$_FINALLY_FUNC_OPEN(_SEH3$_FinallyFunction) \ /* This construct makes sure that the finally function returns */ \ From 7647ccfb925e54aae5c66e1ee3dd2b2d21165802 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 8 Mar 2014 12:38:12 +0000 Subject: [PATCH 079/113] [PSEH3] Move the generation of the nested filter function to a different location svn path=/trunk/; revision=62459 --- reactos/include/reactos/libs/pseh/pseh3.h | 26 +++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/reactos/include/reactos/libs/pseh/pseh3.h b/reactos/include/reactos/libs/pseh/pseh3.h index 3ae316f6c5c..035c099b343 100644 --- a/reactos/include/reactos/libs/pseh/pseh3.h +++ b/reactos/include/reactos/libs/pseh/pseh3.h @@ -17,6 +17,20 @@ #define _SEH3$_FRAME_ALL_NONVOLATILES 1 #endif +enum +{ + _SEH3$_NESTED_HANDLER = 0, + _SEH3$_CPP_HANDLER = 1, + _SEH3$_CLANG_HANDLER = 2, +#ifdef __clang__ + _SEH3$_HANDLER_TYPE = _SEH3$_CLANG_HANDLER, +#elif defined(__cplusplus) + _SEH3$_HANDLER_TYPE = _SEH3$_CPP_HANDLER, +#else + _SEH3$_HANDLER_TYPE = _SEH3$_NESTED_HANDLER, +#endif +}; + typedef struct _SEH3$_SCOPE_TABLE { void *Target; @@ -270,6 +284,8 @@ _SEH3$_Unregister( __label__ _SEH3$_l_EndTry; \ __label__ _SEH3$_l_HandlerTarget; \ __label__ _SEH3$_l_OnException; \ + __label__ _SEH3$_l_FilterOrFinally; \ + (void)&&_SEH3$_l_FilterOrFinally; \ \ /* Count the try level. Outside of any __try, _SEH3$_TryLevel is 0 */ \ enum { \ @@ -303,14 +319,11 @@ _SEH3$_Unregister( _SEH3$_DECLARE_FILTER_FUNC(_SEH3$_FilterFunction); \ \ /* Create a static data table that contains the jump target and filter function */ \ - static const SEH3$_SCOPE_TABLE _SEH3$_ScopeTable = { &&_SEH3$_l_HandlerTarget, _SEH3$_FILTER(&_SEH3$_FilterFunction, (__VA_ARGS__)) }; \ + static const SEH3$_SCOPE_TABLE _SEH3$_ScopeTable = { &&_SEH3$_l_HandlerTarget, _SEH3$_FILTER(&_SEH3$_FilterFunction, (__VA_ARGS__)), _SEH3$_TryLevel, _SEH3$_HANDLER_TYPE }; \ \ /* Register the registration record. */ \ if (_SEH3$_TryLevel == 1) _SEH3$_RegisterFrame_(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable); \ else _SEH3$_RegisterTryLevel_(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable); \ -\ - /* Emit the filter function */ \ - _SEH3$_DEFINE_FILTER_FUNC(_SEH3$_FilterFunction, (__VA_ARGS__)) \ \ /* Define an empty inline finally function */ \ _SEH3$_DEFINE_DUMMY_FINALLY(_SEH3$_FinallyFunction) \ @@ -319,6 +332,10 @@ _SEH3$_Unregister( _SEH3$_DECLARE_EXCEPT_INTRINSICS(); \ \ goto _SEH3$_l_DoTry; \ +\ + _SEH3$_l_FilterOrFinally: (void)0; \ + /* Emit the filter function */ \ + _SEH3$_DEFINE_FILTER_FUNC(_SEH3$_FilterFunction, (__VA_ARGS__)) \ \ _SEH3$_l_HandlerTarget: (void)0; \ _SEH3$_EnforceFramePointer(); \ @@ -357,6 +374,7 @@ _SEH3$_Unregister( _SEH3$_l_HandlerTarget: (void)0; \ _SEH3$_EnforceFramePointer(); \ \ + _SEH3$_l_FilterOrFinally: (void)0; \ _SEH3$_FINALLY_FUNC_OPEN(_SEH3$_FinallyFunction) \ /* This construct makes sure that the finally function returns */ \ /* a proper value at the end */ \ From a0c9db761031f46935139ca957686f204db727fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sat, 8 Mar 2014 15:31:05 +0000 Subject: [PATCH 080/113] [KERNEL32][CONSRV] Make kernel32 / winsrv console CSR structures Win2k3-compliant. The aim is to be able to put our kernel32.dll or winsrv.dll on win2k3, and vice-versa. Most of the changes consist in: - adding a HANDLE ConsoleHandle; to the structures, representing the console handle of the current application; - reorganizing the order of the members in the different structures; - few structures need to hold a event handle because it appears that some APIs create a event handle to perform some sort of synchronization with the console server (this is totally unused at the moment). - Since CsrClientCallServer returns the value of ApiMessage.Status, then just use ApiMessage.Status instead of declaring another Status variable for querying the return value of CsrClientCallServer. Part 1/X Aside: The VerifyConsoleIoHandle winetest problem is solved here (see CORE-7941 for more details). CORE-7941 #resolved #comment Fixed in revision 62460, thanks :) CORE-7931 svn path=/trunk/; revision=62460 --- .../win32/kernel32/client/console/console.c | 448 ++++++++++-------- reactos/include/psdk/wincon.h | 12 +- reactos/include/reactos/subsys/win/conmsg.h | 68 ++- .../user/winsrv/consrv/condrv/console.c | 12 +- .../user/winsrv/consrv/condrv/dummyfrontend.c | 8 +- .../win32ss/user/winsrv/consrv/condrv/text.c | 31 +- .../win32ss/user/winsrv/consrv/conoutput.c | 18 +- reactos/win32ss/user/winsrv/consrv/console.c | 30 +- .../win32ss/user/winsrv/consrv/frontendctl.c | 10 +- .../winsrv/consrv/frontends/gui/guisettings.h | 4 +- .../winsrv/consrv/frontends/gui/guiterm.c | 27 +- .../winsrv/consrv/frontends/tui/tuiterm.c | 8 +- reactos/win32ss/user/winsrv/consrv/handle.c | 17 +- .../user/winsrv/consrv/include/conio.h | 8 +- .../win32ss/user/winsrv/consrv/include/term.h | 8 +- 15 files changed, 408 insertions(+), 301 deletions(-) diff --git a/reactos/dll/win32/kernel32/client/console/console.c b/reactos/dll/win32/kernel32/client/console/console.c index 12d820cf18a..e4a3367bf97 100644 --- a/reactos/dll/win32/kernel32/client/console/console.c +++ b/reactos/dll/win32/kernel32/client/console/console.c @@ -252,17 +252,18 @@ ConsoleMenuControl(HANDLE hConsoleOutput, CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_MENUCONTROL MenuControlRequest = &ApiMessage.Data.MenuControlRequest; - MenuControlRequest->OutputHandle = hConsoleOutput; - MenuControlRequest->dwCmdIdLow = dwCmdIdLow; - MenuControlRequest->dwCmdIdHigh = dwCmdIdHigh; - MenuControlRequest->hMenu = NULL; + MenuControlRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + MenuControlRequest->OutputHandle = hConsoleOutput; + MenuControlRequest->CmdIdLow = dwCmdIdLow; + MenuControlRequest->CmdIdHigh = dwCmdIdHigh; + MenuControlRequest->MenuHandle = NULL; CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, NULL, CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepMenuControl), - sizeof(CONSOLE_MENUCONTROL)); + sizeof(*MenuControlRequest)); - return MenuControlRequest->hMenu; + return MenuControlRequest->MenuHandle; } @@ -314,7 +315,6 @@ BOOL WINAPI GetConsoleDisplayMode(LPDWORD lpModeFlags) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_GETDISPLAYMODE GetDisplayModeRequest = &ApiMessage.Data.GetDisplayModeRequest; @@ -324,19 +324,19 @@ GetConsoleDisplayMode(LPDWORD lpModeFlags) return FALSE; } - // GetDisplayModeRequest->OutputHandle = hConsoleOutput; + GetDisplayModeRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetDisplayMode), - sizeof(CONSOLE_GETDISPLAYMODE)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetDisplayMode), + sizeof(*GetDisplayModeRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } - *lpModeFlags = GetDisplayModeRequest->DisplayMode; + *lpModeFlags = GetDisplayModeRequest->DisplayMode; // ModeFlags return TRUE; } @@ -378,33 +378,34 @@ GetConsoleFontSize(HANDLE hConsoleOutput, BOOL WINAPI GetConsoleHardwareState(HANDLE hConsoleOutput, - DWORD Flags, + PDWORD Flags, PDWORD State) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_GETSETHWSTATE HardwareStateRequest = &ApiMessage.Data.HardwareStateRequest; DPRINT1("GetConsoleHardwareState(%lu, 0x%p) UNIMPLEMENTED!\n", Flags, State); - if (State == NULL) + if (Flags == NULL || State == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - HardwareStateRequest->OutputHandle = hConsoleOutput; + HardwareStateRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + HardwareStateRequest->OutputHandle = hConsoleOutput; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetHardwareState), - sizeof(CONSOLE_GETSETHWSTATE)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetHardwareState), + sizeof(*HardwareStateRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } + *Flags = HardwareStateRequest->Flags; *State = HardwareStateRequest->State; return TRUE; } @@ -458,7 +459,6 @@ WINAPI InvalidateConsoleDIBits(IN HANDLE hConsoleOutput, IN PSMALL_RECT lpRect) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_INVALIDATEDIBITS InvalidateDIBitsRequest = &ApiMessage.Data.InvalidateDIBitsRequest; @@ -468,16 +468,17 @@ InvalidateConsoleDIBits(IN HANDLE hConsoleOutput, return FALSE; } - InvalidateDIBitsRequest->OutputHandle = hConsoleOutput; - InvalidateDIBitsRequest->Region = *lpRect; + InvalidateDIBitsRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + InvalidateDIBitsRequest->OutputHandle = hConsoleOutput; + InvalidateDIBitsRequest->Region = *lpRect; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepInvalidateBitMapRect), - sizeof(CONSOLE_INVALIDATEDIBITS)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepInvalidateBitMapRect), + sizeof(*InvalidateDIBitsRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } @@ -546,23 +547,23 @@ OpenConsoleW(LPCWSTR wsName, */ BOOL WINAPI -SetConsoleCursor(HANDLE hConsoleOutput, +SetConsoleCursor(HANDLE hConsoleOutput, HCURSOR hCursor) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_SETCURSOR SetCursorRequest = &ApiMessage.Data.SetCursorRequest; - SetCursorRequest->OutputHandle = hConsoleOutput; - SetCursorRequest->hCursor = hCursor; + SetCursorRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + SetCursorRequest->OutputHandle = hConsoleOutput; + SetCursorRequest->CursorHandle = hCursor; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetCursor), - sizeof(CONSOLE_SETCURSOR)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetCursor), + sizeof(*SetCursorRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } @@ -576,25 +577,26 @@ SetConsoleCursor(HANDLE hConsoleOutput, BOOL WINAPI SetConsoleDisplayMode(HANDLE hConsoleOutput, - DWORD dwFlags, + DWORD dwFlags, // dwModeFlags PCOORD lpNewScreenBufferDimensions) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_SETDISPLAYMODE SetDisplayModeRequest = &ApiMessage.Data.SetDisplayModeRequest; - SetDisplayModeRequest->OutputHandle = hConsoleOutput; - SetDisplayModeRequest->DisplayMode = dwFlags; - SetDisplayModeRequest->NewSBDim.X = 0; - SetDisplayModeRequest->NewSBDim.Y = 0; + SetDisplayModeRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + SetDisplayModeRequest->OutputHandle = hConsoleOutput; + SetDisplayModeRequest->DisplayMode = dwFlags; // ModeFlags ; dwModeFlags + SetDisplayModeRequest->NewSBDim.X = 0; + SetDisplayModeRequest->NewSBDim.Y = 0; + /* SetDisplayModeRequest->EventHandle; */ - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetDisplayMode), - sizeof(CONSOLE_SETDISPLAYMODE)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetDisplayMode), + sizeof(*SetDisplayModeRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } @@ -628,22 +630,23 @@ SetConsoleHardwareState(HANDLE hConsoleOutput, DWORD Flags, DWORD State) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_GETSETHWSTATE HardwareStateRequest = &ApiMessage.Data.HardwareStateRequest; DPRINT1("SetConsoleHardwareState(%lu, %lu) UNIMPLEMENTED!\n", Flags, State); - HardwareStateRequest->OutputHandle = hConsoleOutput; - HardwareStateRequest->State = State; + HardwareStateRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + HardwareStateRequest->OutputHandle = hConsoleOutput; + HardwareStateRequest->Flags = Flags; + HardwareStateRequest->State = State; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetHardwareState), - sizeof(CONSOLE_GETSETHWSTATE)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetHardwareState), + sizeof(*HardwareStateRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } @@ -690,19 +693,19 @@ BOOL WINAPI SetConsoleMenuClose(BOOL bEnable) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_SETMENUCLOSE SetMenuCloseRequest = &ApiMessage.Data.SetMenuCloseRequest; - SetMenuCloseRequest->Enable = bEnable; + SetMenuCloseRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + SetMenuCloseRequest->Enable = bEnable; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetMenuClose), - sizeof(CONSOLE_SETMENUCLOSE)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetMenuClose), + sizeof(*SetMenuCloseRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } @@ -721,21 +724,21 @@ SetConsolePalette(HANDLE hConsoleOutput, HPALETTE hPalette, UINT dwUsage) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_SETPALETTE SetPaletteRequest = &ApiMessage.Data.SetPaletteRequest; + SetPaletteRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; SetPaletteRequest->OutputHandle = hConsoleOutput; SetPaletteRequest->PaletteHandle = hPalette; SetPaletteRequest->Usage = dwUsage; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetPalette), - sizeof(CONSOLE_SETPALETTE)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetPalette), + sizeof(*SetPaletteRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } @@ -754,14 +757,15 @@ ShowConsoleCursor(HANDLE hConsoleOutput, CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_SHOWCURSOR ShowCursorRequest = &ApiMessage.Data.ShowCursorRequest; - ShowCursorRequest->OutputHandle = hConsoleOutput; - ShowCursorRequest->Show = bShow; - ShowCursorRequest->RefCount = 0; + ShowCursorRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + ShowCursorRequest->OutputHandle = hConsoleOutput; + ShowCursorRequest->Show = bShow; + ShowCursorRequest->RefCount = 0; CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, NULL, CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepShowCursor), - sizeof(CONSOLE_SHOWCURSOR)); + sizeof(*ShowCursorRequest)); return ShowCursorRequest->RefCount; } @@ -771,10 +775,10 @@ ShowConsoleCursor(HANDLE hConsoleOutput, * FUNCTION: Checks whether the given handle is a valid console handle. * * ARGUMENTS: - * Handle - Handle to be checked + * hIoHandle - Handle to be checked. * * RETURNS: - * TRUE: Handle is a valid console handle + * TRUE : Handle is a valid console handle. * FALSE: Handle is not a valid console handle. * * STATUS: Officially undocumented @@ -783,24 +787,29 @@ ShowConsoleCursor(HANDLE hConsoleOutput, */ BOOL WINAPI -VerifyConsoleIoHandle(HANDLE Handle) +VerifyConsoleIoHandle(HANDLE hIoHandle) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_VERIFYHANDLE VerifyHandleRequest = &ApiMessage.Data.VerifyHandleRequest; - ApiMessage.Data.VerifyHandleRequest.ConsoleHandle = Handle; + VerifyHandleRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + VerifyHandleRequest->Handle = hIoHandle; + VerifyHandleRequest->IsValid = FALSE; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepVerifyIoHandle), - sizeof(CONSOLE_VERIFYHANDLE)); - if (!NT_SUCCESS(Status)) + /* If the process is not attached to a console, return invalid handle */ + if (VerifyHandleRequest->ConsoleHandle == NULL) return FALSE; + + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepVerifyIoHandle), + sizeof(*VerifyHandleRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } - return TRUE; + return VerifyHandleRequest->IsValid; } @@ -809,20 +818,21 @@ VerifyConsoleIoHandle(HANDLE Handle) */ BOOL WINAPI -CloseConsoleHandle(HANDLE Handle) +CloseConsoleHandle(HANDLE hHandle) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_CLOSEHANDLE CloseHandleRequest = &ApiMessage.Data.CloseHandleRequest; - ApiMessage.Data.CloseHandleRequest.ConsoleHandle = Handle; + CloseHandleRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + CloseHandleRequest->Handle = hHandle; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepCloseHandle), - sizeof(CONSOLE_CLOSEHANDLE)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepCloseHandle), + sizeof(*CloseHandleRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } @@ -848,21 +858,27 @@ GetStdHandle(DWORD nStdHandle) */ { PRTL_USER_PROCESS_PARAMETERS Ppb = NtCurrentPeb()->ProcessParameters; + HANDLE Handle = INVALID_HANDLE_VALUE; switch (nStdHandle) { case STD_INPUT_HANDLE: - return Ppb->StandardInput; + Handle = Ppb->StandardInput; + break; case STD_OUTPUT_HANDLE: - return Ppb->StandardOutput; + Handle = Ppb->StandardOutput; + break; case STD_ERROR_HANDLE: - return Ppb->StandardError; + Handle = Ppb->StandardError; + break; } - SetLastError(ERROR_INVALID_HANDLE); - return INVALID_HANDLE_VALUE; + /* If the returned handle is invalid, set last error */ + if (Handle == INVALID_HANDLE_VALUE) SetLastError(ERROR_INVALID_HANDLE); + + return Handle; } @@ -871,7 +887,7 @@ GetStdHandle(DWORD nStdHandle) */ BOOL WINAPI -SetStdHandle(DWORD nStdHandle, +SetStdHandle(DWORD nStdHandle, HANDLE hHandle) /* * FUNCTION: Set the handle for the standard input, standard output or @@ -886,7 +902,7 @@ SetStdHandle(DWORD nStdHandle, { PRTL_USER_PROCESS_PARAMETERS Ppb = NtCurrentPeb()->ProcessParameters; - /* no need to check if hHandle == INVALID_HANDLE_VALUE */ + /* No need to check if hHandle == INVALID_HANDLE_VALUE */ switch (nStdHandle) { @@ -903,7 +919,7 @@ SetStdHandle(DWORD nStdHandle, return TRUE; } - /* Windows for whatever reason sets the last error to ERROR_INVALID_HANDLE here */ + /* nStdHandle was invalid, bail out */ SetLastError(ERROR_INVALID_HANDLE); return FALSE; } @@ -1021,8 +1037,8 @@ WINAPI GetConsoleScreenBufferInfo(HANDLE hConsoleOutput, PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETSCREENBUFFERINFO ScreenBufferInfoRequest = &ApiMessage.Data.ScreenBufferInfoRequest; if (lpConsoleScreenBufferInfo == NULL) { @@ -1030,19 +1046,27 @@ GetConsoleScreenBufferInfo(HANDLE hConsoleOutput, return FALSE; } - ApiMessage.Data.ScreenBufferInfoRequest.OutputHandle = hConsoleOutput; + ScreenBufferInfoRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + ScreenBufferInfoRequest->OutputHandle = hConsoleOutput; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetScreenBufferInfo), - sizeof(CONSOLE_GETSCREENBUFFERINFO)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetScreenBufferInfo), + sizeof(*ScreenBufferInfoRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } - *lpConsoleScreenBufferInfo = ApiMessage.Data.ScreenBufferInfoRequest.Info; + lpConsoleScreenBufferInfo->dwSize = ScreenBufferInfoRequest->ScreenBufferSize; + lpConsoleScreenBufferInfo->dwCursorPosition = ScreenBufferInfoRequest->CursorPosition; + lpConsoleScreenBufferInfo->wAttributes = ScreenBufferInfoRequest->Attributes; + lpConsoleScreenBufferInfo->srWindow.Left = ScreenBufferInfoRequest->ViewOrigin.X; + lpConsoleScreenBufferInfo->srWindow.Top = ScreenBufferInfoRequest->ViewOrigin.Y; + lpConsoleScreenBufferInfo->srWindow.Right = ScreenBufferInfoRequest->ViewOrigin.X + ScreenBufferInfoRequest->ViewSize.X - 1; + lpConsoleScreenBufferInfo->srWindow.Bottom = ScreenBufferInfoRequest->ViewOrigin.Y + ScreenBufferInfoRequest->ViewSize.Y - 1; + lpConsoleScreenBufferInfo->dwMaximumWindowSize = ScreenBufferInfoRequest->MaximumViewSize; return TRUE; } @@ -1932,21 +1956,24 @@ UINT WINAPI GetConsoleCP(VOID) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETINPUTOUTPUTCP GetConsoleCPRequest = &ApiMessage.Data.GetConsoleCPRequest; /* Get the Input Code Page */ - ApiMessage.Data.ConsoleCPRequest.InputCP = TRUE; - ApiMessage.Data.ConsoleCPRequest.CodePage = 0; + GetConsoleCPRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + GetConsoleCPRequest->OutputCP = FALSE; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetCP), - sizeof(CONSOLE_GETSETINPUTOUTPUTCP)); + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetCP), + sizeof(*GetConsoleCPRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) + { + BaseSetLastNTError(ApiMessage.Status); + return 0; + } - if (!NT_SUCCESS(Status)) BaseSetLastNTError(Status); - - return ApiMessage.Data.ConsoleCPRequest.CodePage; + return GetConsoleCPRequest->CodePage; } @@ -1959,21 +1986,26 @@ BOOL WINAPI SetConsoleCP(UINT wCodePageID) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_SETINPUTOUTPUTCP SetConsoleCPRequest = &ApiMessage.Data.SetConsoleCPRequest; /* Set the Input Code Page */ - ApiMessage.Data.ConsoleCPRequest.InputCP = TRUE; - ApiMessage.Data.ConsoleCPRequest.CodePage = wCodePageID; + SetConsoleCPRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + SetConsoleCPRequest->CodePage = wCodePageID; + SetConsoleCPRequest->OutputCP = FALSE; + /* SetConsoleCPRequest->EventHandle; */ - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetCP), - sizeof(CONSOLE_GETSETINPUTOUTPUTCP)); + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetCP), + sizeof(*SetConsoleCPRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) + { + BaseSetLastNTError(ApiMessage.Status); + return FALSE; + } - if (!NT_SUCCESS(Status)) BaseSetLastNTError(Status); - - return NT_SUCCESS(Status); + return TRUE; } @@ -1986,21 +2018,24 @@ UINT WINAPI GetConsoleOutputCP(VOID) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETINPUTOUTPUTCP GetConsoleCPRequest = &ApiMessage.Data.GetConsoleCPRequest; /* Get the Output Code Page */ - ApiMessage.Data.ConsoleCPRequest.InputCP = FALSE; - ApiMessage.Data.ConsoleCPRequest.CodePage = 0; + GetConsoleCPRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + GetConsoleCPRequest->OutputCP = TRUE; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetCP), - sizeof(CONSOLE_GETSETINPUTOUTPUTCP)); + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetCP), + sizeof(*GetConsoleCPRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) + { + BaseSetLastNTError(ApiMessage.Status); + return 0; + } - if (!NT_SUCCESS(Status)) BaseSetLastNTError(Status); - - return ApiMessage.Data.ConsoleCPRequest.CodePage; + return GetConsoleCPRequest->CodePage; } @@ -2013,21 +2048,26 @@ BOOL WINAPI SetConsoleOutputCP(UINT wCodePageID) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_SETINPUTOUTPUTCP SetConsoleCPRequest = &ApiMessage.Data.SetConsoleCPRequest; /* Set the Output Code Page */ - ApiMessage.Data.ConsoleCPRequest.InputCP = FALSE; - ApiMessage.Data.ConsoleCPRequest.CodePage = wCodePageID; + SetConsoleCPRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + SetConsoleCPRequest->CodePage = wCodePageID; + SetConsoleCPRequest->OutputCP = TRUE; + /* SetConsoleCPRequest->EventHandle; */ - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetCP), - sizeof(CONSOLE_GETSETINPUTOUTPUTCP)); + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetCP), + sizeof(*SetConsoleCPRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) + { + BaseSetLastNTError(ApiMessage.Status); + return FALSE; + } - if (!NT_SUCCESS(Status)) BaseSetLastNTError(Status); - - return NT_SUCCESS(Status); + return TRUE; } @@ -2041,11 +2081,10 @@ WINAPI GetConsoleProcessList(LPDWORD lpdwProcessList, DWORD dwProcessCount) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_GETPROCESSLIST GetProcessListRequest = &ApiMessage.Data.GetProcessListRequest; PCSR_CAPTURE_BUFFER CaptureBuffer; - ULONG nProcesses; + ULONG nProcesses = 0; if (lpdwProcessList == NULL || dwProcessCount == 0) { @@ -2058,30 +2097,30 @@ GetConsoleProcessList(LPDWORD lpdwProcessList, { DPRINT1("CsrAllocateCaptureBuffer failed!\n"); SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; + return 0; } - GetProcessListRequest->nMaxIds = dwProcessCount; + GetProcessListRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + GetProcessListRequest->ProcessCount = dwProcessCount; CsrAllocateMessagePointer(CaptureBuffer, dwProcessCount * sizeof(DWORD), - (PVOID*)&GetProcessListRequest->pProcessIds); + (PVOID*)&GetProcessListRequest->ProcessIdsList); - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - CaptureBuffer, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetProcessList), - sizeof(CONSOLE_GETPROCESSLIST)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetProcessList), + sizeof(*GetProcessListRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError (Status); - nProcesses = 0; + BaseSetLastNTError(ApiMessage.Status); } else { - nProcesses = GetProcessListRequest->nProcessIdsTotal; + nProcesses = GetProcessListRequest->ProcessCount; if (dwProcessCount >= nProcesses) { - memcpy(lpdwProcessList, GetProcessListRequest->pProcessIds, nProcesses * sizeof(DWORD)); + memcpy(lpdwProcessList, GetProcessListRequest->ProcessIdsList, nProcesses * sizeof(DWORD)); } } @@ -2099,8 +2138,8 @@ BOOL WINAPI GetConsoleSelectionInfo(PCONSOLE_SELECTION_INFO lpConsoleSelectionInfo) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETSELECTIONINFO GetSelectionInfoRequest = &ApiMessage.Data.GetSelectionInfoRequest; if (lpConsoleSelectionInfo == NULL) { @@ -2108,17 +2147,19 @@ GetConsoleSelectionInfo(PCONSOLE_SELECTION_INFO lpConsoleSelectionInfo) return FALSE; } - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetSelectionInfo), - sizeof(CONSOLE_GETSELECTIONINFO)); - if (!NT_SUCCESS(Status)) + GetSelectionInfoRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetSelectionInfo), + sizeof(*GetSelectionInfoRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } - *lpConsoleSelectionInfo = ApiMessage.Data.GetSelectionInfoRequest.Info; + *lpConsoleSelectionInfo = GetSelectionInfoRequest->Info; return TRUE; } @@ -2183,20 +2224,22 @@ HWND WINAPI GetConsoleWindow(VOID) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETWINDOW GetWindowRequest = &ApiMessage.Data.GetWindowRequest; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetConsoleWindow), - sizeof(CONSOLE_GETWINDOW)); - if (!NT_SUCCESS(Status)) + GetWindowRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetConsoleWindow), + sizeof(*GetWindowRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return (HWND)NULL; } - return ApiMessage.Data.GetWindowRequest.WindowHandle; + return GetWindowRequest->WindowHandle; } @@ -2207,24 +2250,25 @@ GetConsoleWindow(VOID) */ BOOL WINAPI -SetConsoleIcon(HICON hicon) +SetConsoleIcon(HICON hIcon) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_SETICON SetIconRequest = &ApiMessage.Data.SetIconRequest; - ApiMessage.Data.SetIconRequest.WindowIcon = hicon; + SetIconRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + SetIconRequest->IconHandle = hIcon; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetIcon), - sizeof(CONSOLE_SETICON)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetIcon), + sizeof(*SetIconRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } - return NT_SUCCESS(Status); + return TRUE; } diff --git a/reactos/include/psdk/wincon.h b/reactos/include/psdk/wincon.h index f03a8b19fad..b36712c7911 100644 --- a/reactos/include/psdk/wincon.h +++ b/reactos/include/psdk/wincon.h @@ -427,10 +427,10 @@ GetCurrentConsoleFont( #if (_WIN32_WINNT >= 0x0500) HWND WINAPI GetConsoleWindow(VOID); -BOOL APIENTRY GetConsoleDisplayMode(_Out_ LPDWORD lpModeFlags); +BOOL WINAPI GetConsoleDisplayMode(_Out_ LPDWORD lpModeFlags); BOOL -APIENTRY +WINAPI SetConsoleDisplayMode( _In_ HANDLE hConsoleOutput, _In_ DWORD dwFlags, @@ -607,8 +607,16 @@ BOOL WINAPI SetConsoleMenuClose(_In_ BOOL); BOOL WINAPI SetConsoleCursor(_In_ HANDLE, _In_ HCURSOR); /* Undocumented, see http://undoc.airesoft.co.uk/kernel32.dll/ShowConsoleCursor.php */ INT WINAPI ShowConsoleCursor(_In_ HANDLE, _In_ BOOL); +/* Undocumented */ +BOOL WINAPI SetConsoleIcon(_In_ HICON); /* Undocumented, see http://comments.gmane.org/gmane.comp.lang.harbour.devel/27844 */ BOOL WINAPI SetConsolePalette(_In_ HANDLE, _In_ HPALETTE, _In_ UINT); +/* Undocumented */ +BOOL WINAPI CloseConsoleHandle(_In_ HANDLE); +// HANDLE WINAPI GetStdHandle(_In_ DWORD); +// BOOL WINAPI SetStdHandle(_In_ DWORD, _In_ HANDLE); +/* Undocumented */ +BOOL WINAPI VerifyConsoleIoHandle(_In_ HANDLE); BOOL WINAPI diff --git a/reactos/include/reactos/subsys/win/conmsg.h b/reactos/include/reactos/subsys/win/conmsg.h index 71284ce5c47..04bb3bd65b5 100644 --- a/reactos/include/reactos/subsys/win/conmsg.h +++ b/reactos/include/reactos/subsys/win/conmsg.h @@ -197,9 +197,9 @@ C_ASSERT(sizeof(CONSRV_API_CONNECTINFO) == 0x638); typedef struct { - ULONG nMaxIds; - ULONG nProcessIdsTotal; - PDWORD pProcessIds; + HANDLE ConsoleHandle; + ULONG ProcessCount; + PDWORD ProcessIdsList; } CONSOLE_GETPROCESSLIST, *PCONSOLE_GETPROCESSLIST; typedef struct @@ -262,8 +262,14 @@ typedef struct typedef struct { + HANDLE ConsoleHandle; HANDLE OutputHandle; - CONSOLE_SCREEN_BUFFER_INFO Info; + COORD ScreenBufferSize; + COORD CursorPosition; + COORD ViewOrigin; + WORD Attributes; + COORD ViewSize; + COORD MaximumViewSize; } CONSOLE_GETSCREENBUFFERINFO, *PCONSOLE_GETSCREENBUFFERINFO; typedef struct @@ -274,6 +280,7 @@ typedef struct typedef struct { + HANDLE ConsoleHandle; HANDLE OutputHandle; BOOL Show; INT RefCount; @@ -281,8 +288,9 @@ typedef struct typedef struct { + HANDLE ConsoleHandle; HANDLE OutputHandle; - HCURSOR hCursor; + HCURSOR CursorHandle; } CONSOLE_SETCURSOR, *PCONSOLE_SETCURSOR; typedef struct @@ -305,15 +313,17 @@ typedef struct typedef struct { - // HANDLE OutputHandle; - DWORD DisplayMode; + HANDLE ConsoleHandle; + DWORD DisplayMode; // ModeFlags } CONSOLE_GETDISPLAYMODE, *PCONSOLE_GETDISPLAYMODE; typedef struct { + HANDLE ConsoleHandle; HANDLE OutputHandle; - DWORD DisplayMode; + DWORD DisplayMode; // ModeFlags COORD NewSBDim; + HANDLE EventHandle; } CONSOLE_SETDISPLAYMODE, *PCONSOLE_SETDISPLAYMODE; /* @@ -324,7 +334,9 @@ typedef struct typedef struct { + HANDLE ConsoleHandle; HANDLE OutputHandle; + DWORD Flags; DWORD State; } CONSOLE_GETSETHWSTATE, *PCONSOLE_GETSETHWSTATE; @@ -351,12 +363,14 @@ typedef struct typedef struct { + HANDLE ConsoleHandle; HANDLE OutputHandle; SMALL_RECT Region; } CONSOLE_INVALIDATEDIBITS, *PCONSOLE_INVALIDATEDIBITS; typedef struct { + HANDLE ConsoleHandle; HANDLE OutputHandle; HPALETTE PaletteHandle; UINT Usage; @@ -501,11 +515,14 @@ typedef struct typedef struct { HANDLE ConsoleHandle; + HANDLE Handle; } CONSOLE_CLOSEHANDLE, *PCONSOLE_CLOSEHANDLE; typedef struct { + BOOL IsValid; HANDLE ConsoleHandle; + HANDLE Handle; } CONSOLE_VERIFYHANDLE, *PCONSOLE_VERIFYHANDLE; typedef struct @@ -543,15 +560,17 @@ typedef struct typedef struct { + HANDLE ConsoleHandle; HANDLE OutputHandle; - DWORD dwCmdIdLow; - DWORD dwCmdIdHigh; - HMENU hMenu; + DWORD CmdIdLow; + DWORD CmdIdHigh; + HMENU MenuHandle; } CONSOLE_MENUCONTROL, *PCONSOLE_MENUCONTROL; typedef struct { - BOOL Enable; + HANDLE ConsoleHandle; + BOOL Enable; } CONSOLE_SETMENUCLOSE, *PCONSOLE_SETMENUCLOSE; typedef struct @@ -564,12 +583,14 @@ typedef struct typedef struct { - HWND WindowHandle; + HANDLE ConsoleHandle; + HWND WindowHandle; } CONSOLE_GETWINDOW, *PCONSOLE_GETWINDOW; typedef struct { - HICON WindowIcon; + HANDLE ConsoleHandle; + HICON IconHandle; } CONSOLE_SETICON, *PCONSOLE_SETICON; @@ -665,14 +686,24 @@ typedef struct typedef struct { + HANDLE ConsoleHandle; CONSOLE_SELECTION_INFO Info; } CONSOLE_GETSELECTIONINFO, *PCONSOLE_GETSELECTIONINFO; typedef struct { - BOOL InputCP; // TRUE : Input Code Page ; FALSE : Output Code Page - UINT CodePage; -} CONSOLE_GETSETINPUTOUTPUTCP, *PCONSOLE_GETSETINPUTOUTPUTCP; + HANDLE ConsoleHandle; + UINT CodePage; + BOOL OutputCP; // TRUE : Output Code Page ; FALSE : Input Code Page +} CONSOLE_GETINPUTOUTPUTCP, *PCONSOLE_GETINPUTOUTPUTCP; + +typedef struct +{ + HANDLE ConsoleHandle; + UINT CodePage; + BOOL OutputCP; // TRUE : Output Code Page ; FALSE : Input Code Page + HANDLE EventHandle; +} CONSOLE_SETINPUTOUTPUTCP, *PCONSOLE_SETINPUTOUTPUTCP; typedef struct _CONSOLE_API_MESSAGE { @@ -764,7 +795,8 @@ typedef struct _CONSOLE_API_MESSAGE CONSOLE_GETNUMINPUTEVENTS GetNumInputEventsRequest; /* Input and Output Code Pages */ - CONSOLE_GETSETINPUTOUTPUTCP ConsoleCPRequest; + CONSOLE_GETINPUTOUTPUTCP GetConsoleCPRequest; + CONSOLE_SETINPUTOUTPUTCP SetConsoleCPRequest; } Data; } CONSOLE_API_MESSAGE, *PCONSOLE_API_MESSAGE; diff --git a/reactos/win32ss/user/winsrv/consrv/condrv/console.c b/reactos/win32ss/user/winsrv/consrv/condrv/console.c index ccc1189b93b..338be5abaec 100644 --- a/reactos/win32ss/user/winsrv/consrv/condrv/console.c +++ b/reactos/win32ss/user/winsrv/consrv/condrv/console.c @@ -1007,12 +1007,12 @@ ConDrvSetConsoleTitle(IN PCONSOLE Console, NTSTATUS NTAPI ConDrvGetConsoleCP(IN PCONSOLE Console, OUT PUINT CodePage, - IN BOOLEAN InputCP) + IN BOOLEAN OutputCP) { if (Console == NULL || CodePage == NULL) return STATUS_INVALID_PARAMETER; - *CodePage = (InputCP ? Console->CodePage : Console->OutputCodePage); + *CodePage = (OutputCP ? Console->OutputCodePage : Console->CodePage); return STATUS_SUCCESS; } @@ -1020,15 +1020,15 @@ ConDrvGetConsoleCP(IN PCONSOLE Console, NTSTATUS NTAPI ConDrvSetConsoleCP(IN PCONSOLE Console, IN UINT CodePage, - IN BOOLEAN InputCP) + IN BOOLEAN OutputCP) { if (Console == NULL || !IsValidCodePage(CodePage)) return STATUS_INVALID_PARAMETER; - if (InputCP) - Console->CodePage = CodePage; - else + if (OutputCP) Console->OutputCodePage = CodePage; + else + Console->CodePage = CodePage; return STATUS_SUCCESS; } diff --git a/reactos/win32ss/user/winsrv/consrv/condrv/dummyfrontend.c b/reactos/win32ss/user/winsrv/consrv/condrv/dummyfrontend.c index 85a54be96cf..794aae2c5ff 100644 --- a/reactos/win32ss/user/winsrv/consrv/condrv/dummyfrontend.c +++ b/reactos/win32ss/user/winsrv/consrv/condrv/dummyfrontend.c @@ -99,7 +99,7 @@ DummyChangeTitle(IN OUT PFRONTEND This) static BOOL NTAPI DummyChangeIcon(IN OUT PFRONTEND This, - HICON hWindowIcon) + HICON IconHandle) { return TRUE; } @@ -146,15 +146,15 @@ DummyShowMouseCursor(IN OUT PFRONTEND This, static BOOL NTAPI DummySetMouseCursor(IN OUT PFRONTEND This, - HCURSOR hCursor) + HCURSOR CursorHandle) { return TRUE; } static HMENU NTAPI DummyMenuControl(IN OUT PFRONTEND This, - UINT cmdIdLow, - UINT cmdIdHigh) + UINT CmdIdLow, + UINT CmdIdHigh) { return NULL; } diff --git a/reactos/win32ss/user/winsrv/consrv/condrv/text.c b/reactos/win32ss/user/winsrv/consrv/condrv/text.c index 7c44235d219..5c1ab108d7e 100644 --- a/reactos/win32ss/user/winsrv/consrv/condrv/text.c +++ b/reactos/win32ss/user/winsrv/consrv/condrv/text.c @@ -1153,26 +1153,33 @@ ConDrvFillConsoleOutput(IN PCONSOLE Console, } NTSTATUS NTAPI -ConDrvGetConsoleScreenBufferInfo(IN PCONSOLE Console, - IN PTEXTMODE_SCREEN_BUFFER Buffer, - OUT PCONSOLE_SCREEN_BUFFER_INFO ScreenBufferInfo) +ConDrvGetConsoleScreenBufferInfo(IN PCONSOLE Console, + IN PTEXTMODE_SCREEN_BUFFER Buffer, + OUT PCOORD ScreenBufferSize, + OUT PCOORD CursorPosition, + OUT PCOORD ViewOrigin, + OUT PCOORD ViewSize, + OUT PCOORD MaximumViewSize, + OUT PWORD Attributes) { - if (Console == NULL || Buffer == NULL || ScreenBufferInfo == NULL) + if (Console == NULL || Buffer == NULL || ScreenBufferSize == NULL || + CursorPosition == NULL || ViewOrigin == NULL || ViewSize == NULL || + MaximumViewSize == NULL || Attributes == NULL) + { return STATUS_INVALID_PARAMETER; + } /* Validity check */ ASSERT(Console == Buffer->Header.Console); - ScreenBufferInfo->dwSize = Buffer->ScreenBufferSize; - ScreenBufferInfo->dwCursorPosition = Buffer->CursorPosition; - ScreenBufferInfo->wAttributes = Buffer->ScreenDefaultAttrib; - ScreenBufferInfo->srWindow.Left = Buffer->ViewOrigin.X; - ScreenBufferInfo->srWindow.Top = Buffer->ViewOrigin.Y; - ScreenBufferInfo->srWindow.Right = Buffer->ViewOrigin.X + Buffer->ViewSize.X - 1; - ScreenBufferInfo->srWindow.Bottom = Buffer->ViewOrigin.Y + Buffer->ViewSize.Y - 1; + *ScreenBufferSize = Buffer->ScreenBufferSize; + *CursorPosition = Buffer->CursorPosition; + *ViewOrigin = Buffer->ViewOrigin; + *ViewSize = Buffer->ViewSize; + *Attributes = Buffer->ScreenDefaultAttrib; // FIXME: Refine the computation - ScreenBufferInfo->dwMaximumWindowSize = Buffer->ScreenBufferSize; + *MaximumViewSize = Buffer->ScreenBufferSize; return STATUS_SUCCESS; } diff --git a/reactos/win32ss/user/winsrv/consrv/conoutput.c b/reactos/win32ss/user/winsrv/consrv/conoutput.c index d2571b12cd9..fe04b8bd5fc 100644 --- a/reactos/win32ss/user/winsrv/consrv/conoutput.c +++ b/reactos/win32ss/user/winsrv/consrv/conoutput.c @@ -683,9 +683,14 @@ CSR_API(SrvFillConsoleOutput) } NTSTATUS NTAPI -ConDrvGetConsoleScreenBufferInfo(IN PCONSOLE Console, - IN PTEXTMODE_SCREEN_BUFFER Buffer, - OUT PCONSOLE_SCREEN_BUFFER_INFO ScreenBufferInfo); +ConDrvGetConsoleScreenBufferInfo(IN PCONSOLE Console, + IN PTEXTMODE_SCREEN_BUFFER Buffer, + OUT PCOORD ScreenBufferSize, + OUT PCOORD CursorPosition, + OUT PCOORD ViewOrigin, + OUT PCOORD ViewSize, + OUT PCOORD MaximumViewSize, + OUT PWORD Attributes); CSR_API(SrvGetConsoleScreenBufferInfo) { NTSTATUS Status; @@ -701,7 +706,12 @@ CSR_API(SrvGetConsoleScreenBufferInfo) Status = ConDrvGetConsoleScreenBufferInfo(Buffer->Header.Console, Buffer, - &ScreenBufferInfoRequest->Info); + &ScreenBufferInfoRequest->ScreenBufferSize, + &ScreenBufferInfoRequest->CursorPosition, + &ScreenBufferInfoRequest->ViewOrigin, + &ScreenBufferInfoRequest->ViewSize, + &ScreenBufferInfoRequest->MaximumViewSize, + &ScreenBufferInfoRequest->Attributes); ConSrvReleaseScreenBuffer(Buffer, TRUE); return Status; diff --git a/reactos/win32ss/user/winsrv/consrv/console.c b/reactos/win32ss/user/winsrv/consrv/console.c index f9152e0e02d..8cc401abe5b 100644 --- a/reactos/win32ss/user/winsrv/consrv/console.c +++ b/reactos/win32ss/user/winsrv/consrv/console.c @@ -543,22 +543,22 @@ CSR_API(SrvSetConsoleTitle) NTSTATUS NTAPI ConDrvGetConsoleCP(IN PCONSOLE Console, OUT PUINT CodePage, - IN BOOLEAN InputCP); + IN BOOLEAN OutputCP); CSR_API(SrvGetConsoleCP) { NTSTATUS Status; - PCONSOLE_GETSETINPUTOUTPUTCP ConsoleCPRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleCPRequest; + PCONSOLE_GETINPUTOUTPUTCP GetConsoleCPRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetConsoleCPRequest; PCONSOLE Console; DPRINT("SrvGetConsoleCP, getting %s Code Page\n", - ConsoleCPRequest->InputCP ? "Input" : "Output"); + GetConsoleCPRequest->OutputCP ? "Output" : "Input"); Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE); if (!NT_SUCCESS(Status)) return Status; Status = ConDrvGetConsoleCP(Console, - &ConsoleCPRequest->CodePage, - ConsoleCPRequest->InputCP); + &GetConsoleCPRequest->CodePage, + GetConsoleCPRequest->OutputCP); ConSrvReleaseConsole(Console, TRUE); return Status; @@ -567,22 +567,22 @@ CSR_API(SrvGetConsoleCP) NTSTATUS NTAPI ConDrvSetConsoleCP(IN PCONSOLE Console, IN UINT CodePage, - IN BOOLEAN InputCP); + IN BOOLEAN OutputCP); CSR_API(SrvSetConsoleCP) { NTSTATUS Status = STATUS_INVALID_PARAMETER; - PCONSOLE_GETSETINPUTOUTPUTCP ConsoleCPRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleCPRequest; + PCONSOLE_SETINPUTOUTPUTCP SetConsoleCPRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetConsoleCPRequest; PCONSOLE Console; DPRINT("SrvSetConsoleCP, setting %s Code Page\n", - ConsoleCPRequest->InputCP ? "Input" : "Output"); + SetConsoleCPRequest->OutputCP ? "Output" : "Input"); Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE); if (!NT_SUCCESS(Status)) return Status; Status = ConDrvSetConsoleCP(Console, - ConsoleCPRequest->CodePage, - ConsoleCPRequest->InputCP); + SetConsoleCPRequest->CodePage, + SetConsoleCPRequest->OutputCP); ConSrvReleaseConsole(Console, TRUE); return Status; @@ -600,8 +600,8 @@ CSR_API(SrvGetConsoleProcessList) PCONSOLE Console; if (!CsrValidateMessageBuffer(ApiMessage, - (PVOID)&GetProcessListRequest->pProcessIds, - GetProcessListRequest->nMaxIds, + (PVOID)&GetProcessListRequest->ProcessIdsList, + GetProcessListRequest->ProcessCount, sizeof(DWORD))) { return STATUS_INVALID_PARAMETER; @@ -611,9 +611,9 @@ CSR_API(SrvGetConsoleProcessList) if (!NT_SUCCESS(Status)) return Status; Status = ConDrvGetConsoleProcessList(Console, - GetProcessListRequest->pProcessIds, - GetProcessListRequest->nMaxIds, - &GetProcessListRequest->nProcessIdsTotal); + GetProcessListRequest->ProcessIdsList, + GetProcessListRequest->ProcessCount, + &GetProcessListRequest->ProcessCount); ConSrvReleaseConsole(Console, TRUE); return Status; diff --git a/reactos/win32ss/user/winsrv/consrv/frontendctl.c b/reactos/win32ss/user/winsrv/consrv/frontendctl.c index 5d175b4df36..7294fa74d1b 100644 --- a/reactos/win32ss/user/winsrv/consrv/frontendctl.c +++ b/reactos/win32ss/user/winsrv/consrv/frontendctl.c @@ -222,7 +222,7 @@ CSR_API(SrvSetConsoleCursor) Console = Buff->Header.Console; - Success = TermSetMouseCursor(Console, SetCursorRequest->hCursor); + Success = TermSetMouseCursor(Console, SetCursorRequest->CursorHandle); ConSrvReleaseScreenBuffer(Buff, TRUE); return (Success ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL); @@ -244,9 +244,9 @@ CSR_API(SrvConsoleMenuControl) Console = Buff->Header.Console; - MenuControlRequest->hMenu = TermMenuControl(Console, - MenuControlRequest->dwCmdIdLow, - MenuControlRequest->dwCmdIdHigh); + MenuControlRequest->MenuHandle = TermMenuControl(Console, + MenuControlRequest->CmdIdLow, + MenuControlRequest->CmdIdHigh); ConSrvReleaseScreenBuffer(Buff, TRUE); return STATUS_SUCCESS; @@ -293,7 +293,7 @@ CSR_API(SrvSetConsoleIcon) Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE); if (!NT_SUCCESS(Status)) return Status; - Status = (TermChangeIcon(Console, SetIconRequest->WindowIcon) + Status = (TermChangeIcon(Console, SetIconRequest->IconHandle) ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL); diff --git a/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.h b/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.h index 9851a36dffe..5041dadedc1 100644 --- a/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.h +++ b/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.h @@ -64,8 +64,8 @@ typedef struct _GUI_CONSOLE_DATA BOOL IgnoreNextMouseSignal; /* Used in cases where we don't want to treat a mouse signal */ BOOL IsCloseButtonEnabled; /* TRUE if the Close button and the corresponding system menu item are enabled (default), FALSE otherwise */ - UINT cmdIdLow ; /* Lowest menu id of the user-reserved menu id range */ - UINT cmdIdHigh; /* Highest menu id of the user-reserved menu id range */ + UINT CmdIdLow ; /* Lowest menu id of the user-reserved menu id range */ + UINT CmdIdHigh; /* Highest menu id of the user-reserved menu id range */ // COLORREF Colors[16]; diff --git a/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c b/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c index 7db806cff86..bffeeca0926 100644 --- a/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c +++ b/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c @@ -231,6 +231,7 @@ GuiSendMenuEvent(PCONSOLE Console, UINT CmdId) er.EventType = MENU_EVENT; er.Event.MenuEvent.dwCommandId = CmdId; + DPRINT1("Menu item ID: %d\n", CmdId); ConioProcessInputEvent(Console, &er); } @@ -265,7 +266,7 @@ GuiConsoleHandleSysMenuCommand(PGUI_CONSOLE_DATA GuiData, WPARAM wParam, LPARAM * send to him a menu event and return directly. The user must handle those * reserved menu commands... */ - if (GuiData->cmdIdLow <= (UINT)wParam && (UINT)wParam <= GuiData->cmdIdHigh) + if (GuiData->CmdIdLow <= (UINT)wParam && (UINT)wParam <= GuiData->CmdIdHigh) { GuiSendMenuEvent(Console, (UINT)wParam); goto Unlock_Quit; @@ -2462,7 +2463,7 @@ GuiInitFrontEnd(IN OUT PFRONTEND This, GuiData->IsCloseButtonEnabled = TRUE; /* There is no user-reserved menu id range by default */ - GuiData->cmdIdLow = GuiData->cmdIdHigh = 0; + GuiData->CmdIdLow = GuiData->CmdIdHigh = 0; /* * We need to wait until the GUI has been fully initialized @@ -2747,7 +2748,7 @@ GuiProcessKeyCallback(IN OUT PFRONTEND This, static BOOL NTAPI GuiSetMouseCursor(IN OUT PFRONTEND This, - HCURSOR hCursor); + HCURSOR CursorHandle); static VOID NTAPI GuiRefreshInternalInfo(IN OUT PFRONTEND This) @@ -2781,20 +2782,20 @@ GuiChangeTitle(IN OUT PFRONTEND This) static BOOL NTAPI GuiChangeIcon(IN OUT PFRONTEND This, - HICON hWindowIcon) + HICON IconHandle) { PGUI_CONSOLE_DATA GuiData = This->Data; HICON hIcon, hIconSm; - if (hWindowIcon == NULL) + if (IconHandle == NULL) { hIcon = ghDefaultIcon; hIconSm = ghDefaultIconSm; } else { - hIcon = CopyIcon(hWindowIcon); - hIconSm = CopyIcon(hWindowIcon); + hIcon = CopyIcon(IconHandle); + hIconSm = CopyIcon(IconHandle); } if (hIcon == NULL) @@ -2953,7 +2954,7 @@ GuiShowMouseCursor(IN OUT PFRONTEND This, static BOOL NTAPI GuiSetMouseCursor(IN OUT PFRONTEND This, - HCURSOR hCursor) + HCURSOR CursorHandle) { PGUI_CONSOLE_DATA GuiData = This->Data; @@ -2961,7 +2962,7 @@ GuiSetMouseCursor(IN OUT PFRONTEND This, * Set the cursor's handle. If the given handle is NULL, * then restore the default cursor. */ - GuiData->hCursor = (hCursor ? hCursor : ghDefaultCursor); + GuiData->hCursor = (CursorHandle ? CursorHandle : ghDefaultCursor); /* Effectively modify the shape of the cursor (use special values for (w|l)Param) */ PostMessageW(GuiData->hWindow, WM_SETCURSOR, -1, -1); @@ -2971,13 +2972,13 @@ GuiSetMouseCursor(IN OUT PFRONTEND This, static HMENU NTAPI GuiMenuControl(IN OUT PFRONTEND This, - UINT cmdIdLow, - UINT cmdIdHigh) + UINT CmdIdLow, + UINT CmdIdHigh) { PGUI_CONSOLE_DATA GuiData = This->Data; - GuiData->cmdIdLow = cmdIdLow ; - GuiData->cmdIdHigh = cmdIdHigh; + GuiData->CmdIdLow = CmdIdLow ; + GuiData->CmdIdHigh = CmdIdHigh; return GetSystemMenu(GuiData->hWindow, FALSE); } diff --git a/reactos/win32ss/user/winsrv/consrv/frontends/tui/tuiterm.c b/reactos/win32ss/user/winsrv/consrv/frontends/tui/tuiterm.c index 4586f7db0e7..0f3a8dad47d 100644 --- a/reactos/win32ss/user/winsrv/consrv/frontends/tui/tuiterm.c +++ b/reactos/win32ss/user/winsrv/consrv/frontends/tui/tuiterm.c @@ -726,7 +726,7 @@ TuiChangeTitle(IN OUT PFRONTEND This) static BOOL NTAPI TuiChangeIcon(IN OUT PFRONTEND This, - HICON hWindowIcon) + HICON IconHandle) { return TRUE; } @@ -778,15 +778,15 @@ TuiShowMouseCursor(IN OUT PFRONTEND This, static BOOL NTAPI TuiSetMouseCursor(IN OUT PFRONTEND This, - HCURSOR hCursor) + HCURSOR CursorHandle) { return TRUE; } static HMENU NTAPI TuiMenuControl(IN OUT PFRONTEND This, - UINT cmdIdLow, - UINT cmdIdHigh) + UINT CmdIdLow, + UINT CmdIdHigh) { return NULL; } diff --git a/reactos/win32ss/user/winsrv/consrv/handle.c b/reactos/win32ss/user/winsrv/consrv/handle.c index e51479da206..9f268d2513c 100644 --- a/reactos/win32ss/user/winsrv/consrv/handle.c +++ b/reactos/win32ss/user/winsrv/consrv/handle.c @@ -836,7 +836,7 @@ CSR_API(SrvCloseHandle) return Status; } - Status = ConSrvRemoveObject(ProcessData, CloseHandleRequest->ConsoleHandle); + Status = ConSrvRemoveObject(ProcessData, CloseHandleRequest->Handle); ConSrvReleaseConsole(Console, TRUE); return Status; @@ -849,8 +849,10 @@ CSR_API(SrvVerifyConsoleIoHandle) PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); PCONSOLE Console; - HANDLE ConsoleHandle = VerifyHandleRequest->ConsoleHandle; - ULONG Index = HandleToULong(ConsoleHandle) >> 2; + HANDLE IoHandle = VerifyHandleRequest->Handle; + ULONG Index = HandleToULong(IoHandle) >> 2; + + VerifyHandleRequest->IsValid = FALSE; Status = ConSrvGetConsole(ProcessData, &Console, TRUE); if (!NT_SUCCESS(Status)) @@ -864,18 +866,21 @@ CSR_API(SrvVerifyConsoleIoHandle) // ASSERT( (ProcessData->HandleTable == NULL && ProcessData->HandleTableSize == 0) || // (ProcessData->HandleTable != NULL && ProcessData->HandleTableSize != 0) ); - if (!IsConsoleHandle(ConsoleHandle) || + if (!IsConsoleHandle(IoHandle) || Index >= ProcessData->HandleTableSize || ProcessData->HandleTable[Index].Object == NULL) { DPRINT("SrvVerifyConsoleIoHandle failed\n"); - Status = STATUS_INVALID_HANDLE; + } + else + { + VerifyHandleRequest->IsValid = TRUE; } RtlLeaveCriticalSection(&ProcessData->HandleTableLock); ConSrvReleaseConsole(Console, TRUE); - return Status; + return STATUS_SUCCESS; } /* EOF */ diff --git a/reactos/win32ss/user/winsrv/consrv/include/conio.h b/reactos/win32ss/user/winsrv/consrv/include/conio.h index c54dab7b9cb..a60e95f8ca6 100644 --- a/reactos/win32ss/user/winsrv/consrv/include/conio.h +++ b/reactos/win32ss/user/winsrv/consrv/include/conio.h @@ -224,7 +224,7 @@ typedef struct _FRONTEND_VTBL */ VOID (NTAPI *ChangeTitle)(IN OUT PFRONTEND This); BOOL (NTAPI *ChangeIcon)(IN OUT PFRONTEND This, - HICON hWindowIcon); + HICON IconHandle); HWND (NTAPI *GetConsoleWindowHandle)(IN OUT PFRONTEND This); VOID (NTAPI *GetLargestConsoleWindowSize)(IN OUT PFRONTEND This, PCOORD pSize); @@ -237,10 +237,10 @@ typedef struct _FRONTEND_VTBL INT (NTAPI *ShowMouseCursor)(IN OUT PFRONTEND This, BOOL Show); BOOL (NTAPI *SetMouseCursor)(IN OUT PFRONTEND This, - HCURSOR hCursor); + HCURSOR CursorHandle); HMENU (NTAPI *MenuControl)(IN OUT PFRONTEND This, - UINT cmdIdLow, - UINT cmdIdHigh); + UINT CmdIdLow, + UINT CmdIdHigh); BOOL (NTAPI *SetMenuClose)(IN OUT PFRONTEND This, BOOL Enable); diff --git a/reactos/win32ss/user/winsrv/consrv/include/term.h b/reactos/win32ss/user/winsrv/consrv/include/term.h index f82025f60d0..c8c68ae82a9 100644 --- a/reactos/win32ss/user/winsrv/consrv/include/term.h +++ b/reactos/win32ss/user/winsrv/consrv/include/term.h @@ -32,8 +32,8 @@ #define TermChangeTitle(Console) \ (Console)->TermIFace.Vtbl->ChangeTitle(&(Console)->TermIFace) -#define TermChangeIcon(Console, hWindowIcon) \ - (Console)->TermIFace.Vtbl->ChangeIcon(&(Console)->TermIFace, (hWindowIcon)) +#define TermChangeIcon(Console, IconHandle) \ + (Console)->TermIFace.Vtbl->ChangeIcon(&(Console)->TermIFace, (IconHandle)) #define TermGetConsoleWindowHandle(Console) \ (Console)->TermIFace.Vtbl->GetConsoleWindowHandle(&(Console)->TermIFace) #define TermGetLargestConsoleWindowSize(Console, pSize) \ @@ -46,8 +46,8 @@ (Console)->TermIFace.Vtbl->SetDisplayMode(&(Console)->TermIFace, (NewMode)) #define TermShowMouseCursor(Console, Show) \ (Console)->TermIFace.Vtbl->ShowMouseCursor(&(Console)->TermIFace, (Show)) -#define TermSetMouseCursor(Console, hCursor) \ - (Console)->TermIFace.Vtbl->SetMouseCursor(&(Console)->TermIFace, (hCursor)) +#define TermSetMouseCursor(Console, CursorHandle) \ + (Console)->TermIFace.Vtbl->SetMouseCursor(&(Console)->TermIFace, (CursorHandle)) #define TermMenuControl(Console, CmdIdLow, CmdIdHigh) \ (Console)->TermIFace.Vtbl->MenuControl(&(Console)->TermIFace, (CmdIdLow), (CmdIdHigh)) #define TermSetMenuClose(Console, Enable) \ From 9602dba13e7d50e243eddaec7b9002168d5ad80b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sat, 8 Mar 2014 16:44:04 +0000 Subject: [PATCH 081/113] [CONSRV]: Fix menu ids for not clashing with user-defined ones. svn path=/trunk/; revision=62461 --- .../winsrv/consrv/frontends/gui/resource.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/reactos/win32ss/user/winsrv/consrv/frontends/gui/resource.h b/reactos/win32ss/user/winsrv/consrv/frontends/gui/resource.h index 05aeefe1783..1b79e6e8ac1 100644 --- a/reactos/win32ss/user/winsrv/consrv/frontends/gui/resource.h +++ b/reactos/win32ss/user/winsrv/consrv/frontends/gui/resource.h @@ -7,14 +7,16 @@ #pragma once -#define ID_SYSTEM_EDIT_MARK 1001 -#define ID_SYSTEM_EDIT_COPY 1002 -#define ID_SYSTEM_EDIT_PASTE 1003 -#define ID_SYSTEM_EDIT_SELECTALL 1004 -#define ID_SYSTEM_EDIT_SCROLL 1005 -#define ID_SYSTEM_EDIT_FIND 1006 -#define ID_SYSTEM_DEFAULTS 1007 -#define ID_SYSTEM_PROPERTIES 1008 +// Console System Menu Item IDs. +// Use IDs in the range 0xFFFx for not clashing with user-defined menu IDs. +#define ID_SYSTEM_EDIT_MARK 0xFFF0 +#define ID_SYSTEM_EDIT_COPY 0xFFF1 +#define ID_SYSTEM_EDIT_PASTE 0xFFF2 +#define ID_SYSTEM_EDIT_SELECTALL 0xFFF3 +#define ID_SYSTEM_EDIT_SCROLL 0xFFF4 +#define ID_SYSTEM_EDIT_FIND 0xFFF5 +#define ID_SYSTEM_DEFAULTS 0xFFF6 +#define ID_SYSTEM_PROPERTIES 0xFFF7 #define NCPOPUP_MENU 103 From 315180ba07b19cedfea120e098fd63e373ab4da5 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 8 Mar 2014 18:57:45 +0000 Subject: [PATCH 082/113] [PSEH3] Add a bit more code to support Clang and C++. svn path=/trunk/; revision=62462 --- reactos/include/reactos/libs/pseh/pseh3.h | 73 ++++++++++++++++++++--- 1 file changed, 66 insertions(+), 7 deletions(-) diff --git a/reactos/include/reactos/libs/pseh/pseh3.h b/reactos/include/reactos/libs/pseh/pseh3.h index 035c099b343..cc82a0d5b04 100644 --- a/reactos/include/reactos/libs/pseh/pseh3.h +++ b/reactos/include/reactos/libs/pseh/pseh3.h @@ -12,6 +12,10 @@ #include "excpt.h" +#ifdef __cplusplus +extern "C" { +#endif + /* CLANG must safe non-volatiles, because it uses a return-twice algorithm */ #if defined(__clang__) && !defined(_SEH3$_FRAME_ALL_NONVOLATILES) #define _SEH3$_FRAME_ALL_NONVOLATILES 1 @@ -207,6 +211,46 @@ _SEH3$_Unregister( #define _SEH3$_DECLARE_FILTER_FUNC(_Name) #define _SEH3$_DEFINE_DUMMY_FINALLY(_Name) +/* The "nested" functions are a piece of code with a ret instruction at the end */ +#define _SEH3$_NESTED_FUNC_OPEN() \ + { \ + int SavedEsp, result = 0; \ +\ + /* Save esp */ \ + asm volatile ("movl %%esp, %[SavedEsp]\n" : : [SavedEsp]"m"(SavedEsp)); + +#define _SEH3$_NESTED_FUNC_CLOSE() \ + /* Restore esp and return to the caller */ \ + asm volatile ("movl %[SavedEsp], %%esp\nret\n" \ + : : "a"(result), [SavedEsp]"irm"(SavedEsp)); \ + } + +/* The filter function */ +#define _SEH3$_DEFINE_FILTER_FUNC(_Name, expression) \ + _SEH3$_NESTED_FUNC_OPEN() \ + { \ + /* Evaluate the filter expression */ \ + result = (expression); \ + } \ + _SEH3$_NESTED_FUNC_CLOSE() + +#define _SEH3$_FINALLY_FUNC_OPEN(_Name) \ + _SEH3$_NESTED_FUNC_OPEN() \ + /* This construct makes sure that the finally function returns */ \ + /* a proper value at the end */ \ + for (; ; (void)({asm volatile ("movl %[SavedEsp], %%esp\nret\n" \ + : : "a"(result), [SavedEsp]"irm"(SavedEsp)); 0;})) + +#define _SEH3$_FILTER(_Filter, _FilterExpression) (&&_SEH3$_l_FilterOrFinally) +#define _SEH3$_FINALLY(_Finally) 0 + +#define _SEH3$_DECLARE_EXCEPT_INTRINSICS() + +/* Since we cannot use nested functions, we declare these globally as macros */ +#define _abnormal_termination() (_SEH3$_TrylevelFrame.ScopeTable != 0) +#define _exception_code() (_SEH3$_TrylevelFrame.ExceptionPointers->ExceptionRecord->ExceptionCode) +#define _exception_info() (_SEH3$_TrylevelFrame.ExceptionPointers) + #else /* __cplusplus || __clang__ */ #define _SEH3$_DECLARE_EXCEPT_INTRINSICS() \ @@ -246,11 +290,17 @@ _SEH3$_Unregister( _SEH3$_NESTED_FUNC_OPEN(_Name) \ /* Declare the intrinsics for the finally function */ \ inline __attribute__((always_inline, gnu_inline)) \ - int _abnormal_termination() { return (_SEH3$_TrylevelFrame.ScopeTable != 0); } + int _abnormal_termination() { return (_SEH3$_TrylevelFrame.ScopeTable != 0); } \ +\ + /* This construct makes sure that the finally function returns */ \ + /* a proper value at the end */ \ + for (; ; (void)({return 0; 0;})) #define _SEH3$_FILTER(_Filter, _FilterExpression) \ (__builtin_constant_p(_FilterExpression) ? (void*)(unsigned long)(unsigned char)(unsigned long)(_FilterExpression) : _Filter) +#define _SEH3$_FINALLY(_Finally) (_Finally) + #define _SEH3$_DEFINE_DUMMY_FINALLY(_Name) \ auto inline __attribute__((always_inline,gnu_inline)) int _Name(int Action) { (void)Action; return 0; } @@ -284,7 +334,9 @@ _SEH3$_Unregister( __label__ _SEH3$_l_EndTry; \ __label__ _SEH3$_l_HandlerTarget; \ __label__ _SEH3$_l_OnException; \ + __label__ _SEH3$_l_BeforeFilterOrFinally; \ __label__ _SEH3$_l_FilterOrFinally; \ + (void)&&_SEH3$_l_BeforeFilterOrFinally; \ (void)&&_SEH3$_l_FilterOrFinally; \ \ /* Count the try level. Outside of any __try, _SEH3$_TryLevel is 0 */ \ @@ -332,6 +384,10 @@ _SEH3$_Unregister( _SEH3$_DECLARE_EXCEPT_INTRINSICS(); \ \ goto _SEH3$_l_DoTry; \ +\ + _SEH3$_l_BeforeFilterOrFinally: (void)0; \ + /* Make sure the filter function doesn't use esp */ \ + _SEH3$_EnforceFramePointer(); \ \ _SEH3$_l_FilterOrFinally: (void)0; \ /* Emit the filter function */ \ @@ -363,7 +419,7 @@ _SEH3$_Unregister( _SEH3$_DECLARE_FILTER_FUNC(_SEH3$_FinallyFunction); \ \ /* Create a static data table that contains the finally function */ \ - static const SEH3$_SCOPE_TABLE _SEH3$_ScopeTable = { 0, &_SEH3$_FinallyFunction }; \ + static const SEH3$_SCOPE_TABLE _SEH3$_ScopeTable = { 0, _SEH3$_FINALLY(&_SEH3$_FinallyFunction) }; \ \ /* Register the registration record. */ \ if (_SEH3$_TryLevel == 1) _SEH3$_RegisterFrame_(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable); \ @@ -374,11 +430,9 @@ _SEH3$_Unregister( _SEH3$_l_HandlerTarget: (void)0; \ _SEH3$_EnforceFramePointer(); \ \ + _SEH3$_l_BeforeFilterOrFinally: (void)0; \ _SEH3$_l_FilterOrFinally: (void)0; \ - _SEH3$_FINALLY_FUNC_OPEN(_SEH3$_FinallyFunction) \ - /* This construct makes sure that the finally function returns */ \ - /* a proper value at the end */ \ - for (; ; (void)({return 0; 0;})) + _SEH3$_FINALLY_FUNC_OPEN(_SEH3$_FinallyFunction) #define _SEH3_END \ @@ -388,7 +442,7 @@ _SEH3$_Unregister( \ _SEH3$_l_OnException: (void)0; \ /* Force GCC to create proper code pathes */ \ - _SEH3$_SCARE_GCC() \ + _SEH3$_SCARE_GCC(); \ \ _SEH3$_l_EndTry:(void)0; \ _SEH3$_ASM_GOTO(_SEH3$_l_OnException); \ @@ -402,3 +456,8 @@ _SEH3$_Unregister( #define _SEH3_LEAVE goto _SEH3$_l_AfterTry #define _SEH3_VOLATILE volatile + + +#ifdef __cplusplus +}; // extern "C" +#endif From e4fbb93e96b3df8bab75e44bc91093ff28103f3a Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 8 Mar 2014 21:12:07 +0000 Subject: [PATCH 083/113] [LSALIB] LsaLogonUser: Pass the SubStatus to the caller before leaving the function in case of an error. svn path=/trunk/; revision=62463 --- reactos/lib/lsalib/lsa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reactos/lib/lsalib/lsa.c b/reactos/lib/lsalib/lsa.c index 7551f989cb9..210fb22854f 100644 --- a/reactos/lib/lsalib/lsa.c +++ b/reactos/lib/lsalib/lsa.c @@ -277,6 +277,8 @@ LsaLogonUser(HANDLE LsaHandle, return Status; } + *SubStatus = ApiMessage.LogonUser.Reply.SubStatus; + if (!NT_SUCCESS(ApiMessage.Status)) { return ApiMessage.Status; @@ -287,7 +289,6 @@ LsaLogonUser(HANDLE LsaHandle, *LogonId = ApiMessage.LogonUser.Reply.LogonId; *Token = ApiMessage.LogonUser.Reply.Token; *Quotas = ApiMessage.LogonUser.Reply.Quotas; - *SubStatus = ApiMessage.LogonUser.Reply.SubStatus; return Status; } From 88a9cdffba2f0dafead0f41caabfff7f67546656 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 8 Mar 2014 22:13:19 +0000 Subject: [PATCH 084/113] [MSGINA] - Split DoLoginTasks into DoLoginTasks and CreateProfile, and fix all callers of DoLoginTasks accordingly. - Make DoLoginTasks pass the SubStatus from MyLogonUser to its caller. - Move the logon code from LoggedOutWindowProc to a new function DoLogon and add some experimental code to report logon errors to the user (still WIP). svn path=/trunk/; revision=62464 --- reactos/dll/win32/msgina/gui.c | 121 ++++++++++++++++++++++-------- reactos/dll/win32/msgina/msgina.c | 68 +++++++++++------ reactos/dll/win32/msgina/msgina.h | 10 ++- reactos/dll/win32/msgina/tui.c | 14 +++- 4 files changed, 153 insertions(+), 60 deletions(-) diff --git a/reactos/dll/win32/msgina/gui.c b/reactos/dll/win32/msgina/gui.c index e9ad0a99276..0fc6b0bc0c8 100644 --- a/reactos/dll/win32/msgina/gui.c +++ b/reactos/dll/win32/msgina/gui.c @@ -920,6 +920,90 @@ GUILoggedOnSAS( return result; } + +static +INT +DoLogon( + IN HWND hwndDlg, + IN OUT PGINA_CONTEXT pgContext) +{ + LPWSTR UserName = NULL; + LPWSTR Password = NULL; + LPWSTR Domain = NULL; + INT result = WLX_SAS_ACTION_NONE; + NTSTATUS Status, SubStatus = STATUS_SUCCESS; + + if (GetTextboxText(hwndDlg, IDC_USERNAME, &UserName) && *UserName == '\0') + goto done; + + if (GetTextboxText(hwndDlg, IDC_LOGON_TO, &Domain) && *Domain == '\0') + goto done; + + if (!GetTextboxText(hwndDlg, IDC_PASSWORD, &Password)) + goto done; + + Status = DoLoginTasks(pgContext, UserName, Domain, Password, &SubStatus); + if (!NT_SUCCESS(Status)) + { +TRACE("DoLoginTasks failed! Status 0x%08lx SubStatus 0x%08lx\n", Status, SubStatus); + + if (SubStatus == STATUS_ACCOUNT_DISABLED) + { +TRACE("Account disabled!\n"); + pgContext->pWlxFuncs->WlxMessageBox(pgContext->hWlx, + hwndDlg, + L"Account disabled!", + L"Logon error", + MB_OK | MB_ICONERROR); + + goto done; + } + else if (SubStatus == STATUS_ACCOUNT_LOCKED_OUT) + { +TRACE("Account locked!\n"); + pgContext->pWlxFuncs->WlxMessageBox(pgContext->hWlx, + hwndDlg, + L"Account locked!", + L"Logon error", + MB_OK | MB_ICONERROR); + goto done; + } + else + { +TRACE("Other error!\n"); + pgContext->pWlxFuncs->WlxMessageBox(pgContext->hWlx, + hwndDlg, + L"Other error!", + L"Logon error", + MB_OK | MB_ICONERROR); + goto done; + } + } + + if (!CreateProfile(pgContext, UserName, Domain, Password)) + { + ERR("Failed to create the profile!\n"); + goto done; + } + + ZeroMemory(pgContext->Password, 256 * sizeof(WCHAR)); + wcscpy(pgContext->Password, Password); + + result = WLX_SAS_ACTION_LOGON; + +done: + if (UserName != NULL) + HeapFree(GetProcessHeap(), 0, UserName); + + if (Password != NULL) + HeapFree(GetProcessHeap(), 0, Password); + + if (Domain != NULL) + HeapFree(GetProcessHeap(), 0, Domain); + + return result; +} + static INT_PTR CALLBACK LoggedOutWindowProc( IN HWND hwndDlg, @@ -934,7 +1018,6 @@ LoggedOutWindowProc( switch (uMsg) { case WM_INITDIALOG: - { /* FIXME: take care of NoDomainUI */ pgContext = (PGINA_CONTEXT)lParam; SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)pgContext); @@ -955,7 +1038,7 @@ LoggedOutWindowProc( pgContext->hBitmap = LoadImage(hDllInstance, MAKEINTRESOURCE(IDI_ROSLOGO), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR); return TRUE; - } + case WM_PAINT: { PAINTSTRUCT ps; @@ -968,51 +1051,27 @@ LoggedOutWindowProc( } return TRUE; } + case WM_DESTROY: - { DeleteObject(pgContext->hBitmap); return TRUE; - } + case WM_COMMAND: - { switch (LOWORD(wParam)) { case IDOK: - { - LPWSTR UserName = NULL, Password = NULL, Domain = NULL; - INT result = WLX_SAS_ACTION_NONE; - - if (GetTextboxText(hwndDlg, IDC_USERNAME, &UserName) && *UserName == '\0') - break; - if (GetTextboxText(hwndDlg, IDC_LOGON_TO, &Domain) && *Domain == '\0') - break; - if (GetTextboxText(hwndDlg, IDC_PASSWORD, &Password) && - DoLoginTasks(pgContext, UserName, Domain, Password)) - { - ZeroMemory(pgContext->Password, 256 * sizeof(WCHAR)); - wcscpy(pgContext->Password, Password); - - result = WLX_SAS_ACTION_LOGON; - } - HeapFree(GetProcessHeap(), 0, UserName); - HeapFree(GetProcessHeap(), 0, Password); - HeapFree(GetProcessHeap(), 0, Domain); - EndDialog(hwndDlg, result); + EndDialog(hwndDlg, DoLogon(hwndDlg, pgContext)); return TRUE; - } + case IDCANCEL: - { EndDialog(hwndDlg, WLX_SAS_ACTION_NONE); return TRUE; - } + case IDC_SHUTDOWN: - { EndDialog(hwndDlg, WLX_SAS_ACTION_SHUTDOWN); return TRUE; - } } break; - } } return FALSE; diff --git a/reactos/dll/win32/msgina/msgina.c b/reactos/dll/win32/msgina/msgina.c index 6480cbef32a..4f5d10cdd2f 100644 --- a/reactos/dll/win32/msgina/msgina.c +++ b/reactos/dll/win32/msgina/msgina.c @@ -686,8 +686,41 @@ done: } -BOOL +NTSTATUS DoLoginTasks( + IN OUT PGINA_CONTEXT pgContext, + IN PWSTR UserName, + IN PWSTR Domain, + IN PWSTR Password, + OUT PNTSTATUS SubStatus) +{ + NTSTATUS Status; + + Status = ConnectToLsa(pgContext); + if (!NT_SUCCESS(Status)) + { + WARN("ConnectToLsa() failed (Status 0x%08lx)\n", Status); + return Status; + } + + Status = MyLogonUser(pgContext->LsaHandle, + pgContext->AuthenticationPackage, + UserName, + Domain, + Password, + &pgContext->UserToken, + SubStatus); + if (!NT_SUCCESS(Status)) + { + WARN("MyLogonUser() failed (Status 0x%08lx)\n", Status); + } + + return Status; +} + + +BOOL +CreateProfile( IN OUT PGINA_CONTEXT pgContext, IN PWSTR UserName, IN PWSTR Domain, @@ -700,28 +733,6 @@ DoLoginTasks( DWORD cbStats, cbSize; DWORD dwLength; BOOL bResult; - NTSTATUS SubStatus; - NTSTATUS Status; - - Status = ConnectToLsa(pgContext); - if (!NT_SUCCESS(Status)) - { - WARN("ConnectToLsa() failed\n"); - return FALSE; - } - - Status = MyLogonUser(pgContext->LsaHandle, - pgContext->AuthenticationPackage, - UserName, - Domain, - Password, - &pgContext->UserToken, - &SubStatus); - if (!NT_SUCCESS(Status)) - { - WARN("MyLogonUser() failed\n"); - goto cleanup; - } /* Store the logon time in the context */ GetLocalTime(&pgContext->LogonTime); @@ -822,6 +833,8 @@ DoAutoLogon( LPWSTR Password = NULL; BOOL result = FALSE; LONG rc; + NTSTATUS Status; + NTSTATUS SubStatus = STATUS_SUCCESS; TRACE("DoAutoLogon(): AutoLogonState = %lu\n", pgContext->AutoLogonState); @@ -884,8 +897,15 @@ DoAutoLogon( if (rc != ERROR_SUCCESS) goto cleanup; - result = DoLoginTasks(pgContext, UserName, Domain, Password); + Status = DoLoginTasks(pgContext, UserName, Domain, Password, &SubStatus); + if (!NT_SUCCESS(Status)) + { + /* FIXME: Handle errors!!! */ + result = FALSE; + goto cleanup; + } + result = CreateProfile(pgContext, UserName, Domain, Password); if (result == TRUE) { ZeroMemory(pgContext->Password, 256 * sizeof(WCHAR)); diff --git a/reactos/dll/win32/msgina/msgina.h b/reactos/dll/win32/msgina/msgina.h index a6ba264d0cf..eaaf68d0c43 100644 --- a/reactos/dll/win32/msgina/msgina.h +++ b/reactos/dll/win32/msgina/msgina.h @@ -104,8 +104,16 @@ DoAdminUnlock( IN PWSTR Domain, IN PWSTR Password); -BOOL +NTSTATUS DoLoginTasks( + IN OUT PGINA_CONTEXT pgContext, + IN PWSTR UserName, + IN PWSTR Domain, + IN PWSTR Password, + OUT PNTSTATUS SubStatus); + +BOOL +CreateProfile( IN OUT PGINA_CONTEXT pgContext, IN PWSTR UserName, IN PWSTR Domain, diff --git a/reactos/dll/win32/msgina/tui.c b/reactos/dll/win32/msgina/tui.c index aa262232659..e01d330b752 100644 --- a/reactos/dll/win32/msgina/tui.c +++ b/reactos/dll/win32/msgina/tui.c @@ -199,6 +199,8 @@ TUILoggedOutSAS( { WCHAR UserName[256]; WCHAR Password[256]; + NTSTATUS Status; + NTSTATUS SubStatus = STATUS_SUCCESS; TRACE("TUILoggedOutSAS()\n"); @@ -208,10 +210,14 @@ TUILoggedOutSAS( if (!ReadString(IDS_ASKFORPASSWORD, Password, 256, FALSE)) return WLX_SAS_ACTION_NONE; - if (DoLoginTasks(pgContext, UserName, NULL, Password)) - return WLX_SAS_ACTION_LOGON; - else - return WLX_SAS_ACTION_NONE; + Status = DoLoginTasks(pgContext, UserName, NULL, Password, &SubStatus); + if (Status == STATUS_SUCCESS) + { + if (CreateProfile(pgContext, UserName, NULL, Password)) + return WLX_SAS_ACTION_LOGON; + } + + return WLX_SAS_ACTION_NONE; } static INT From 1ff93cb52e6f70b7a4d27fda7de5301116be12a8 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 9 Mar 2014 12:48:25 +0000 Subject: [PATCH 085/113] [WINE/TEST.H] Add explicit casts, so that the header can be used from C++ svn path=/trunk/; revision=62465 --- reactos/include/reactos/wine/test.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/include/reactos/wine/test.h b/reactos/include/reactos/wine/test.h index 5d1eb4aa7b9..04f9ab4fe15 100644 --- a/reactos/include/reactos/wine/test.h +++ b/reactos/include/reactos/wine/test.h @@ -254,10 +254,10 @@ static tls_data* get_tls_data(void) DWORD last_error; last_error=GetLastError(); - data=TlsGetValue(tls_index); + data=(tls_data*)TlsGetValue(tls_index); if (!data) { - data=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(tls_data)); + data=(tls_data*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(tls_data)); data->str_pos = data->strings; TlsSetValue(tls_index,data); } From 7165a7c35b83411cffbaf9d57d5f22a86e333e5f Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 9 Mar 2014 13:55:26 +0000 Subject: [PATCH 086/113] [PSEH3] - Add AllocaFrame field to the exception registration record. It is required for Clang and C++ handlers. - Fix the way how "nested functions" are emulated on Clang and C++, respecting the fact that the compiler can and will use a temporary esp-based stack frame below any alloca-allocations for function invocation. This uses the AllocaFrame field to calculate and setup a new temp stack frame for the "nested functions". - Make use of the HandlerType field in the exception registration record to use different methods for invoking filters / finally functions. - Write @_SEH3$_CallRtlUnwind@4 in raw asm instead of inline, because Clang cannot deal with stdcall decorations in inline asm (see http://llvm.org/bugs/show_bug.cgi?id=19027) - Make sure ExceptionPointers are properly initialized in _SEH3$_except_handler svn path=/trunk/; revision=62466 --- reactos/include/reactos/libs/pseh/pseh3.h | 76 ++++++++----- reactos/lib/pseh/i386/pseh3.c | 122 ++++++++++++++------- reactos/lib/pseh/i386/pseh3_asmdef.h | 7 +- reactos/lib/pseh/i386/pseh3_i386.S | 124 +++++++++++++++++++++- 4 files changed, 255 insertions(+), 74 deletions(-) diff --git a/reactos/include/reactos/libs/pseh/pseh3.h b/reactos/include/reactos/libs/pseh/pseh3.h index cc82a0d5b04..66d8e9bd998 100644 --- a/reactos/include/reactos/libs/pseh/pseh3.h +++ b/reactos/include/reactos/libs/pseh/pseh3.h @@ -67,6 +67,8 @@ typedef struct _SEH3$_REGISTRATION_FRAME /* Registers that we need to save */ unsigned long Esp; unsigned long Ebp; + + char* AllocaFrame; #ifdef _SEH3$_FRAME_ALL_NONVOLATILES unsigned long Ebx; unsigned long Esi; @@ -101,10 +103,12 @@ enum _SEH3$_TryLevel = 0, }; +#ifndef __clang__ /* These are global dummy definitions, that get overwritten in the local context of __finally / __except blocks */ int __cdecl __attribute__((error ("Can only be used inside a __finally block."))) _abnormal_termination(void); unsigned long __cdecl __attribute__((error("Can only be used inside an exception filter or __except block."))) _exception_code(void); void * __cdecl __attribute__((error("Can only be used inside an exception filter."))) _exception_info(void); +#endif /* This attribute allows automatic cleanup of the registered frames */ #define _SEH3$_AUTO_CLEANUP __attribute__((cleanup(_SEH3$_Unregister))) @@ -119,15 +123,16 @@ void * __cdecl __attribute__((error("Can only be used inside an exception filter #define _SEH3$_ASM_GOTO(_Label, ...) int -__attribute__((regparm(2))) +__attribute__((regparm(3))) __attribute__((returns_twice)) _SEH3$_RegisterFrameWithNonVolatiles( volatile SEH3$_REGISTRATION_FRAME* RegistrationFrame, - const SEH3$_SCOPE_TABLE* ScopeTable); + const SEH3$_SCOPE_TABLE* ScopeTable, + void* AllocaFrame); #define _SEH3$_RegisterFrame_(_TrylevelFrame, _DataTable) \ do { \ - int result = _SEH3$_RegisterFrameWithNonVolatiles(_TrylevelFrame, _DataTable); \ + int result = _SEH3$_RegisterFrameWithNonVolatiles(_TrylevelFrame, _DataTable, __builtin_alloca(0)); \ if (__builtin_expect(result != 0, 0)) \ { \ if (result == 1) goto _SEH3$_l_FilterOrFinally; \ @@ -137,15 +142,16 @@ _SEH3$_RegisterFrameWithNonVolatiles( } while(0) int -__attribute__((regparm(2))) +__attribute__((regparm(3))) __attribute__((returns_twice)) _SEH3$_RegisterTryLevelWithNonVolatiles( volatile SEH3$_REGISTRATION_FRAME* RegistrationFrame, - const SEH3$_SCOPE_TABLE* ScopeTable); + const SEH3$_SCOPE_TABLE* ScopeTable, + void* AllocaFrame); #define _SEH3$_RegisterTryLevel_(_TrylevelFrame, _DataTable) \ do { \ - int result = _SEH3$_RegisterTryLevelWithNonVolatiles(_TrylevelFrame, _DataTable); \ + int result = _SEH3$_RegisterTryLevelWithNonVolatiles(_TrylevelFrame, _DataTable, __builtin_alloca(0)); \ if (__builtin_expect(result != 0, 0)) \ { \ if (result == 1) goto _SEH3$_l_FilterOrFinally; \ @@ -163,25 +169,34 @@ _SEH3$_RegisterTryLevelWithNonVolatiles( #define _SEH3$_ASM_GOTO(_Label, ...) asm goto ("#\n" : : : "memory", ## __VA_ARGS__ : _Label) -/* This is an asm wrapper around _SEH3$_RegisterFrame */ -#define _SEH3$_RegisterFrame_(_TrylevelFrame, _DataTable) \ +#ifdef __cplusplus +#define _SEH3$_CALL_WRAPPER(_Function, _TrylevelFrame, _DataTable) \ asm goto ("leal %0, %%eax\n" \ "leal %1, %%edx\n" \ - "call __SEH3$_RegisterFrame\n" \ + "call " #_Function "WithStackLayout\n" \ + : \ + : "m" (*(_TrylevelFrame)), "m" (*(_DataTable)), "c"(__builtin_alloca(0)) \ + : "eax", "edx", "memory" \ + : _SEH3$_l_HandlerTarget, _SEH3$_l_FilterOrFinally) + +#else +#define _SEH3$_CALL_WRAPPER(_Function, _TrylevelFrame, _DataTable) \ + asm goto ("leal %0, %%eax\n" \ + "leal %1, %%edx\n" \ + "call " #_Function "\n" \ : \ : "m" (*(_TrylevelFrame)), "m" (*(_DataTable)) \ - : "ecx", "edx", "memory" \ + : "eax", "edx", "ecx", "memory" \ : _SEH3$_l_HandlerTarget) +#endif + +/* This is an asm wrapper around _SEH3$_RegisterFrame */ +#define _SEH3$_RegisterFrame_(_TrylevelFrame, _DataTable) \ + _SEH3$_CALL_WRAPPER(__SEH3$_RegisterFrame, _TrylevelFrame, _DataTable) /* This is an asm wrapper around _SEH3$_RegisterTryLevel */ #define _SEH3$_RegisterTryLevel_(_TrylevelFrame, _DataTable) \ - asm goto ("leal %0, %%eax\n" \ - "leal %1, %%edx\n" \ - "call __SEH3$_RegisterTryLevel\n" \ - : \ - : "m" (*(_TrylevelFrame)), "m" (*(_DataTable)) \ - : "ecx", "edx", "memory" \ - : _SEH3$_l_HandlerTarget) + _SEH3$_CALL_WRAPPER(__SEH3$_RegisterTryLevel, _TrylevelFrame, _DataTable) /* This construct scares GCC so much, that it will stop moving code around into places that are never executed. */ @@ -214,15 +229,17 @@ _SEH3$_Unregister( /* The "nested" functions are a piece of code with a ret instruction at the end */ #define _SEH3$_NESTED_FUNC_OPEN() \ { \ - int SavedEsp, result = 0; \ -\ - /* Save esp */ \ - asm volatile ("movl %%esp, %[SavedEsp]\n" : : [SavedEsp]"m"(SavedEsp)); + int _SEH3$_Result = 0; \ + +/* On invocation, the AllocaFrame field is loaded with the return esp value */ +#define _SEH3$_NESTED_FUNC_RETURN() \ + /* Restore esp and return to the caller */ \ + asm volatile ("movl %[FixedEsp], %%esp\nret\n" \ + : : "a"(_SEH3$_Result), [FixedEsp]"m"(_SEH3$_TrylevelFrame.AllocaFrame) : "memory") #define _SEH3$_NESTED_FUNC_CLOSE() \ - /* Restore esp and return to the caller */ \ - asm volatile ("movl %[SavedEsp], %%esp\nret\n" \ - : : "a"(result), [SavedEsp]"irm"(SavedEsp)); \ + /* Return to the caller */ \ + _SEH3$_NESTED_FUNC_RETURN(); \ } /* The filter function */ @@ -230,7 +247,7 @@ _SEH3$_Unregister( _SEH3$_NESTED_FUNC_OPEN() \ { \ /* Evaluate the filter expression */ \ - result = (expression); \ + _SEH3$_Result = (expression); \ } \ _SEH3$_NESTED_FUNC_CLOSE() @@ -238,11 +255,10 @@ _SEH3$_Unregister( _SEH3$_NESTED_FUNC_OPEN() \ /* This construct makes sure that the finally function returns */ \ /* a proper value at the end */ \ - for (; ; (void)({asm volatile ("movl %[SavedEsp], %%esp\nret\n" \ - : : "a"(result), [SavedEsp]"irm"(SavedEsp)); 0;})) + for (; ; (void)({_SEH3$_NESTED_FUNC_RETURN(); 0;})) #define _SEH3$_FILTER(_Filter, _FilterExpression) (&&_SEH3$_l_FilterOrFinally) -#define _SEH3$_FINALLY(_Finally) 0 +#define _SEH3$_FINALLY(_Finally) (&&_SEH3$_l_FilterOrFinally) #define _SEH3$_DECLARE_EXCEPT_INTRINSICS() @@ -336,6 +352,7 @@ _SEH3$_Unregister( __label__ _SEH3$_l_OnException; \ __label__ _SEH3$_l_BeforeFilterOrFinally; \ __label__ _SEH3$_l_FilterOrFinally; \ + (void)&&_SEH3$_l_OnException; \ (void)&&_SEH3$_l_BeforeFilterOrFinally; \ (void)&&_SEH3$_l_FilterOrFinally; \ \ @@ -419,7 +436,7 @@ _SEH3$_Unregister( _SEH3$_DECLARE_FILTER_FUNC(_SEH3$_FinallyFunction); \ \ /* Create a static data table that contains the finally function */ \ - static const SEH3$_SCOPE_TABLE _SEH3$_ScopeTable = { 0, _SEH3$_FINALLY(&_SEH3$_FinallyFunction) }; \ + static const SEH3$_SCOPE_TABLE _SEH3$_ScopeTable = { 0, _SEH3$_FINALLY(&_SEH3$_FinallyFunction), _SEH3$_TryLevel, _SEH3$_HANDLER_TYPE }; \ \ /* Register the registration record. */ \ if (_SEH3$_TryLevel == 1) _SEH3$_RegisterFrame_(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable); \ @@ -431,6 +448,7 @@ _SEH3$_Unregister( _SEH3$_EnforceFramePointer(); \ \ _SEH3$_l_BeforeFilterOrFinally: (void)0; \ + _SEH3$_EnforceFramePointer(); \ _SEH3$_l_FilterOrFinally: (void)0; \ _SEH3$_FINALLY_FUNC_OPEN(_SEH3$_FinallyFunction) diff --git a/reactos/lib/pseh/i386/pseh3.c b/reactos/lib/pseh/i386/pseh3.c index 47d742d3f98..7e7d438ea1f 100644 --- a/reactos/lib/pseh/i386/pseh3.c +++ b/reactos/lib/pseh/i386/pseh3.c @@ -63,8 +63,8 @@ _SEH3$_Unregister( static inline LONG -_SEH3$_InvokeFilter( - PVOID Record, +_SEH3$_InvokeNestedFunctionFilter( + PSEH3$_REGISTRATION_FRAME RegistrationFrame, PVOID Filter) { LONG FilterResult; @@ -78,18 +78,58 @@ _SEH3$_InvokeFilter( /* The result is the frame base address that we passed in (0) plus the offset to the registration record. */ "negl %%eax\n\t" - "addl %[Record], %%eax\n\t" + "addl %[RegistrationFrame], %%eax\n\t" /* Second call to get the filter result */ "mov $1, %%ecx\n\t" "call *%[Filter]\n\t" : "=a"(FilterResult) - : [Record] "m" (Record), [Filter] "m" (Filter) + : [RegistrationFrame] "m" (RegistrationFrame), [Filter] "m" (Filter) : "ecx", "edx"); return FilterResult; } +long +__attribute__((regparm(1))) +_SEH3$_InvokeEmbeddedFilter( + PSEH3$_REGISTRATION_FRAME RegistrationFrame); + +long +__attribute__((regparm(1))) +_SEH3$_InvokeEmbeddedFilterFromRegistration( + PSEH3$_REGISTRATION_FRAME RegistrationFrame); + +static inline +LONG +_SEH3$_InvokeFilter( + PSEH3$_REGISTRATION_FRAME RegistrationFrame, + PVOID Filter) +{ + LONG FilterResult; + + if (RegistrationFrame->ScopeTable->HandlerType == _SEH3$_NESTED_HANDLER) + { + return _SEH3$_InvokeNestedFunctionFilter(RegistrationFrame, Filter); + } + else if (RegistrationFrame->ScopeTable->HandlerType == _SEH3$_CPP_HANDLER) + { + /* Call the embedded filter function */ + return _SEH3$_InvokeEmbeddedFilter(RegistrationFrame); + } + else if (RegistrationFrame->ScopeTable->HandlerType == _SEH3$_CLANG_HANDLER) + { + return _SEH3$_InvokeEmbeddedFilterFromRegistration(RegistrationFrame); + } + else + { + /* Should not happen! Skip this handler */ + FilterResult = EXCEPTION_CONTINUE_SEARCH; + } + + return FilterResult; +} + static inline LONG _SEH3$_GetFilterResult( @@ -136,45 +176,51 @@ void _SEH3$_JumpToTarget( PSEH3$_REGISTRATION_FRAME RegistrationFrame) { - asm volatile ( - /* Load the registers */ - "movl 20(%%ecx), %%esp\n" - "movl 24(%%ecx), %%ebp\n" + if (RegistrationFrame->ScopeTable->HandlerType == _SEH3$_CLANG_HANDLER) + { + asm volatile ( + /* Load the registers */ + "movl 20(%%ecx), %%esp\n" + "movl 24(%%ecx), %%ebp\n" - /* Stack pointer is 4 off from the call to __SEH3$_RegisterFrame */ - "addl $4, %%esp\n" + /* Stack pointer is 4 off from the call to __SEH3$_RegisterFrame */ + "addl $4, %%esp\n" - /* Jump into the exception handler */ - "jmp *%[Target]\n" - : : - "c" (RegistrationFrame), - "a" (RegistrationFrame->ScopeTable), - [Target] "m" (RegistrationFrame->ScopeTable->Target) - ); + /* Jump into the exception handler */ + "jmp *%[Target]\n" + : : + "c" (RegistrationFrame), + "a" (RegistrationFrame->ScopeTable), + [Target] "m" (RegistrationFrame->ScopeTable->Target) + ); + } + else + { + asm volatile ( + /* Load the registers */ + "movl 20(%%ecx), %%esp\n" + "movl 24(%%ecx), %%ebp\n" + + /* Stack pointer is 4 off from the call to __SEH3$_RegisterFrame */ + "addl $4, %%esp\n" + + /* Jump into the exception handler */ + "jmp *%[Target]\n" + : : + "c" (RegistrationFrame), + "a" (RegistrationFrame->ScopeTable), + [Target] "m" (RegistrationFrame->ScopeTable->Target) + ); + } __builtin_unreachable(); } -static inline void +__fastcall _SEH3$_CallRtlUnwind( - PSEH3$_REGISTRATION_FRAME RegistrationFrame) -{ - LONG ClobberedEax; + PSEH3$_REGISTRATION_FRAME RegistrationFrame); - asm volatile( - "push %%ebp\n" - "push $0\n" - "push $0\n" - "push $0\n" - "push %[TargetFrame]\n" - "call _RtlUnwind@16\n" - "pop %%ebp\n" - : "=a" (ClobberedEax) - : [TargetFrame] "a" (RegistrationFrame) - : "ebx", "ecx", "edx", "esi", - "edi", "flags", "memory"); -} EXCEPTION_DISPOSITION __cdecl @@ -192,6 +238,10 @@ _SEH3$_except_handler( /* Clear the direction flag. */ asm volatile ("cld\n" : : : "memory"); + /* Save the exception pointers on the stack */ + ExceptionPointers.ExceptionRecord = ExceptionRecord; + ExceptionPointers.ContextRecord = ContextRecord; + /* Check if this is an unwind */ if (ExceptionRecord->ExceptionFlags & EXCEPTION_UNWINDING) { @@ -200,10 +250,6 @@ _SEH3$_except_handler( } else { - /* Save the exception pointers on the stack */ - ExceptionPointers.ExceptionRecord = ExceptionRecord; - ExceptionPointers.ContextRecord = ContextRecord; - /* Loop all frames for this registration */ CurrentFrame = EstablisherFrame->EndOfChain; for (;;) diff --git a/reactos/lib/pseh/i386/pseh3_asmdef.h b/reactos/lib/pseh/i386/pseh3_asmdef.h index f8d847eb323..87d126fa8ca 100644 --- a/reactos/lib/pseh/i386/pseh3_asmdef.h +++ b/reactos/lib/pseh/i386/pseh3_asmdef.h @@ -7,9 +7,10 @@ #define SEH3_REGISTRATION_FRAME_ExceptionPointers 16 #define SEH3_REGISTRATION_FRAME_Esp 20 #define SEH3_REGISTRATION_FRAME_Ebp 24 -#define SEH3_REGISTRATION_FRAME_Ebx 28 -#define SEH3_REGISTRATION_FRAME_Esi 32 -#define SEH3_REGISTRATION_FRAME_Edi 36 +#define SEH3_REGISTRATION_FRAME_AllocaFrame 28 +#define SEH3_REGISTRATION_FRAME_Ebx 32 +#define SEH3_REGISTRATION_FRAME_Esi 36 +#define SEH3_REGISTRATION_FRAME_Edi 40 #define SEH3_SCOPE_TABLE_Target 0 #define SEH3_SCOPE_TABLE_Filter 4 diff --git a/reactos/lib/pseh/i386/pseh3_i386.S b/reactos/lib/pseh/i386/pseh3_i386.S index bd37a74642f..8e409fa2406 100644 --- a/reactos/lib/pseh/i386/pseh3_i386.S +++ b/reactos/lib/pseh/i386/pseh3_i386.S @@ -15,11 +15,12 @@ /* * void - * __attribute__((regparm(2))) + * __attribute__((regparm(3))) * __attribute__((returns_twice)) * _SEH3$_RegisterFrame[WithNonVolatiles]( * PSEH3$_REGISTRATION_FRAME RegistrationFrame, - * PSEH3$_SCOPE_TABLE ScopeTable); + * PSEH3$_SCOPE_TABLE ScopeTable, + * PVOID AllocaFrame); */ .global __SEH3$_RegisterFrameWithNonVolatiles __SEH3$_RegisterFrameWithNonVolatiles: @@ -29,6 +30,12 @@ __SEH3$_RegisterFrameWithNonVolatiles: mov [eax + SEH3_REGISTRATION_FRAME_Esi], esi mov [eax + SEH3_REGISTRATION_FRAME_Edi], edi +.global __SEH3$_RegisterFrameWithStackLayout +__SEH3$_RegisterFrameWithStackLayout: + + /* Save the pointer to the alloca frame */ + mov [eax + SEH3_REGISTRATION_FRAME_AllocaFrame], ecx + .global __SEH3$_RegisterFrame __SEH3$_RegisterFrame: @@ -57,11 +64,12 @@ __SEH3$_RegisterFrame: /* * void - * __attribute__((regparm(2))) + * __attribute__((regparm(3))) * __attribute__((returns_twice)) * _SEH3$_RegisterTryLevel[WithNonVolatiles]( * PSEH3$_REGISTRATION_FRAME RegistrationFrame, - * PSEH3$_SCOPE_TABLE ScopeTable); + * PSEH3$_SCOPE_TABLE ScopeTable, + * PVOID AllocaFrame); */ .global __SEH3$_RegisterTryLevelWithNonVolatiles __SEH3$_RegisterTryLevelWithNonVolatiles: @@ -71,6 +79,12 @@ __SEH3$_RegisterTryLevelWithNonVolatiles: mov [eax + SEH3_REGISTRATION_FRAME_Esi], esi mov [eax + SEH3_REGISTRATION_FRAME_Edi], edi +.global __SEH3$_RegisterTryLevelWithStackLayout +__SEH3$_RegisterTryLevelWithStackLayout: + + /* Save the pointer to the alloca frame */ + mov [eax + SEH3_REGISTRATION_FRAME_AllocaFrame], ecx + .global __SEH3$_RegisterTryLevel __SEH3$_RegisterTryLevel: @@ -98,3 +112,105 @@ __SEH3$_RegisterTryLevel: xor eax, eax ret + +.global __SEH3$_InvokeEmbeddedFilterFromRegistration +__SEH3$_InvokeEmbeddedFilterFromRegistration: + + /* Safe the current non-volatiles */ + push ebp + push ebx + push esi + push edi + + /* Load the non-volatiles from the registration invocation */ + mov ebx, [eax + SEH3_REGISTRATION_FRAME_Ebx] + mov esi, [eax + SEH3_REGISTRATION_FRAME_Esi] + mov edi, [eax + SEH3_REGISTRATION_FRAME_Edi] + mov ebp, [eax + SEH3_REGISTRATION_FRAME_Ebp] + + /* Get the saved stack pointer */ + mov edx, [eax + SEH3_REGISTRATION_FRAME_Esp] + + xor eax, eax + inc eax + call [edx] + + /* Restore the current non-volatiles */ + pop edi + pop esi + pop ebx + pop ebp + + ret + + +.global __SEH3$_InvokeEmbeddedFilter +__SEH3$_InvokeEmbeddedFilter: + + /* Safe the current non-volatiles */ + push ebp + push ebx + push esi + push edi + + /* Load ebp from the registration invocation */ + mov ebp, [eax + SEH3_REGISTRATION_FRAME_Ebp] + + /* Calculate the size of the temp stack frame region */ + mov ecx, [eax + SEH3_REGISTRATION_FRAME_AllocaFrame] + sub ecx, [eax + SEH3_REGISTRATION_FRAME_Esp] + + /* Put the return address on the stack */ + push offset __SEH3$_InvokeEmbeddedFilterReturn + + /* Save the current stack pointer in the AllocaFrame member */ + mov [eax + SEH3_REGISTRATION_FRAME_AllocaFrame], esp + + /* Allocate enough temp stack space on the stack */ + sub esp, ecx + + /* Get the scope table */ + mov edx, [eax + SEH3_REGISTRATION_FRAME_ScopeTable] + + /* Jump into the filter or finally function */ + jmp [edx + SEH3_SCOPE_TABLE_Filter] + + /* We return to this label with a cleaned up stack */ +__SEH3$_InvokeEmbeddedFilterReturn: + + /* Restore the current non-volatiles */ + pop edi + pop esi + pop ebx + pop ebp + + ret + +/* + * void + * __fastcall + * _SEH3$_CallRtlUnwind( + * PSEH3$_REGISTRATION_FRAME RegistrationFrame) + */ +.global @_SEH3$_CallRtlUnwind@4 +@_SEH3$_CallRtlUnwind@4: + + push ebp + mov ebp, esp + + push edi + push esi + push ebx + + push 0 /* ReturnValue */ + push 0 /* ExceptionRecord */ + push 0 /* TargetIp */ + push ecx /* TargetFrame */ + call _RtlUnwind@16 + + pop ebx + pop esi + pop edi + pop ebp + ret + From d9eab6f7d47a763fc59c44a3d303ea6afe07dc41 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Sun, 9 Mar 2014 14:19:56 +0000 Subject: [PATCH 087/113] [usetup] exit when no usable disks are found svn path=/trunk/; revision=62467 --- reactos/base/setup/usetup/interface/usetup.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/reactos/base/setup/usetup/interface/usetup.c b/reactos/base/setup/usetup/interface/usetup.c index 74bf8e64e0a..717bad1cd03 100644 --- a/reactos/base/setup/usetup/interface/usetup.c +++ b/reactos/base/setup/usetup/interface/usetup.c @@ -1472,6 +1472,11 @@ SelectPartitionPage(PINPUT_RECORD Ir) /* FIXME: show an error dialog */ return QUIT_PAGE; } + else if (IsListEmpty (&PartitionList->DiskListHead)) + { + MUIDisplayError(ERROR_NO_HDD, Ir, POPUP_WAIT_ENTER); + return QUIT_PAGE; + } } DrawPartitionList(PartitionList); From 0e9938326d10cb9905428dbf08095901466475db Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 9 Mar 2014 17:48:42 +0000 Subject: [PATCH 088/113] [MSGINA] Display warning messages if a user tries to log on using a non-existing account name, a wrong password or if the account was disabled. svn path=/trunk/; revision=62468 --- reactos/dll/win32/msgina/gui.c | 32 ++++++++++++++++++-------- reactos/dll/win32/msgina/lang/bg-BG.rc | 7 ++++-- reactos/dll/win32/msgina/lang/cs-CZ.rc | 7 ++++-- reactos/dll/win32/msgina/lang/de-DE.rc | 7 ++++-- reactos/dll/win32/msgina/lang/en-US.rc | 9 +++++--- reactos/dll/win32/msgina/lang/es-ES.rc | 7 ++++-- reactos/dll/win32/msgina/lang/fr-FR.rc | 7 ++++-- reactos/dll/win32/msgina/lang/he-IL.rc | 7 ++++-- reactos/dll/win32/msgina/lang/id-ID.rc | 8 +++++-- reactos/dll/win32/msgina/lang/it-IT.rc | 7 ++++-- reactos/dll/win32/msgina/lang/ja-JP.rc | 7 ++++-- reactos/dll/win32/msgina/lang/no-NO.rc | 7 ++++-- reactos/dll/win32/msgina/lang/pl-PL.rc | 7 ++++-- reactos/dll/win32/msgina/lang/ro-RO.rc | 7 ++++-- reactos/dll/win32/msgina/lang/ru-RU.rc | 7 ++++-- reactos/dll/win32/msgina/lang/sk-SK.rc | 7 ++++-- reactos/dll/win32/msgina/lang/sq-AL.rc | 6 +++++ reactos/dll/win32/msgina/lang/tr-TR.rc | 3 +++ reactos/dll/win32/msgina/lang/uk-UA.rc | 3 +++ reactos/dll/win32/msgina/resource.h | 3 +++ 20 files changed, 115 insertions(+), 40 deletions(-) diff --git a/reactos/dll/win32/msgina/gui.c b/reactos/dll/win32/msgina/gui.c index 0fc6b0bc0c8..2b5911d044f 100644 --- a/reactos/dll/win32/msgina/gui.c +++ b/reactos/dll/win32/msgina/gui.c @@ -943,19 +943,26 @@ DoLogon( goto done; Status = DoLoginTasks(pgContext, UserName, Domain, Password, &SubStatus); - if (!NT_SUCCESS(Status)) + if (Status == STATUS_LOGON_FAILURE) { -TRACE("DoLoginTasks failed! Status 0x%08lx SubStatus 0x%08lx\n", Status, SubStatus); + ResourceMessageBox(pgContext, + hwndDlg, + MB_OK | MB_ICONEXCLAMATION, + IDS_LOGONTITLE, + IDS_LOGONWRONGUSERORPWD); + goto done; + } + else if (Status == STATUS_ACCOUNT_RESTRICTION) + { + TRACE("DoLoginTasks failed! Status 0x%08lx SubStatus 0x%08lx\n", Status, SubStatus); if (SubStatus == STATUS_ACCOUNT_DISABLED) { -TRACE("Account disabled!\n"); - pgContext->pWlxFuncs->WlxMessageBox(pgContext->hWlx, - hwndDlg, - L"Account disabled!", - L"Logon error", - MB_OK | MB_ICONERROR); - + ResourceMessageBox(pgContext, + hwndDlg, + MB_OK | MB_ICONEXCLAMATION, + IDS_LOGONTITLE, + IDS_LOGONUSERDISABLED); goto done; } else if (SubStatus == STATUS_ACCOUNT_LOCKED_OUT) @@ -979,6 +986,13 @@ TRACE("Other error!\n"); goto done; } } + else if (!NT_SUCCESS(Status)) + { +TRACE("DoLoginTasks failed! Status 0x%08lx\n", Status); + + goto done; + } + if (!CreateProfile(pgContext, UserName, Domain, Password)) { diff --git a/reactos/dll/win32/msgina/lang/bg-BG.rc b/reactos/dll/win32/msgina/lang/bg-BG.rc index d06701b5941..c6e41603d98 100644 --- a/reactos/dll/win32/msgina/lang/bg-BG.rc +++ b/reactos/dll/win32/msgina/lang/bg-BG.rc @@ -140,11 +140,14 @@ BEGIN IDS_LOGONMSG "You are logged on as %s." IDS_LOGONDATE "Logon date: %s %s" IDS_COMPUTERLOCKED "Computer locked" - IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." - IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." + IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." + IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." IDS_CHANGEPWDTITLE "Change Password" IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes." IDS_PASSWORDCHANGED "Your password has been changed." + IDS_LOGONTITLE "Logon Message" + IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." + IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/cs-CZ.rc b/reactos/dll/win32/msgina/lang/cs-CZ.rc index 00ebf875e69..fb7c834e92c 100644 --- a/reactos/dll/win32/msgina/lang/cs-CZ.rc +++ b/reactos/dll/win32/msgina/lang/cs-CZ.rc @@ -145,11 +145,14 @@ BEGIN IDS_LOGONMSG "Jste přihlášeni jako %s." IDS_LOGONDATE "Datum přihlášení: %s %s" IDS_COMPUTERLOCKED "Computer locked" - IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." - IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." + IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." + IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." IDS_CHANGEPWDTITLE "Change Password" IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes." IDS_PASSWORDCHANGED "Your password has been changed." + IDS_LOGONTITLE "Logon Message" + IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." + IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/de-DE.rc b/reactos/dll/win32/msgina/lang/de-DE.rc index 79710d88509..612afcf8a6e 100644 --- a/reactos/dll/win32/msgina/lang/de-DE.rc +++ b/reactos/dll/win32/msgina/lang/de-DE.rc @@ -140,11 +140,14 @@ BEGIN IDS_LOGONMSG "Sie sind angemeldet als %s." IDS_LOGONDATE "Anmeldedatum: %s %s" IDS_COMPUTERLOCKED "Computer ist gesperrt" - IDS_LOCKEDWRONGPASSWORD "Das Passwort ist falsch. Bitte geben Sie das Passwort erneut ein. Bei Buchstaben des Passworts wird Groß- und Kleinschreibung unterschieden." - IDS_LOCKEDWRONGUSER "Der Computer ist gesperrt. Nur %s\\%s oder ein Administrator kann den Computer entsperren." + IDS_LOCKEDWRONGPASSWORD "Das Passwort ist falsch. Bitte geben Sie das Passwort erneut ein. Bei Buchstaben des Passworts wird Groß- und Kleinschreibung unterschieden." + IDS_LOCKEDWRONGUSER "Der Computer ist gesperrt. Nur %s\\%s oder ein Administrator kann den Computer entsperren." IDS_CHANGEPWDTITLE "Passwort ändern" IDS_NONMATCHINGPASSWORDS "Die eingegebenen Passworte stimmen nicht überein. Geben Sie das neue Passwort in beide Textfelder ein." IDS_PASSWORDCHANGED "Ihr Passwort wurde geändert." + IDS_LOGONTITLE "Anmeldemeldung" + IDS_LOGONWRONGUSERORPWD "Sie konnten nicht angemeldet werden. Prüfen Sie Benutzername und Domäne, und geben Sie das Passwort erneut ein. Bei Passworten wird Groß- und Kleinschreibung unterschieden." + IDS_LOGONUSERDISABLED "Ihr Konto wurde deaktiviert. Wenden Sie sich an Ihren Systemadministrator." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/en-US.rc b/reactos/dll/win32/msgina/lang/en-US.rc index e442a6a9e49..b699b34c2b6 100644 --- a/reactos/dll/win32/msgina/lang/en-US.rc +++ b/reactos/dll/win32/msgina/lang/en-US.rc @@ -135,16 +135,19 @@ BEGIN IDS_PRESSCTRLALTDELETE "Press Control+Alt+Delete to Logon." IDS_ASKFORUSER "User name: " IDS_ASKFORPASSWORD "Password: " - IDS_FORCELOGOFF "This will log out the current user and lose all unsaved data. Continue?" + IDS_FORCELOGOFF "This will log out the current user and lose all unsaved data. Continue?" IDS_LOCKMSG "Only %s or an Administrator can unlock this computer." IDS_LOGONMSG "You are logged on as %s." IDS_LOGONDATE "Logon date: %s %s" IDS_COMPUTERLOCKED "Computer locked" - IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." - IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." + IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." + IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." IDS_CHANGEPWDTITLE "Change Password" IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes." IDS_PASSWORDCHANGED "Your password has been changed." + IDS_LOGONTITLE "Logon Message" + IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." + IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/es-ES.rc b/reactos/dll/win32/msgina/lang/es-ES.rc index fff68d7c5c8..83c9cb9981f 100644 --- a/reactos/dll/win32/msgina/lang/es-ES.rc +++ b/reactos/dll/win32/msgina/lang/es-ES.rc @@ -142,11 +142,14 @@ BEGIN IDS_LOGONMSG "You are logged on as %s." IDS_LOGONDATE "Logon date: %s %s" IDS_COMPUTERLOCKED "Computer locked" - IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." - IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." + IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." + IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." IDS_CHANGEPWDTITLE "Change Password" IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes." IDS_PASSWORDCHANGED "Your password has been changed." + IDS_LOGONTITLE "Logon Message" + IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." + IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/fr-FR.rc b/reactos/dll/win32/msgina/lang/fr-FR.rc index ebe178564e3..60b838c355d 100644 --- a/reactos/dll/win32/msgina/lang/fr-FR.rc +++ b/reactos/dll/win32/msgina/lang/fr-FR.rc @@ -140,11 +140,14 @@ BEGIN IDS_LOGONMSG "You are logged on as %s." IDS_LOGONDATE "Logon date: %s %s" IDS_COMPUTERLOCKED "Computer locked" - IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." - IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." + IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." + IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." IDS_CHANGEPWDTITLE "Change Password" IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes." IDS_PASSWORDCHANGED "Your password has been changed." + IDS_LOGONTITLE "Logon Message" + IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." + IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/he-IL.rc b/reactos/dll/win32/msgina/lang/he-IL.rc index 0a364801c19..89be4d60945 100644 --- a/reactos/dll/win32/msgina/lang/he-IL.rc +++ b/reactos/dll/win32/msgina/lang/he-IL.rc @@ -140,11 +140,14 @@ BEGIN IDS_LOGONMSG "You are logged on as %s." IDS_LOGONDATE "תאריך כניסה: %s %s" IDS_COMPUTERLOCKED "Computer locked" - IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." - IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." + IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." + IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." IDS_CHANGEPWDTITLE "Change Password" IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes." IDS_PASSWORDCHANGED "Your password has been changed." + IDS_LOGONTITLE "Logon Message" + IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." + IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/id-ID.rc b/reactos/dll/win32/msgina/lang/id-ID.rc index a8c593ba557..4e45a682551 100644 --- a/reactos/dll/win32/msgina/lang/id-ID.rc +++ b/reactos/dll/win32/msgina/lang/id-ID.rc @@ -137,13 +137,17 @@ BEGIN IDS_ASKFORPASSWORD "Kata sandi: " IDS_FORCELOGOFF "Ini akan mengeluarkan pengguna saat ini dan kehilangan data yang belum disimpan. Lanjutkan?" IDS_LOCKMSG "Only %s or an Administrator can unlock this computer." + IDS_LOGONMSG "You are logged on as %s." IDS_LOGONDATE "Logon date: %s %s" IDS_COMPUTERLOCKED "Computer locked" - IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." - IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." + IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." + IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." IDS_CHANGEPWDTITLE "Change Password" IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes." IDS_PASSWORDCHANGED "Your password has been changed." + IDS_LOGONTITLE "Logon Message" + IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." + IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/it-IT.rc b/reactos/dll/win32/msgina/lang/it-IT.rc index 7ab86e7f6f9..a1e442e1024 100644 --- a/reactos/dll/win32/msgina/lang/it-IT.rc +++ b/reactos/dll/win32/msgina/lang/it-IT.rc @@ -148,11 +148,14 @@ BEGIN IDS_LOGONMSG "You are logged on as %s." IDS_LOGONDATE "Dati di accesso: %s %s" IDS_COMPUTERLOCKED "Computer locked" - IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." - IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." + IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." + IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." IDS_CHANGEPWDTITLE "Change Password" IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes." IDS_PASSWORDCHANGED "Your password has been changed." + IDS_LOGONTITLE "Logon Message" + IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." + IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/ja-JP.rc b/reactos/dll/win32/msgina/lang/ja-JP.rc index a1731d0296c..b3af12c5549 100644 --- a/reactos/dll/win32/msgina/lang/ja-JP.rc +++ b/reactos/dll/win32/msgina/lang/ja-JP.rc @@ -140,11 +140,14 @@ BEGIN IDS_LOGONMSG "You are logged on as %s." IDS_LOGONDATE "Logon date: %s %s" IDS_COMPUTERLOCKED "Computer locked" - IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." - IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." + IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." + IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." IDS_CHANGEPWDTITLE "Change Password" IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes." IDS_PASSWORDCHANGED "Your password has been changed." + IDS_LOGONTITLE "Logon Message" + IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." + IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/no-NO.rc b/reactos/dll/win32/msgina/lang/no-NO.rc index 41b0af8ee2d..bce3ee2d0c3 100644 --- a/reactos/dll/win32/msgina/lang/no-NO.rc +++ b/reactos/dll/win32/msgina/lang/no-NO.rc @@ -140,11 +140,14 @@ BEGIN IDS_LOGONMSG "You are logged on as %s." IDS_LOGONDATE "Logon date: %s %s" IDS_COMPUTERLOCKED "Computer locked" - IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." - IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." + IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." + IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." IDS_CHANGEPWDTITLE "Change Password" IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes." IDS_PASSWORDCHANGED "Your password has been changed." + IDS_LOGONTITLE "Logon Message" + IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." + IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/pl-PL.rc b/reactos/dll/win32/msgina/lang/pl-PL.rc index aad32ffc51f..a1d56bec798 100644 --- a/reactos/dll/win32/msgina/lang/pl-PL.rc +++ b/reactos/dll/win32/msgina/lang/pl-PL.rc @@ -149,11 +149,14 @@ BEGIN IDS_LOGONMSG "Jesteś zalogowany jako %s." IDS_LOGONDATE "Data logowania: %s %s" IDS_COMPUTERLOCKED "Computer locked" - IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." - IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." + IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." + IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." IDS_CHANGEPWDTITLE "Change Password" IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes." IDS_PASSWORDCHANGED "Your password has been changed." + IDS_LOGONTITLE "Logon Message" + IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." + IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/ro-RO.rc b/reactos/dll/win32/msgina/lang/ro-RO.rc index f63e48c638a..bafb790fe2c 100644 --- a/reactos/dll/win32/msgina/lang/ro-RO.rc +++ b/reactos/dll/win32/msgina/lang/ro-RO.rc @@ -142,11 +142,14 @@ BEGIN IDS_LOGONMSG "Sunteți autentificat ca %s." IDS_LOGONDATE "Data autentificării: %s %s" IDS_COMPUTERLOCKED "Computer locked" - IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." - IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." + IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." + IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." IDS_CHANGEPWDTITLE "Change Password" IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes." IDS_PASSWORDCHANGED "Your password has been changed." + IDS_LOGONTITLE "Logon Message" + IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." + IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/ru-RU.rc b/reactos/dll/win32/msgina/lang/ru-RU.rc index 0c69e47cfed..398ce06d5e7 100644 --- a/reactos/dll/win32/msgina/lang/ru-RU.rc +++ b/reactos/dll/win32/msgina/lang/ru-RU.rc @@ -142,11 +142,14 @@ BEGIN IDS_LOGONMSG "You are logged on as %s." IDS_LOGONDATE "Дата входа: %s %s" IDS_COMPUTERLOCKED "Computer locked" - IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." - IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." + IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." + IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." IDS_CHANGEPWDTITLE "Change Password" IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes." IDS_PASSWORDCHANGED "Your password has been changed." + IDS_LOGONTITLE "Logon Message" + IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." + IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/sk-SK.rc b/reactos/dll/win32/msgina/lang/sk-SK.rc index ead0f3a5d43..31d4ab2418f 100644 --- a/reactos/dll/win32/msgina/lang/sk-SK.rc +++ b/reactos/dll/win32/msgina/lang/sk-SK.rc @@ -145,11 +145,14 @@ BEGIN IDS_LOGONMSG "You are logged on as %s." IDS_LOGONDATE "Logon date: %s %s" IDS_COMPUTERLOCKED "Computer locked" - IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." - IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." + IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." + IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." IDS_CHANGEPWDTITLE "Change Password" IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes." IDS_PASSWORDCHANGED "Your password has been changed." + IDS_LOGONTITLE "Logon Message" + IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." + IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/sq-AL.rc b/reactos/dll/win32/msgina/lang/sq-AL.rc index 8c18c16d80f..cb9a93fb962 100644 --- a/reactos/dll/win32/msgina/lang/sq-AL.rc +++ b/reactos/dll/win32/msgina/lang/sq-AL.rc @@ -145,6 +145,12 @@ BEGIN IDS_COMPUTERLOCKED "Kompjuter mbyllur" IDS_LOCKEDWRONGPASSWORD "Fjalëkalimi është gabim. Ju lutem shkruani fjalëkalimin tuaj përsëri. Gërmat në fjalëkalim duhet të shkruhen duke përdorur rastin e duhur." IDS_LOCKEDWRONGUSER "Ky kompjuter është i bllokuar. Vetëm %s\\%s ose një Administrator mund të zhbllokoj këtë kompjuter." + IDS_CHANGEPWDTITLE "Change Password" + IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes." + IDS_PASSWORDCHANGED "Your password has been changed." + IDS_LOGONTITLE "Logon Message" + IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." + IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/tr-TR.rc b/reactos/dll/win32/msgina/lang/tr-TR.rc index 9eebba74ed5..7c3a825357d 100644 --- a/reactos/dll/win32/msgina/lang/tr-TR.rc +++ b/reactos/dll/win32/msgina/lang/tr-TR.rc @@ -147,6 +147,9 @@ BEGIN IDS_CHANGEPWDTITLE "Şifre Değştirme" IDS_NONMATCHINGPASSWORDS "Yazıdığınız bu şifreler birbiriyle uyuşmuyor. Her iki metin kutusuna da aynı şifreyi yazınız." IDS_PASSWORDCHANGED "Şifreniz değiştirildi." + IDS_LOGONTITLE "Logon Message" + IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." + IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/uk-UA.rc b/reactos/dll/win32/msgina/lang/uk-UA.rc index 34be98fe154..b125c5473c9 100644 --- a/reactos/dll/win32/msgina/lang/uk-UA.rc +++ b/reactos/dll/win32/msgina/lang/uk-UA.rc @@ -153,6 +153,9 @@ BEGIN IDS_CHANGEPWDTITLE "Change Password" IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes." IDS_PASSWORDCHANGED "Your password has been changed." + IDS_LOGONTITLE "Logon Message" + IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." + IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/resource.h b/reactos/dll/win32/msgina/resource.h index b8e51ed4d18..e310dcf9a07 100644 --- a/reactos/dll/win32/msgina/resource.h +++ b/reactos/dll/win32/msgina/resource.h @@ -54,6 +54,9 @@ #define IDS_CHANGEPWDTITLE 40012 #define IDS_NONMATCHINGPASSWORDS 40013 #define IDS_PASSWORDCHANGED 40014 +#define IDS_LOGONTITLE 40015 +#define IDS_LOGONWRONGUSERORPWD 40016 +#define IDS_LOGONUSERDISABLED 40017 #define IDS_SHUTDOWN_SHUTDOWN 50000 #define IDS_SHUTDOWN_LOGOFF 50001 From 32cd2f8cedfd602de0863294cb3cb39ca17336b5 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Tue, 11 Mar 2014 05:09:14 +0000 Subject: [PATCH 089/113] [comctl32] rename TBSTYLE_EX_UNDOC1 to TBSTYLE_EX_VERTICAL svn path=/trunk/; revision=62470 --- reactos/dll/win32/comctl32/toolbar.c | 12 ++++++------ reactos/include/psdk/commctrl.h | 10 ++++++---- reactos/include/reactos/wine/commctrl.h | 1 - 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/reactos/dll/win32/comctl32/toolbar.c b/reactos/dll/win32/comctl32/toolbar.c index e803c3c340e..6b6a2fd4eb3 100644 --- a/reactos/dll/win32/comctl32/toolbar.c +++ b/reactos/dll/win32/comctl32/toolbar.c @@ -205,7 +205,7 @@ typedef enum /* Used to find undocumented extended styles */ #define TBSTYLE_EX_ALL (TBSTYLE_EX_DRAWDDARROWS | \ - TBSTYLE_EX_UNDOC1 | \ + TBSTYLE_EX_VERTICAL | \ TBSTYLE_EX_MIXEDBUTTONS | \ TBSTYLE_EX_DOUBLEBUFFER | \ TBSTYLE_EX_HIDECLIPPEDBUTTONS) @@ -1257,7 +1257,7 @@ TOOLBAR_CalcStrings (const TOOLBAR_INFO *infoPtr, LPSIZE lpSize) * the toolbar wrapping on its own, it can use the TBSTYLE_WRAPABLE * flag, and set the TBSTATE_WRAP flags manually on the appropriate items. * -* Note: TBSTYLE_WRAPABLE or TBSTYLE_EX_UNDOC1 can be used also to allow +* Note: TBSTYLE_WRAPABLE or TBSTYLE_EX_VERTICAL can be used also to allow * vertical toolbar lists. */ @@ -1273,7 +1273,7 @@ TOOLBAR_WrapToolbar(TOOLBAR_INFO *infoPtr) /* no layout is necessary. Applications may use this style */ /* to perform their own layout on the toolbar. */ if( !(infoPtr->dwStyle & TBSTYLE_WRAPABLE) && - !(infoPtr->dwExStyle & TBSTYLE_EX_UNDOC1) ) return; + !(infoPtr->dwExStyle & TBSTYLE_EX_VERTICAL) ) return; btnPtr = infoPtr->buttons; x = infoPtr->nIndent; @@ -3023,7 +3023,7 @@ TOOLBAR_AutoSize (TOOLBAR_INFO *infoPtr) cy = TOP_BORDER + infoPtr->nRows * infoPtr->nButtonHeight + BOTTOM_BORDER; cx = parent_rect.right - parent_rect.left; - if ((infoPtr->dwStyle & TBSTYLE_WRAPABLE) || (infoPtr->dwExStyle & TBSTYLE_EX_UNDOC1)) + if ((infoPtr->dwStyle & TBSTYLE_WRAPABLE) || (infoPtr->dwExStyle & TBSTYLE_EX_VERTICAL)) { TOOLBAR_LayoutToolbar(infoPtr); InvalidateRect( infoPtr->hwndSelf, NULL, TRUE ); @@ -3333,7 +3333,7 @@ TOOLBAR_GetButtonInfoT(const TOOLBAR_INFO *infoPtr, INT Id, LPTBBUTTONINFOW lpTb if (lpTbInfo == NULL) return -1; - /* MSDN documents a iImageLabel field added in Vista but it is not present in + /* MSDN documents an iImageLabel field added in Vista but it is not present in * the headers and tests shows that even with comctl 6 Vista accepts only the * original TBBUTTONINFO size */ @@ -4132,7 +4132,7 @@ TOOLBAR_Restore(TOOLBAR_INFO *infoPtr, const TBSAVEPARAMSW *lpSave) { /* separator */ nmtbr.tbButton.fsStyle = TBSTYLE_SEP; - /* when inserting separators, iBitmap controls it's size. + /* when inserting separators, iBitmap controls its size. 0 sets default size (width) */ nmtbr.tbButton.iBitmap = 0; } diff --git a/reactos/include/psdk/commctrl.h b/reactos/include/psdk/commctrl.h index f2b5b334184..ebb7dda7644 100644 --- a/reactos/include/psdk/commctrl.h +++ b/reactos/include/psdk/commctrl.h @@ -949,7 +949,6 @@ extern "C" { #define TBSTYLE_CUSTOMERASE 0x2000 #define TBSTYLE_REGISTERDROP 0x4000 #define TBSTYLE_TRANSPARENT 0x8000 -#define TBSTYLE_EX_DRAWDDARROWS 0x1 #define BTNS_BUTTON TBSTYLE_BUTTON #define BTNS_SEP TBSTYLE_SEP @@ -962,9 +961,12 @@ extern "C" { #define BTNS_SHOWTEXT 0x40 #define BTNS_WHOLEDROPDOWN 0x80 -#define TBSTYLE_EX_MIXEDBUTTONS 0x8 -#define TBSTYLE_EX_HIDECLIPPEDBUTTONS 0x10 -#define TBSTYLE_EX_DOUBLEBUFFER 0x80 +#define TBSTYLE_EX_DRAWDDARROWS 0x00000001 +#define TBSTYLE_EX_MULTICOLUMN 0x00000002 +#define TBSTYLE_EX_VERTICAL 0x00000004 +#define TBSTYLE_EX_MIXEDBUTTONS 0x00000008 +#define TBSTYLE_EX_HIDECLIPPEDBUTTONS 0x00000010 /* don't show partially obscured buttons */ +#define TBSTYLE_EX_DOUBLEBUFFER 0x00000080 /* Double Buffer the toolbar */ typedef struct _NMTBCUSTOMDRAW { NMCUSTOMDRAW nmcd; diff --git a/reactos/include/reactos/wine/commctrl.h b/reactos/include/reactos/wine/commctrl.h index 28ce67f7c5b..b7dcba3eb53 100644 --- a/reactos/include/reactos/wine/commctrl.h +++ b/reactos/include/reactos/wine/commctrl.h @@ -63,7 +63,6 @@ typedef LVFINDINFOA *LPLVFINDINFOA; typedef LVFINDINFOW *LPLVFINDINFOW; #define SB_SETBORDERS (WM_USER+5) -#define TBSTYLE_EX_UNDOC1 0x00000004 /* similar to TBSTYLE_WRAPABLE */ /* these are undocumented and the names are guesses */ typedef struct From cb87e96df612b009ab0275fd45bb058bfdbdd012 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Tue, 11 Mar 2014 07:22:28 +0000 Subject: [PATCH 090/113] [FASTFAT] Add support for more notifications on file modification. CORE-2582 svn path=/trunk/; revision=62471 --- reactos/drivers/filesystems/fastfat/rw.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/reactos/drivers/filesystems/fastfat/rw.c b/reactos/drivers/filesystems/fastfat/rw.c index 7cdd511536c..7474c5ba348 100644 --- a/reactos/drivers/filesystems/fastfat/rw.c +++ b/reactos/drivers/filesystems/fastfat/rw.c @@ -1000,6 +1000,8 @@ VfatWrite( if(!(*Fcb->Attributes & FILE_ATTRIBUTE_DIRECTORY)) { LARGE_INTEGER SystemTime; + ULONG Filter; + // set dates and times KeQuerySystemTime (&SystemTime); if (Fcb->Flags & FCB_IS_FATX_ENTRY) @@ -1019,6 +1021,20 @@ VfatWrite( } /* set date and times to dirty */ Fcb->Flags |= FCB_IS_DIRTY; + + /* Time to notify the OS */ + Filter = FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_ATTRIBUTES; + if (ByteOffset.QuadPart != OldFileSize.QuadPart) Filter |= FILE_NOTIFY_CHANGE_SIZE; + + FsRtlNotifyFullReportChange(IrpContext->DeviceExt->NotifySync, + &(IrpContext->DeviceExt->NotifyList), + (PSTRING)&Fcb->PathNameU, + Fcb->PathNameU.Length - Fcb->LongNameU.Length, + NULL, + NULL, + Filter, + FILE_ACTION_MODIFIED, + NULL); } } From 3bce7d16d74e7f3b0fddd5472fd4c720adda8e66 Mon Sep 17 00:00:00 2001 From: Ged Murphy Date: Tue, 11 Mar 2014 10:53:06 +0000 Subject: [PATCH 091/113] [NTOSKRNL] - Fix the buffer size check / set svn path=/trunk/; revision=62473 --- reactos/ntoskrnl/config/cmapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/config/cmapi.c b/reactos/ntoskrnl/config/cmapi.c index c9f5cb3f5bd..ed2eda03410 100644 --- a/reactos/ntoskrnl/config/cmapi.c +++ b/reactos/ntoskrnl/config/cmapi.c @@ -1434,7 +1434,7 @@ CmpQueryKeyDataFromCache( } /* Validate buffer length (we do not copy the name!) */ - *ResultLength = sizeof(KeyCachedInfo); + *ResultLength = sizeof(*KeyCachedInfo); if (Length < *ResultLength) { return STATUS_BUFFER_TOO_SMALL; From 2c26c653a9fac5114350a2dc2e6c68f534c7b61e Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Tue, 11 Mar 2014 13:06:09 +0000 Subject: [PATCH 092/113] [SHELL32_APITEST] * Plug some leaks. CIDs 1106362, 1106363 and 1106364. CORE-7975 svn path=/trunk/; revision=62474 --- rostests/apitests/shell32/menu.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rostests/apitests/shell32/menu.cpp b/rostests/apitests/shell32/menu.cpp index 8fd046a6dc1..38e15d6dcdf 100644 --- a/rostests/apitests/shell32/menu.cpp +++ b/rostests/apitests/shell32/menu.cpp @@ -11,7 +11,11 @@ BOOL CheckWindowClass(HWND hwnd, PCWSTR className) { ULONG size = (wcslen(className) + 1)* sizeof(WCHAR); PWCHAR buffer = (PWCHAR)malloc(size); - if (GetClassNameW(hwnd, buffer, size ) == 0) return FALSE; + if (GetClassNameW(hwnd, buffer, size ) == 0) + { + free(buffer); + return FALSE; + } int res = wcscmp(buffer, className); free(buffer); return res == 0; @@ -161,6 +165,7 @@ void test_CShellMenu() if (!CreateCShellMenu(&shellMenu, &dockingMenu, &menuWithSite)) { skip("failed to create CShellMenuObject\n"); + delete dummyWindow; return; } @@ -288,6 +293,7 @@ void test_CShellMenu_callbacks(IShellFolder *shellFolder, HMENU hmenu) if (!CreateCShellMenu(&shellMenu, &dockingMenu, &menuWithSite)) { skip("failed to create CShellMenuObject\n"); + delete dummyWindow; return; } From e6fb12f8ca975a3c4d1e024249f2af4b929c8b4e Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Tue, 11 Mar 2014 18:46:32 +0000 Subject: [PATCH 093/113] [NTOS] - Remove unneeded macro by David Welch in 2002 and me in 2003. svn path=/trunk/; revision=62477 --- reactos/ntoskrnl/mm/i386/page.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/reactos/ntoskrnl/mm/i386/page.c b/reactos/ntoskrnl/mm/i386/page.c index b79e10285c9..c18a0d1c5f8 100644 --- a/reactos/ntoskrnl/mm/i386/page.c +++ b/reactos/ntoskrnl/mm/i386/page.c @@ -40,23 +40,11 @@ #define PA_ACCESSED (1 << PA_BIT_ACCESSED) #define PA_GLOBAL (1 << PA_BIT_GLOBAL) -#define HYPERSPACE (0xc0400000) -#define IS_HYPERSPACE(v) (((ULONG)(v) >= HYPERSPACE && (ULONG)(v) < HYPERSPACE + 0x400000)) +#define IS_HYPERSPACE(v) (((ULONG)(v) >= HYPER_SPACE && (ULONG)(v) <= HYPER_SPACE_END)) #define PTE_TO_PFN(X) ((X) >> PAGE_SHIFT) #define PFN_TO_PTE(X) ((X) << PAGE_SHIFT) -#if defined(__GNUC__) -#define PTE_TO_PAGE(X) ((LARGE_INTEGER)(LONGLONG)(PAGE_MASK(X))) -#else -__inline LARGE_INTEGER PTE_TO_PAGE(ULONG npage) -{ - LARGE_INTEGER dummy; - dummy.QuadPart = (LONGLONG)(PAGE_MASK(npage)); - return dummy; -} -#endif - const ULONG MmProtectToPteMask[32] = From 15d43e5a94bec92cc5c9c5dfa15ae5c8e76b33f7 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Tue, 11 Mar 2014 20:33:25 +0000 Subject: [PATCH 094/113] [MSGINA] Do not close the logon dialog if the user failed to log on. svn path=/trunk/; revision=62478 --- reactos/dll/win32/msgina/gui.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/reactos/dll/win32/msgina/gui.c b/reactos/dll/win32/msgina/gui.c index 2b5911d044f..1bd863ea108 100644 --- a/reactos/dll/win32/msgina/gui.c +++ b/reactos/dll/win32/msgina/gui.c @@ -922,7 +922,7 @@ GUILoggedOnSAS( static -INT +BOOL DoLogon( IN HWND hwndDlg, IN OUT PGINA_CONTEXT pgContext) @@ -930,7 +930,7 @@ DoLogon( LPWSTR UserName = NULL; LPWSTR Password = NULL; LPWSTR Domain = NULL; - INT result = WLX_SAS_ACTION_NONE; + BOOL result = FALSE; NTSTATUS Status, SubStatus = STATUS_SUCCESS; if (GetTextboxText(hwndDlg, IDC_USERNAME, &UserName) && *UserName == '\0') @@ -1003,7 +1003,7 @@ TRACE("DoLoginTasks failed! Status 0x%08lx\n", Status); ZeroMemory(pgContext->Password, 256 * sizeof(WCHAR)); wcscpy(pgContext->Password, Password); - result = WLX_SAS_ACTION_LOGON; + result = TRUE; done: if (UserName != NULL) @@ -1074,7 +1074,8 @@ LoggedOutWindowProc( switch (LOWORD(wParam)) { case IDOK: - EndDialog(hwndDlg, DoLogon(hwndDlg, pgContext)); + if (DoLogon(hwndDlg, pgContext)) + EndDialog(hwndDlg, WLX_SAS_ACTION_LOGON); return TRUE; case IDCANCEL: From c82b3ee66d53ad7b6667b5df2d6f531e6386bd26 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 11 Mar 2014 22:46:49 +0000 Subject: [PATCH 095/113] [PSDK] intsafe.h: fix a comment and 2 benign "typos" svn path=/trunk/; revision=62479 --- reactos/include/psdk/intsafe.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reactos/include/psdk/intsafe.h b/reactos/include/psdk/intsafe.h index ce64be8ec8d..9b9557cfa13 100644 --- a/reactos/include/psdk/intsafe.h +++ b/reactos/include/psdk/intsafe.h @@ -657,7 +657,7 @@ INTSAFE_NAME(ULongLongMult)( M2 = M2Low + M2Hi * 0x100000000 Then the multiplication looks like this: - M1 * M2 = (M1Low + M1Hi * 0x100000000) + (M2Low + M2Hi * 0x100000000) + M1 * M2 = (M1Low + M1Hi * 0x100000000) * (M2Low + M2Hi * 0x100000000) = M1Low * M2Low + M1Low * M2Hi * 0x100000000 + M2Low * M1Hi * 0x100000000 @@ -686,13 +686,13 @@ INTSAFE_NAME(ULongLongMult)( } else { - *pOutput = LONGLONG_ERROR; + *pOutput = ULONGLONG_ERROR; return INTSAFE_E_ARITHMETIC_OVERFLOW; } if (Temp > ULONG_MAX) { - *pOutput = LONGLONG_ERROR; + *pOutput = ULONGLONG_ERROR; return INTSAFE_E_ARITHMETIC_OVERFLOW; } From de561c683e97b9326c8dd8a0dce387c57f6bbb57 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 11 Mar 2014 22:48:04 +0000 Subject: [PATCH 096/113] [PSDK] winternl.h: Fix RtlLookupAtomInAtomTable prototype (should be sent to wine? not sure) svn path=/trunk/; revision=62480 --- reactos/include/psdk/winternl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/include/psdk/winternl.h b/reactos/include/psdk/winternl.h index 193b0798eb2..b3d59dc005d 100644 --- a/reactos/include/psdk/winternl.h +++ b/reactos/include/psdk/winternl.h @@ -632,7 +632,7 @@ typedef enum _FSINFOCLASS { FileFsMaximumInformation } FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS; -typedef enum _KEY_INFORMATION_CLASS { +typedef enum _KEY_INFORMATION_CLASS { KeyBasicInformation = 0, KeyNodeInformation = 1, KeyFullInformation = 2, @@ -2244,7 +2244,7 @@ ULONG WINAPI RtlLengthSecurityDescriptor(PSECURITY_DESCRIPTOR); DWORD WINAPI RtlLengthSid(PSID); NTSTATUS WINAPI RtlLocalTimeToSystemTime(const LARGE_INTEGER*,PLARGE_INTEGER); BOOLEAN WINAPI RtlLockHeap(HANDLE); -NTSTATUS WINAPI RtlLookupAtomInAtomTable(RTL_ATOM_TABLE,const WCHAR*,RTL_ATOM*); +NTSTATUS WINAPI RtlLookupAtomInAtomTable(RTL_ATOM_TABLE*,const WCHAR*,RTL_ATOM*); NTSTATUS WINAPI RtlMakeSelfRelativeSD(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,LPDWORD); void WINAPI RtlMapGenericMask(PACCESS_MASK,const GENERIC_MAPPING*); From 7ceac2f6a44a18e616c3f2e68a43bf4388288d9d Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 11 Mar 2014 22:51:22 +0000 Subject: [PATCH 097/113] [NTOSKRNL] Massive cleanup of old and deprecated "Ros-Mm"-Code svn path=/trunk/; revision=62481 --- reactos/ntoskrnl/include/internal/mm.h | 393 +-------------- reactos/ntoskrnl/ke/powerpc/kiinit.c | 9 +- reactos/ntoskrnl/ke/powerpc/stubs.c | 7 - reactos/ntoskrnl/mm/amd64/page.c | 69 --- reactos/ntoskrnl/mm/arm/page.c | 26 - reactos/ntoskrnl/mm/arm/stubs.c | 145 ------ reactos/ntoskrnl/mm/freelist.c | 4 - reactos/ntoskrnl/mm/i386/page.c | 30 -- reactos/ntoskrnl/mm/i386/pagepae.c | 638 ------------------------- reactos/ntoskrnl/mm/marea.c | 2 +- reactos/ntoskrnl/mm/pagefile.c | 38 -- reactos/ntoskrnl/mm/powerpc/page.c | 130 ----- 12 files changed, 13 insertions(+), 1478 deletions(-) diff --git a/reactos/ntoskrnl/include/internal/mm.h b/reactos/ntoskrnl/include/internal/mm.h index 1af6e97647b..af0d03d464d 100644 --- a/reactos/ntoskrnl/include/internal/mm.h +++ b/reactos/ntoskrnl/include/internal/mm.h @@ -9,9 +9,6 @@ struct _EPROCESS; extern PMMSUPPORT MmKernelAddressSpace; extern PFN_COUNT MiFreeSwapPages; extern PFN_COUNT MiUsedSwapPages; -extern SIZE_T MmTotalPagedPoolQuota; -extern SIZE_T MmTotalNonPagedPoolQuota; -extern PHYSICAL_ADDRESS MmSharedDataPagePhysicalAddress; extern PFN_COUNT MmNumberOfPhysicalPages; extern UCHAR MmDisablePagingExecutive; extern PFN_NUMBER MmLowestPhysicalPage; @@ -19,9 +16,6 @@ extern PFN_NUMBER MmHighestPhysicalPage; extern PFN_NUMBER MmAvailablePages; extern PFN_NUMBER MmResidentAvailablePages; -extern PMEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptor; -extern MEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptorOrg; - extern LIST_ENTRY MmLoadedUserImageList; extern KMUTANT MmSystemLoadLock; @@ -43,8 +37,8 @@ extern SIZE_T MmPagedPoolCommit; extern SIZE_T MmPeakCommitment; extern SIZE_T MmtotalCommitLimitMaximum; -extern PVOID MiDebugMapping; -extern PMMPTE MmDebugPte; +extern PVOID MiDebugMapping; // internal +extern PMMPTE MmDebugPte; // internal struct _KTRAP_FRAME; struct _EPROCESS; @@ -66,7 +60,7 @@ typedef ULONG_PTR SWAPENTRY; // #define MMDBG_COPY_MAX_SIZE 0x8 -#if defined(_X86_) +#if defined(_X86_) // intenal for marea.c #define MI_STATIC_MEMORY_AREAS (14) #else #define MI_STATIC_MEMORY_AREAS (13) @@ -77,19 +71,6 @@ typedef ULONG_PTR SWAPENTRY; #define MEMORY_AREA_OWNED_BY_ARM3 (15) #define MEMORY_AREA_STATIC (0x80000000) -#define MM_PHYSICAL_PAGE_MPW_PENDING (0x8) - -#define MM_CORE_DUMP_TYPE_NONE (0x0) -#define MM_CORE_DUMP_TYPE_MINIMAL (0x1) -#define MM_CORE_DUMP_TYPE_FULL (0x2) - -/* Number of list heads to use */ -#define MI_FREE_POOL_LISTS 4 - - -/* Signature of free pool blocks */ -#define MM_FREE_POOL_TAG 'lprF' - /* Although Microsoft says this isn't hardcoded anymore, they won't be able to change it. Stuff depends on it */ #define MM_VIRTMEM_GRANULARITY (64 * 1024) @@ -119,32 +100,13 @@ typedef ULONG_PTR SWAPENTRY; #define SESSION_POOL_MASK 32 #define VERIFIER_POOL_MASK 64 -#define MM_PAGED_POOL_SIZE (100*1024*1024) -#define MM_NONPAGED_POOL_SIZE (100*1024*1024) - -/* - * Paged and non-paged pools are 8-byte aligned - */ -#define MM_POOL_ALIGNMENT 8 - +// FIXME: use ALIGN_UP_BY #define MM_ROUND_UP(x,s) \ ((PVOID)(((ULONG_PTR)(x)+(s)-1) & ~((ULONG_PTR)(s)-1))) #define MM_ROUND_DOWN(x,s) \ ((PVOID)(((ULONG_PTR)(x)) & ~((ULONG_PTR)(s)-1))) -#define PAGE_FLAGS_VALID_FROM_USER_MODE \ - (PAGE_READONLY | \ - PAGE_READWRITE | \ - PAGE_WRITECOPY | \ - PAGE_EXECUTE | \ - PAGE_EXECUTE_READ | \ - PAGE_EXECUTE_READWRITE | \ - PAGE_EXECUTE_WRITECOPY | \ - PAGE_GUARD | \ - PAGE_NOACCESS | \ - PAGE_NOCACHE) - #define PAGE_FLAGS_VALID_FOR_SECTION \ (PAGE_READONLY | \ PAGE_READWRITE | \ @@ -331,9 +293,10 @@ typedef struct _MMPFNENTRY USHORT RemovalRequested:1; USHORT CacheAttribute:2; USHORT Rom:1; - USHORT ParityError:1; // HasRmap + USHORT ParityError:1; } MMPFNENTRY; +// Mm internal typedef struct _MMPFN { union @@ -427,6 +390,7 @@ typedef struct _MM_REGION LIST_ENTRY RegionListEntry; } MM_REGION, *PMM_REGION; +// Mm internal /* Entry describing free pool memory */ typedef struct _MMFREE_POOL_ENTRY { @@ -531,9 +495,10 @@ MmLocateMemoryAreaByAddress( PVOID Address ); +// fixme: unused? ULONG_PTR NTAPI -MmFindGapAtAddress( +MmFindGapAtAddress_( PMMSUPPORT AddressSpace, PVOID Address ); @@ -556,10 +521,6 @@ MmFreeMemoryAreaByPtr( PVOID FreePageContext ); -VOID -NTAPI -MmDumpMemoryAreas(PMMSUPPORT AddressSpace); - PMEMORY_AREA NTAPI MmLocateMemoryAreaByRegion( @@ -577,14 +538,6 @@ MmFindGap( BOOLEAN TopDown ); -VOID -NTAPI -MmReleaseMemoryAreaIfDecommitted( - struct _EPROCESS *Process, - PMMSUPPORT AddressSpace, - PVOID BaseAddress -); - VOID NTAPI MmMapMemoryArea(PVOID BaseAddress, @@ -603,14 +556,6 @@ MiCheckAllProcessMemoryAreas(VOID); /* npool.c *******************************************************************/ -VOID -NTAPI -MiDebugDumpNonPagedPool(BOOLEAN NewOnly); - -VOID -NTAPI -MiDebugDumpNonPagedPoolStats(BOOLEAN NewOnly); - VOID NTAPI MiInitializeNonPagedPool(VOID); @@ -634,71 +579,8 @@ MiFreePoolPages( IN PVOID StartingAddress ); -PVOID -NTAPI -MmGetMdlPageAddress( - PMDL Mdl, - PVOID Offset -); - /* pool.c *******************************************************************/ -PVOID -NTAPI -ExAllocateNonPagedPoolWithTag( - POOL_TYPE type, - ULONG size, - ULONG Tag, - PVOID Caller -); - -PVOID -NTAPI -ExAllocatePagedPoolWithTag( - POOL_TYPE Type, - ULONG size, - ULONG Tag -); - -VOID -NTAPI -ExFreeNonPagedPool(PVOID block); - -VOID -NTAPI -ExFreePagedPool(IN PVOID Block); - -BOOLEAN -NTAPI -ExpIsPoolTagDebuggable(ULONG Tag); - -PVOID -NTAPI -ExpAllocateDebugPool( - POOL_TYPE Type, - ULONG Size, - ULONG Tag, - PVOID Caller, - BOOLEAN EndOfPage -); - -VOID -NTAPI -ExpFreeDebugPool(PVOID Block, BOOLEAN PagedPool); - -VOID -NTAPI -MmInitializePagedPool(VOID); - -PVOID -NTAPI -MiAllocateSpecialPool( - IN POOL_TYPE PoolType, - IN SIZE_T NumberOfBytes, - IN ULONG Tag, - IN ULONG Underrun -); - BOOLEAN NTAPI MiRaisePoolQuota( @@ -718,10 +600,6 @@ MmBuildMdlFromPages( /* mminit.c ******************************************************************/ -VOID -NTAPI -MiShutdownMemoryManager(VOID); - VOID NTAPI MmInit1( @@ -733,13 +611,6 @@ NTAPI MmInitSystem(IN ULONG Phase, IN PLOADER_PARAMETER_BLOCK LoaderBlock); -VOID -NTAPI -MiFreeInitMemory(VOID); - -VOID -NTAPI -MmInitializeMdlImplementation(VOID); /* pagefile.c ****************************************************************/ @@ -747,10 +618,6 @@ SWAPENTRY NTAPI MmAllocSwapPage(VOID); -VOID -NTAPI -MmDereserveSwapPages(ULONG Nr); - VOID NTAPI MmFreeSwapPage(SWAPENTRY Entry); @@ -770,10 +637,6 @@ MmReadFromSwapPage( PFN_NUMBER Page ); -BOOLEAN -NTAPI -MmReserveSwapPages(ULONG Nr); - NTSTATUS NTAPI MmWriteToSwapPage( @@ -781,21 +644,6 @@ MmWriteToSwapPage( PFN_NUMBER Page ); -NTSTATUS -NTAPI -MmDumpToPagingFile( - ULONG BugCode, - ULONG BugCodeParameter1, - ULONG BugCodeParameter2, - ULONG BugCodeParameter3, - ULONG BugCodeParameter4, - struct _KTRAP_FRAME* TrapFrame -); - -BOOLEAN -NTAPI -MmIsAvailableSwapPage(VOID); - VOID NTAPI MmShowOutOfSpaceMessagePagingFile(VOID); @@ -908,75 +756,8 @@ MmAccessFault( IN PVOID TrapInformation ); -/* anonmem.c *****************************************************************/ - -NTSTATUS -NTAPI -MmNotPresentFaultVirtualMemory( - PMMSUPPORT AddressSpace, - MEMORY_AREA* MemoryArea, - PVOID Address -); - -NTSTATUS -NTAPI -MmPageOutVirtualMemory( - PMMSUPPORT AddressSpace, - PMEMORY_AREA MemoryArea, - PVOID Address, - PFN_NUMBER Page -); - -NTSTATUS -NTAPI -MmQueryAnonMem( - PMEMORY_AREA MemoryArea, - PVOID Address, - PMEMORY_BASIC_INFORMATION Info, - PSIZE_T ResultLength -); - -VOID -NTAPI -MmFreeVirtualMemory( - struct _EPROCESS* Process, - PMEMORY_AREA MemoryArea -); - -NTSTATUS -NTAPI -MmProtectAnonMem( - PMMSUPPORT AddressSpace, - PMEMORY_AREA MemoryArea, - PVOID BaseAddress, - SIZE_T Length, - ULONG Protect, - PULONG OldProtect -); - -NTSTATUS -NTAPI -MmWritePageVirtualMemory( - PMMSUPPORT AddressSpace, - PMEMORY_AREA MArea, - PVOID Address, - PFN_NUMBER Page -); - /* kmap.c ********************************************************************/ -PVOID -NTAPI -ExAllocatePage(VOID); - -VOID -NTAPI -ExUnmapPage(PVOID Addr); - -PVOID -NTAPI -ExAllocatePageWithPhysPage(PFN_NUMBER Page); - NTSTATUS NTAPI MiCopyFromUserPage( @@ -984,16 +765,6 @@ MiCopyFromUserPage( PFN_NUMBER OldPage ); -NTSTATUS -NTAPI -MiZeroPage(PFN_NUMBER Page); - -/* memsafe.s *****************************************************************/ - -PVOID -FASTCALL -MmSafeReadPtr(PVOID Source); - /* process.c *****************************************************************/ PVOID @@ -1149,40 +920,12 @@ VOID NTAPI MmRemoveLRUUserPage(PFN_NUMBER Page); -VOID -NTAPI -MmLockPage(PFN_NUMBER Page); - -VOID -NTAPI -MmUnlockPage(PFN_NUMBER Page); - -ULONG -NTAPI -MmGetLockCountPage(PFN_NUMBER Page); - -VOID -NTAPI -MmInitializePageList( - VOID -); - VOID NTAPI MmDumpArmPfnDatabase( IN BOOLEAN StatusOnly ); -PFN_NUMBER -NTAPI -MmGetContinuousPages( - ULONG NumberOfBytes, - PHYSICAL_ADDRESS LowestAcceptableAddress, - PHYSICAL_ADDRESS HighestAcceptableAddress, - PHYSICAL_ADDRESS BoundaryAddressMultiple, - BOOLEAN ZeroPages -); - VOID NTAPI MmZeroPageThread( @@ -1231,22 +974,6 @@ MmCreateHyperspaceMapping(IN PFN_NUMBER Page) /* i386/page.c *********************************************************/ -NTSTATUS -NTAPI -MmCreateVirtualMappingForKernel( - PVOID Address, - ULONG flProtect, - PPFN_NUMBER Pages, - ULONG PageCount -); - -NTSTATUS -NTAPI -MmCommitPagedPoolAddress( - PVOID Address, - BOOLEAN Locked -); - NTSTATUS NTAPI MmCreateVirtualMapping( @@ -1299,13 +1026,6 @@ VOID NTAPI MmInitGlobalKernelPageDirectory(VOID); -VOID -NTAPI -MmEnableVirtualMapping( - struct _EPROCESS *Process, - PVOID Address -); - VOID NTAPI MmGetPageFileMapping( @@ -1336,13 +1056,6 @@ MmIsPageSwapEntry( PVOID Address ); -VOID -NTAPI -MmTransferOwnershipPage( - PFN_NUMBER Page, - ULONG NewConsumer -); - VOID NTAPI MmSetDirtyPage( @@ -1356,16 +1069,6 @@ MmAllocPage( ULONG Consumer ); -LONG -NTAPI -MmAllocPagesSpecifyRange( - ULONG Consumer, - PHYSICAL_ADDRESS LowestAddress, - PHYSICAL_ADDRESS HighestAddress, - ULONG NumberOfPages, - PPFN_NUMBER Pages -); - VOID NTAPI MmDereferencePage(PFN_NUMBER Page); @@ -1399,10 +1102,6 @@ MmSetCleanPage( PVOID Address ); -NTSTATUS -NTAPI -MmCreatePageTable(PVOID PAddress); - VOID NTAPI MmDeletePageTable( @@ -1439,10 +1138,6 @@ MmInitializeHandBuiltProcess2( IN PEPROCESS Process ); -NTSTATUS -NTAPI -MmReleaseMmInfo(struct _EPROCESS *Process); - NTSTATUS NTAPI MmSetExecuteOptions(IN ULONG ExecuteOptions); @@ -1451,10 +1146,6 @@ NTSTATUS NTAPI MmGetExecuteOptions(IN PULONG ExecuteOptions); -VOID -NTAPI -MmDeleteProcessPageDirectory(struct _EPROCESS *Process); - VOID NTAPI MmDeleteVirtualMapping( @@ -1472,30 +1163,6 @@ MmIsDirtyPage( PVOID Address ); -VOID -NTAPI -MmMarkPageMapped(PFN_NUMBER Page); - -VOID -NTAPI -MmMarkPageUnmapped(PFN_NUMBER Page); - -VOID -NTAPI -MmUpdatePageDir( - struct _EPROCESS *Process, - PVOID Address, - ULONG Size -); - -VOID -NTAPI -MiInitPageDirectoryMap(VOID); - -ULONG -NTAPI -MiGetUserPageDirectoryCount(VOID); - /* wset.c ********************************************************************/ NTSTATUS @@ -1565,13 +1232,6 @@ MmGetFileNameForSection( OUT POBJECT_NAME_INFORMATION *ModuleName ); -PVOID -NTAPI -MmAllocateSection( - IN SIZE_T Length, - PVOID BaseAddress -); - NTSTATUS NTAPI MmQuerySectionView( @@ -1630,41 +1290,6 @@ VOID NTAPI MmFreeSectionSegments(PFILE_OBJECT FileObject); -/* mpw.c *********************************************************************/ - -NTSTATUS -NTAPI -MmInitMpwThread(VOID); - -NTSTATUS -NTAPI -MmInitBsmThread(VOID); - -/* pager.c *******************************************************************/ - -BOOLEAN -NTAPI -MiIsPagerThread(VOID); - -VOID -NTAPI -MiStartPagerThread(VOID); - -VOID -NTAPI -MiStopPagerThread(VOID); - -NTSTATUS -FASTCALL -MiQueryVirtualMemory( - IN HANDLE ProcessHandle, - IN PVOID Address, - IN MEMORY_INFORMATION_CLASS VirtualMemoryInformationClass, - OUT PVOID VirtualMemoryInformation, - IN SIZE_T Length, - OUT PSIZE_T ResultLength -); - /* sysldr.c ******************************************************************/ VOID diff --git a/reactos/ntoskrnl/ke/powerpc/kiinit.c b/reactos/ntoskrnl/ke/powerpc/kiinit.c index 1d9c68b7f3c..94ed31e51ac 100644 --- a/reactos/ntoskrnl/ke/powerpc/kiinit.c +++ b/reactos/ntoskrnl/ke/powerpc/kiinit.c @@ -189,7 +189,7 @@ KiInitializeKernel(IN PKPROCESS InitProcess, InitThread->Affinity = 1 << Number; InitThread->WaitIrql = DISPATCH_LEVEL; InitProcess->ActiveProcessors = 1 << Number; - + /* HACK for MmUpdatePageDir */ ((PETHREAD)InitThread)->ThreadsProcess = (PEPROCESS)InitProcess; @@ -228,11 +228,8 @@ KiInitializeKernel(IN PKPROCESS InitProcess, Prcb->DpcStack = DpcStack; } - /* Free Initial Memory */ - // MiFreeInitMemory(); - KfRaiseIrql(DISPATCH_LEVEL); - + KeSetPriorityThread(InitThread, 0); /* Setup decrementer exception */ KiSetupDecrementerTrap(); @@ -297,7 +294,7 @@ KiSystemStartupReal(IN PLOADER_PARAMETER_BLOCK LoaderBlock) /* Skip initial setup if this isn't the Boot CPU */ if (Cpu) goto AppCpuInit; - + /* Initialize the PCR */ RtlZeroMemory(Pcr, PAGE_SIZE); KiInitializePcr(Cpu, diff --git a/reactos/ntoskrnl/ke/powerpc/stubs.c b/reactos/ntoskrnl/ke/powerpc/stubs.c index 3f4e8983331..99744da4c6f 100644 --- a/reactos/ntoskrnl/ke/powerpc/stubs.c +++ b/reactos/ntoskrnl/ke/powerpc/stubs.c @@ -151,13 +151,6 @@ KiSwapContext(PKTHREAD CurrentThread, PKTHREAD NewThread) return TRUE; } -NTSTATUS -NTAPI -Mmi386ReleaseMmInfo(PEPROCESS Process) -{ - return STATUS_UNSUCCESSFUL; -} - VOID NTAPI KeI386VdmInitialize(VOID) diff --git a/reactos/ntoskrnl/mm/amd64/page.c b/reactos/ntoskrnl/mm/amd64/page.c index 573c9834583..315feb01e04 100644 --- a/reactos/ntoskrnl/mm/amd64/page.c +++ b/reactos/ntoskrnl/mm/amd64/page.c @@ -137,57 +137,6 @@ MiFlushTlb(PMMPTE Pte, PVOID Address) } } -static -VOID -MmDeletePageTablePfn(PFN_NUMBER PageFrameNumber, ULONG Level) -{ - PMMPTE PageTable; - KIRQL OldIrql; - PMMPFN PfnEntry; - ULONG i, NumberEntries; - - /* Check if this is a page table */ - if (Level > 0) - { - NumberEntries = (Level == 4) ? MiAddressToPxi(MmHighestUserAddress)+1 : 512; - - /* Map the page table in hyperspace */ - PageTable = (PMMPTE)MmCreateHyperspaceMapping(PageFrameNumber); - - /* Loop all page table entries */ - for (i = 0; i < NumberEntries; i++) - { - /* Check if the entry is valid */ - if (PageTable[i].u.Hard.Valid) - { - /* Recursively free the page that backs it */ - MmDeletePageTablePfn(PageTable[i].u.Hard.PageFrameNumber, Level - 1); - } - } - - /* Delete the hyperspace mapping */ - MmDeleteHyperspaceMapping(PageTable); - } - - /* Check if this is a legacy allocation */ - PfnEntry = MiGetPfnEntry(PageFrameNumber); - if (MI_IS_ROS_PFN(PfnEntry)) - { - /* Free it using the legacy API */ - MmReleasePageMemoryConsumer(MC_SYSTEM, PageFrameNumber); - } - else - { - OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock); - - /* Free it using the ARM3 API */ - MI_SET_PFN_DELETED(PfnEntry); - MiDecrementShareCount(PfnEntry, PageFrameNumber); - - KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); - } -} - static PMMPTE MiGetPteForProcess( @@ -497,15 +446,6 @@ MmSetDirtyPage(PEPROCESS Process, PVOID Address) MiFlushTlb(Pte, Address); } - -NTSTATUS -NTAPI -Mmi386ReleaseMmInfo(PEPROCESS Process) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - VOID NTAPI MmDeleteVirtualMapping( @@ -560,15 +500,6 @@ MmDeletePageFileMapping(PEPROCESS Process, PVOID Address, UNIMPLEMENTED; } - -VOID -NTAPI -MmEnableVirtualMapping(PEPROCESS Process, PVOID Address) -{ - UNIMPLEMENTED; -} - - NTSTATUS NTAPI MmCreatePageFileMapping(PEPROCESS Process, diff --git a/reactos/ntoskrnl/mm/arm/page.c b/reactos/ntoskrnl/mm/arm/page.c index 3ae1430f89e..de76e662340 100644 --- a/reactos/ntoskrnl/mm/arm/page.c +++ b/reactos/ntoskrnl/mm/arm/page.c @@ -137,16 +137,6 @@ MmCreateProcessAddressSpace(IN ULONG MinWs, return FALSE; } -VOID -NTAPI -MmUpdatePageDir(IN PEPROCESS Process, - IN PVOID Address, - IN ULONG Size) -{ - /* Nothing to do */ - return; -} - PULONG NTAPI MmGetPageDirectory(VOID) @@ -309,19 +299,3 @@ MmInitGlobalKernelPageDirectory(VOID) } } -/* PUBLIC FUNCTIONS ***********************************************************/ - -/* - * @implemented - */ -PHYSICAL_ADDRESS -NTAPI -MmGetPhysicalAddress(IN PVOID Address) -{ - PHYSICAL_ADDRESS PhysicalAddress; - PhysicalAddress.QuadPart = 0; - - UNIMPLEMENTED_DBGBREAK(); - - return PhysicalAddress; -} diff --git a/reactos/ntoskrnl/mm/arm/stubs.c b/reactos/ntoskrnl/mm/arm/stubs.c index 2d43dfc27db..bed724de73e 100644 --- a/reactos/ntoskrnl/mm/arm/stubs.c +++ b/reactos/ntoskrnl/mm/arm/stubs.c @@ -237,58 +237,6 @@ MiGetPageEntryForProcess(IN PEPROCESS Process, return Pte; } -VOID -NTAPI -MmDeletePageTable(IN PEPROCESS Process, - IN PVOID Address) -{ - PMMPDE_HARDWARE PointerPde; - - // - // Not valid for kernel addresses - // - DPRINT("MmDeletePageTable(%p, %p)\n", Process, Address); - ASSERT(Address < MmSystemRangeStart); - - // - // Check if this is for a different process - // - if ((Process) && (Process != PsGetCurrentProcess())) - { - // - // FIXME-USER: Need to attach to the process - // - ASSERT(FALSE); - } - - // - // Get the PDE - // - PointerPde = MiGetPdeAddress(Address); - - // - // On ARM, we use a section mapping for the original low-memory mapping - // - if ((Address) || (PointerPde->u.Hard.Section.Valid == 0)) - { - // - // Make sure it's valid - // - ASSERT(PointerPde->u.Hard.Coarse.Valid == 1); - } - - // - // Clear the PDE - // - PointerPde->u.Hard.AsUlong = 0; - ASSERT(PointerPde->u.Hard.Coarse.Valid == 0); - - // - // Invalidate the TLB entry - // - MiFlushTlb((PMMPTE)PointerPde, MiGetPteAddress(Address)); -} - BOOLEAN NTAPI MmCreateProcessAddressSpace(IN ULONG MinWs, @@ -367,17 +315,6 @@ MmCreateProcessAddressSpace(IN ULONG MinWs, return TRUE; } -NTSTATUS -NTAPI -Mmi386ReleaseMmInfo(IN PEPROCESS Process) -{ - // - // FIXME-USER: Need to delete address space - // - UNIMPLEMENTED_DBGBREAK(); - return STATUS_NOT_IMPLEMENTED; -} - PULONG NTAPI MmGetPageDirectory(VOID) @@ -388,17 +325,6 @@ MmGetPageDirectory(VOID) return (PULONG)KeArmTranslationTableRegisterGet().AsUlong; } -VOID -NTAPI -MmEnableVirtualMapping(IN PEPROCESS Process, - IN PVOID Address) -{ - // - // TODO - // - UNIMPLEMENTED_DBGBREAK(); -} - NTSTATUS NTAPI MmCreateVirtualMappingInternal(IN PEPROCESS Process, @@ -482,24 +408,6 @@ MmCreateVirtualMappingInternal(IN PEPROCESS Process, return STATUS_SUCCESS; } -NTSTATUS -NTAPI -MmCreateVirtualMappingForKernel(IN PVOID Address, - IN ULONG Protection, - IN PPFN_NUMBER Pages, - IN ULONG PageCount) -{ - // - // Call the internal version - // - return MmCreateVirtualMappingInternal(NULL, - Address, - Protection, - Pages, - PageCount, - FALSE); -} - NTSTATUS NTAPI MmCreateVirtualMappingUnsafe(IN PEPROCESS Process, @@ -774,59 +682,6 @@ MmInitGlobalKernelPageDirectory(VOID) } } -VOID -NTAPI -MiInitPageDirectoryMap(VOID) -{ - MEMORY_AREA* MemoryArea = NULL; - PVOID BaseAddress; - NTSTATUS Status; - - // - // Create memory area for the PTE area - // - BaseAddress = (PVOID)PTE_BASE; - Status = MmCreateMemoryArea(MmGetKernelAddressSpace(), - MEMORY_AREA_OWNED_BY_ARM3, - &BaseAddress, - 0x1000000, - PAGE_READWRITE, - &MemoryArea, - TRUE, - 0, - PAGE_SIZE); - ASSERT(NT_SUCCESS(Status)); - - // - // Create memory area for the PDE area - // - BaseAddress = (PVOID)PDE_BASE; - Status = MmCreateMemoryArea(MmGetKernelAddressSpace(), - MEMORY_AREA_OWNED_BY_ARM3, - &BaseAddress, - 0x100000, - PAGE_READWRITE, - &MemoryArea, - TRUE, - 0, - PAGE_SIZE); - ASSERT(NT_SUCCESS(Status)); - - // - // And finally, hyperspace - // - BaseAddress = (PVOID)HYPER_SPACE; - Status = MmCreateMemoryArea(MmGetKernelAddressSpace(), - MEMORY_AREA_OWNED_BY_ARM3, - &BaseAddress, - PAGE_SIZE, - PAGE_READWRITE, - &MemoryArea, - TRUE, - 0, - PAGE_SIZE); - ASSERT(NT_SUCCESS(Status)); -} /* PUBLIC FUNCTIONS ***********************************************************/ diff --git a/reactos/ntoskrnl/mm/freelist.c b/reactos/ntoskrnl/mm/freelist.c index 62a5e6205f5..e65ba48ffbb 100644 --- a/reactos/ntoskrnl/mm/freelist.c +++ b/reactos/ntoskrnl/mm/freelist.c @@ -14,10 +14,6 @@ #define NDEBUG #include -#if defined (ALLOC_PRAGMA) -#pragma alloc_text(INIT, MmInitializePageList) -#endif - #define MODULE_INVOLVED_IN_ARM3 #include "ARM3/miarm.h" diff --git a/reactos/ntoskrnl/mm/i386/page.c b/reactos/ntoskrnl/mm/i386/page.c index c18a0d1c5f8..3ccebac2c38 100644 --- a/reactos/ntoskrnl/mm/i386/page.c +++ b/reactos/ntoskrnl/mm/i386/page.c @@ -16,7 +16,6 @@ #if defined (ALLOC_PRAGMA) #pragma alloc_text(INIT, MmInitGlobalKernelPageDirectory) -#pragma alloc_text(INIT, MiInitPageDirectoryMap) #endif @@ -592,35 +591,6 @@ MmSetDirtyPage(PEPROCESS Process, PVOID Address) } } -VOID -NTAPI -MmEnableVirtualMapping(PEPROCESS Process, PVOID Address) -{ - PULONG Pt; - ULONG Pte; - - Pt = MmGetPageTableForProcess(Process, Address, FALSE); - if (Pt == NULL) - { - //HACK to get DPH working, waiting for MM rewrite :-/ - //KeBugCheck(MEMORY_MANAGEMENT); - return; - } - - /* Do not mark a 0 page as present */ - if(0 == InterlockedCompareExchangePte(Pt, 0, 0)) - return; - - do - { - Pte = *Pt; - } while (Pte != InterlockedCompareExchangePte(Pt, Pte | PA_PRESENT, Pte)); - - /* We don't need to flush the TLB here because it - * won't cache translations for non-present pages */ - MmUnmapPageTable(Pt); -} - BOOLEAN NTAPI MmIsPagePresent(PEPROCESS Process, PVOID Address) diff --git a/reactos/ntoskrnl/mm/i386/pagepae.c b/reactos/ntoskrnl/mm/i386/pagepae.c index f7a4c428e7f..f217e972884 100644 --- a/reactos/ntoskrnl/mm/i386/pagepae.c +++ b/reactos/ntoskrnl/mm/i386/pagepae.c @@ -15,7 +15,6 @@ #if defined (ALLOC_PRAGMA) #pragma alloc_text(INIT, MmInitGlobalKernelPageDirectory) -#pragma alloc_text(INIT, MiInitPageDirectoryMap) #endif @@ -56,17 +55,6 @@ ULONGLONG MmGlobalKernelPageDirectoryForPAE[2048]; #define PAE_PTE_TO_PFN(X) (PAE_PAGE_MASK(X) >> PAGE_SHIFT) #define PAE_PFN_TO_PTE(X) ((X) << PAGE_SHIFT) -#if defined(__GNUC__) -#define PTE_TO_PAGE(X) ((LARGE_INTEGER)(LONGLONG)(PAGE_MASK(X))) -#else -__inline LARGE_INTEGER PTE_TO_PAGE(ULONG npage) -{ - LARGE_INTEGER dummy; - dummy.QuadPart = (LONGLONG)(PAGE_MASK(npage)); - return dummy; -} -#endif - extern BOOLEAN Ke386Pae; extern BOOLEAN Ke386NoExecute; @@ -197,149 +185,6 @@ ProtectToPTE(ULONG flProtect) #define PAE_ADDR_TO_PTE_OFFSET(v) ((((ULONG_PTR)(v)) % (512 * PAGE_SIZE)) / PAGE_SIZE) - -NTSTATUS -NTAPI -Mmi386ReleaseMmInfo(PEPROCESS Process) -{ - PUSHORT LdtDescriptor; - ULONG LdtBase; - ULONG i, j; - - DPRINT("Mmi386ReleaseMmInfo(Process %x)\n",Process); - - LdtDescriptor = (PUSHORT) &Process->Pcb.LdtDescriptor; - LdtBase = LdtDescriptor[1] | - ((LdtDescriptor[2] & 0xff) << 16) | - ((LdtDescriptor[3] & ~0xff) << 16); - - DPRINT("LdtBase: %x\n", LdtBase); - - if (LdtBase) - { - ExFreePool((PVOID) LdtBase); - } - - if (Ke386Pae) - { - PULONGLONG PageDirTable; - PULONGLONG PageDir; - PULONGLONG Pde; - ULONG k; - - PageDirTable = (PULONGLONG)MmCreateHyperspaceMapping(PAE_PTE_TO_PFN(Process->Pcb.DirectoryTableBase.QuadPart)); - for (i = 0; i < 4; i++) - { - PageDir = (PULONGLONG)MmCreateHyperspaceMapping(PAE_PTE_TO_PFN(PageDirTable[i])); - if (i < PAE_ADDR_TO_PDTE_OFFSET(MmSystemRangeStart)) - { - for (j = 0; j < 512; j++) - { - if (PageDir[j] != 0LL) - { - DPRINT1("ProcessId %d, Pde for %08x - %08x is not freed, RefCount %d\n", - Process->UniqueProcessId, - (i * 512 + j) * 512 * PAGE_SIZE, (i * 512 + j + 1) * 512 * PAGE_SIZE - 1, - ((PMADDRESS_SPACE)&Process->VadRoot)->PageTableRefCountTable[i*512 + j]); - Pde = MmCreateHyperspaceMapping(PAE_PTE_TO_PFN(PageDir[j])); - for (k = 0; k < 512; k++) - { - if(Pde[k] != 0) - { - if (Pde[k] & PA_PRESENT) - { - DPRINT1("Page at %08x is not freed\n", - (i * 512 + j) * 512 * PAGE_SIZE + k * PAGE_SIZE); - } - else - { - DPRINT1("Swapentry %x at %x is not freed\n", - (i * 512 + j) * 512 * PAGE_SIZE + k * PAGE_SIZE); - } - } - } - MmDeleteHyperspaceMapping(Pde); - MmReleasePageMemoryConsumer(MC_NPPOOL, PAE_PTE_TO_PFN(PageDir[j])); - } - } - } - if (i == PAE_ADDR_TO_PDTE_OFFSET(HYPERSPACE)) - { - MmReleasePageMemoryConsumer(MC_NPPOOL, PAE_PTE_TO_PFN(PageDir[PAE_ADDR_TO_PDE_PAGE_OFFSET(HYPERSPACE)])); - MmReleasePageMemoryConsumer(MC_NPPOOL, PAE_PTE_TO_PFN(PageDir[PAE_ADDR_TO_PDE_PAGE_OFFSET(HYPERSPACE)+1])); - } - MmDeleteHyperspaceMapping(PageDir); - MmReleasePageMemoryConsumer(MC_NPPOOL, PAE_PTE_TO_PFN(PageDirTable[i])); - } - MmDeleteHyperspaceMapping((PVOID)PageDirTable); - MmReleasePageMemoryConsumer(MC_NPPOOL, PAE_PTE_TO_PFN(Process->Pcb.DirectoryTableBase.QuadPart)); - } - else - { - PULONG Pde; - PULONG PageDir; - PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.u.LowPart)); - for (i = 0; i < ADDR_TO_PDE_OFFSET(MmSystemRangeStart); i++) - { - if (PageDir[i] != 0) - { - DPRINT1("Pde for %08x - %08x is not freed, RefCount %d\n", - i * 4 * 1024 * 1024, (i + 1) * 4 * 1024 * 1024 - 1, - ((PMADDRESS_SPACE)&Process->VadRoot)->PageTableRefCountTable[i]); - Pde = MmCreateHyperspaceMapping(PTE_TO_PFN(PageDir[i])); - for (j = 0; j < 1024; j++) - { - if(Pde[j] != 0) - { - if (Pde[j] & PA_PRESENT) - { - DPRINT1("Page at %08x is not freed\n", - i * 4 * 1024 * 1024 + j * PAGE_SIZE); - } - else - { - DPRINT1("Swapentry %x at %x is not freed\n", - Pde[j], i * 4 * 1024 * 1024 + j * PAGE_SIZE); - } - } - } - MmDeleteHyperspaceMapping(Pde); - MmReleasePageMemoryConsumer(MC_NPPOOL, PTE_TO_PFN(PageDir[i])); - } - } - MmReleasePageMemoryConsumer(MC_NPPOOL, PTE_TO_PFN(PageDir[ADDR_TO_PDE_OFFSET(HYPERSPACE)])); - MmDeleteHyperspaceMapping(PageDir); - MmReleasePageMemoryConsumer(MC_NPPOOL, PTE_TO_PFN(Process->Pcb.DirectoryTableBase.u.LowPart)); - } - -#if defined(__GNUC__) - - Process->Pcb.DirectoryTableBase.QuadPart = 0LL; -#else - - Process->Pcb.DirectoryTableBase.QuadPart = 0; -#endif - - DPRINT("Finished Mmi386ReleaseMmInfo()\n"); - return(STATUS_SUCCESS); -} - -NTSTATUS -NTAPI -MmInitializeHandBuiltProcess(IN PEPROCESS Process, - IN PLARGE_INTEGER DirectoryTableBase) -{ - /* Share the directory base with the idle process */ - *DirectoryTableBase = PsGetCurrentProcess()->Pcb.DirectoryTableBase; - - /* Initialize the Addresss Space */ - MmInitializeAddressSpace(Process, (PMADDRESS_SPACE)&Process->VadRoot); - - /* The process now has an address space */ - Process->HasAddressSpace = TRUE; - return STATUS_SUCCESS; -} - BOOLEAN NTAPI MmCreateProcessAddressSpace(IN ULONG MinWs, @@ -420,39 +265,6 @@ MmCreateProcessAddressSpace(IN ULONG MinWs, return TRUE; } -VOID -NTAPI -MmDeletePageTable(PEPROCESS Process, PVOID Address) -{ - PEPROCESS CurrentProcess = PsGetCurrentProcess(); - - if (Process != NULL && Process != CurrentProcess) - { - KeAttachProcess(&Process->Pcb); - } - - if (Ke386Pae) - { - ULONGLONG ZeroPde = 0LL; - (void)ExfpInterlockedExchange64UL(PAE_ADDR_TO_PDE(Address), &ZeroPde); - MiFlushTlb((PULONG)PAE_ADDR_TO_PDE(Address), PAE_ADDR_TO_PTE(Address)); - } - else - { - *(ADDR_TO_PDE(Address)) = 0; - MiFlushTlb(ADDR_TO_PDE(Address), ADDR_TO_PTE(Address)); - } - if (Address >= MmSystemRangeStart) - { - ASSERT(FALSE); - // MmGlobalKernelPageDirectory[ADDR_TO_PDE_OFFSET(Address)] = 0; - } - if (Process != NULL && Process != CurrentProcess) - { - KeDetachProcess(); - } -} - VOID NTAPI MmFreePageTable(PEPROCESS Process, PVOID Address) @@ -1105,73 +917,6 @@ MmIsDirtyPage(PEPROCESS Process, PVOID Address) } } -BOOLEAN -NTAPI -MmIsAccessedAndResetAccessPage(PEPROCESS Process, PVOID Address) -{ - if (Address < MmSystemRangeStart && Process == NULL) - { - DPRINT1("MmIsAccessedAndResetAccessPage is called for user space without a process.\n"); - ASSERT(FALSE); - } - if (Ke386Pae) - { - PULONGLONG Pt; - ULONGLONG Pte; - ULONGLONG tmpPte; - - Pt = MmGetPageTableForProcessForPAE(Process, Address, FALSE); - if (Pt == NULL) - { - ASSERT(FALSE); - } - - do - { - Pte = *Pt; - tmpPte = Pte & ~PA_ACCESSED; - } while (Pte != ExfInterlockedCompareExchange64UL(Pt, &tmpPte, &Pte)); - - if (Pte & PA_ACCESSED) - { - MiFlushTlb((PULONG)Pt, Address); - return TRUE; - } - else - { - MmUnmapPageTable((PULONG)Pt); - return FALSE; - } - } - else - { - PULONG Pt; - ULONG Pte; - - Pt = MmGetPageTableForProcess(Process, Address, FALSE); - if (Pt == NULL) - { - ASSERT(FALSE); - } - - do - { - Pte = *Pt; - } while (Pte != InterlockedCompareExchangeUL(Pt, Pte & ~PA_ACCESSED, Pte)); - - if (Pte & PA_ACCESSED) - { - MiFlushTlb(Pt, Address); - return TRUE; - } - else - { - MmUnmapPageTable(Pt); - return FALSE; - } - } -} - VOID NTAPI MmSetCleanPage(PEPROCESS Process, PVOID Address) @@ -1298,62 +1043,6 @@ MmSetDirtyPage(PEPROCESS Process, PVOID Address) } } -VOID -NTAPI -MmEnableVirtualMapping(PEPROCESS Process, PVOID Address) -{ - if (Ke386Pae) - { - PULONGLONG Pt; - ULONGLONG Pte; - ULONGLONG tmpPte; - - Pt = MmGetPageTableForProcessForPAE(Process, Address, FALSE); - if (Pt == NULL) - { - ASSERT(FALSE); - } - - do - { - Pte = *Pt; - tmpPte = Pte | PA_PRESENT; - } while (Pte != ExfInterlockedCompareExchange64UL(Pt, &tmpPte, &Pte)); - if (!(Pte & PA_PRESENT)) - { - MiFlushTlb((PULONG)Pt, Address); - } - else - { - MmUnmapPageTable((PULONG)Pt); - } - } - else - { - PULONG Pt; - ULONG Pte; - - Pt = MmGetPageTableForProcess(Process, Address, FALSE); - if (Pt == NULL) - { - ASSERT(FALSE); - } - - do - { - Pte = *Pt; - } while (Pte != InterlockedCompareExchangeUL(Pt, Pte | PA_PRESENT, Pte)); - if (!(Pte & PA_PRESENT)) - { - MiFlushTlb(Pt, Address); - } - else - { - MmUnmapPageTable(Pt); - } - } -} - BOOLEAN NTAPI MmIsPagePresent(PEPROCESS Process, PVOID Address) @@ -1386,134 +1075,6 @@ MmIsPageSwapEntry(PEPROCESS Process, PVOID Address) } } -NTSTATUS -NTAPI -MmCreateVirtualMappingForKernel(PVOID Address, - ULONG flProtect, - PPFN_NUMBER Pages, - ULONG PageCount) -{ - ULONG Attributes; - ULONG i; - PVOID Addr; - ULONG PdeOffset, oldPdeOffset; - BOOLEAN NoExecute = FALSE; - - DPRINT("MmCreateVirtualMappingForKernel(%x, %x, %x, %d)\n", - Address, flProtect, Pages, PageCount); - - if (Address < MmSystemRangeStart) - { - DPRINT1("MmCreateVirtualMappingForKernel is called for user space\n"); - ASSERT(FALSE); - } - - Attributes = ProtectToPTE(flProtect); - if (Attributes & 0x80000000) - { - NoExecute = TRUE; - } - Attributes &= 0xfff; - if (Ke386GlobalPagesEnabled) - { - Attributes |= PA_GLOBAL; - } - - Addr = Address; - - if (Ke386Pae) - { - PULONGLONG Pt = NULL; - ULONGLONG Pte; - - oldPdeOffset = PAE_ADDR_TO_PDE_OFFSET(Addr) + 1; - for (i = 0; i < PageCount; i++, Addr = (PVOID)((ULONG_PTR)Addr + PAGE_SIZE)) - { - if (!(Attributes & PA_PRESENT) && Pages[i] != 0) - { - DPRINT1("Setting physical address but not allowing access at address " - "0x%.8X with attributes %x/%x.\n", - Addr, Attributes, flProtect); - ASSERT(FALSE); - } - - PdeOffset = PAE_ADDR_TO_PDE_OFFSET(Addr); - if (oldPdeOffset != PdeOffset) - { - Pt = MmGetPageTableForProcessForPAE(NULL, Addr, TRUE); - if (Pt == NULL) - { - ASSERT(FALSE); - } - } - else - { - Pt++; - } - oldPdeOffset = PdeOffset; - - Pte = PFN_TO_PTE(Pages[i]) | Attributes; - if (NoExecute) - { - Pte |= 0x8000000000000000LL; - } - Pte = ExfpInterlockedExchange64UL(Pt, &Pte); - if (Pte != 0LL) - { - ASSERT(FALSE); - } - } - } - else - { - PULONG Pt; - ULONG Pte; - - oldPdeOffset = ADDR_TO_PDE_OFFSET(Addr); - Pt = MmGetPageTableForProcess(NULL, Addr, TRUE); - if (Pt == NULL) - { - ASSERT(FALSE); - } - Pt--; - - for (i = 0; i < PageCount; i++, Addr = (PVOID)((ULONG_PTR)Addr + PAGE_SIZE)) - { - if (!(Attributes & PA_PRESENT) && Pages[i] != 0) - { - DPRINT1("Setting physical address but not allowing access at address " - "0x%.8X with attributes %x/%x.\n", - Addr, Attributes, flProtect); - ASSERT(FALSE); - } - - PdeOffset = ADDR_TO_PDE_OFFSET(Addr); - if (oldPdeOffset != PdeOffset) - { - Pt = MmGetPageTableForProcess(NULL, Addr, TRUE); - if (Pt == NULL) - { - ASSERT(FALSE); - } - } - else - { - Pt++; - } - oldPdeOffset = PdeOffset; - - Pte = *Pt; - if (Pte != 0) - { - ASSERT(FALSE); - } - (void)InterlockedExchangeUL(Pt, PFN_TO_PTE(Pages[i]) | Attributes); - } - } - - return(STATUS_SUCCESS); -} - NTSTATUS NTAPI MmCreatePageFileMapping(PEPROCESS Process, @@ -1949,49 +1510,6 @@ MmSetPageProtect(PEPROCESS Process, PVOID Address, ULONG flProtect) } } -/* - * @implemented - */ -PHYSICAL_ADDRESS NTAPI -MmGetPhysicalAddress(PVOID vaddr) -/* - * FUNCTION: Returns the physical address corresponding to a virtual address - */ -{ - PHYSICAL_ADDRESS p; - - DPRINT("MmGetPhysicalAddress(vaddr %x)\n", vaddr); - if (Ke386Pae) - { - ULONGLONG Pte; - Pte = MmGetPageEntryForProcessForPAE(NULL, vaddr); - if (Pte != 0 && Pte & PA_PRESENT) - { - p.QuadPart = PAE_PAGE_MASK(Pte); - p.u.LowPart |= (ULONG_PTR)vaddr & (PAGE_SIZE - 1); - } - else - { - p.QuadPart = 0; - } - } - else - { - ULONG Pte; - Pte = MmGetPageEntryForProcess(NULL, vaddr); - if (Pte != 0 && Pte & PA_PRESENT) - { - p.QuadPart = PAGE_MASK(Pte); - p.u.LowPart |= (ULONG_PTR)vaddr & (PAGE_SIZE - 1); - } - else - { - p.QuadPart = 0; - } - } - return p; -} - PVOID NTAPI MmCreateHyperspaceMapping(PFN_NUMBER Page) @@ -2121,28 +1639,6 @@ MmCreateHyperspaceMapping(PFN_NUMBER Page) return Address; } -PFN_NUMBER -NTAPI -MmChangeHyperspaceMapping(PVOID Address, PFN_NUMBER NewPage) -{ - PFN_NUMBER Pfn; - ASSERT (IS_HYPERSPACE(Address)); - if (Ke386Pae) - { - ULONGLONG Entry = PAE_PFN_TO_PTE(NewPage) | PA_PRESENT | PA_READWRITE; - Entry = (ULONG)ExfpInterlockedExchange64UL(PAE_ADDR_TO_PTE(Address), &Entry); - Pfn = PAE_PTE_TO_PFN(Entry); - } - else - { - ULONG Entry; - Entry = InterlockedExchange((PLONG)ADDR_TO_PTE(Address), PFN_TO_PTE(NewPage) | PA_PRESENT | PA_READWRITE); - Pfn = PTE_TO_PFN(Entry); - } - __invlpg(Address); - return Pfn; -} - PFN_NUMBER NTAPI MmDeleteHyperspaceMapping(PVOID Address) @@ -2165,91 +1661,6 @@ MmDeleteHyperspaceMapping(PVOID Address) return Pfn; } -VOID -NTAPI -MmUpdatePageDir(PEPROCESS Process, PVOID Address, ULONG Size) -{ - ULONG StartOffset, EndOffset, Offset; - - if (Address < MmSystemRangeStart) - { - ASSERT(FALSE); - } - if (Ke386Pae) - { - PULONGLONG PageDirTable; - PULONGLONG Pde; - ULONGLONG ZeroPde = 0LL; - ULONG i; - - for (i = PAE_ADDR_TO_PDTE_OFFSET(Address); i <= PAE_ADDR_TO_PDTE_OFFSET((PVOID)((ULONG_PTR)Address + Size)); i++) - { - if (i == PAE_ADDR_TO_PDTE_OFFSET(Address)) - { - StartOffset = PAE_ADDR_TO_PDE_PAGE_OFFSET(Address); - } - else - { - StartOffset = 0; - } - if (i == PAE_ADDR_TO_PDTE_OFFSET((PVOID)((ULONG_PTR)Address + Size))) - { - EndOffset = PAE_ADDR_TO_PDE_PAGE_OFFSET((PVOID)((ULONG_PTR)Address + Size)); - } - else - { - EndOffset = 511; - } - - if (Process != NULL && Process != PsGetCurrentProcess()) - { - PageDirTable = MmCreateHyperspaceMapping(PAE_PTE_TO_PFN(Process->Pcb.DirectoryTableBase.QuadPart)); - Pde = (PULONGLONG)MmCreateHyperspaceMapping(PTE_TO_PFN(PageDirTable[i])); - MmDeleteHyperspaceMapping(PageDirTable); - } - else - { - Pde = (PULONGLONG)PAE_PAGEDIRECTORY_MAP + i*512; - } - - for (Offset = StartOffset; Offset <= EndOffset; Offset++) - { - if (i * 512 + Offset < PAE_ADDR_TO_PDE_OFFSET(PAGETABLE_MAP) || i * 512 + Offset >= PAE_ADDR_TO_PDE_OFFSET(PAGETABLE_MAP)+4) - { - (void)ExfInterlockedCompareExchange64UL(&Pde[Offset], &MmGlobalKernelPageDirectoryForPAE[i*512 + Offset], &ZeroPde); - } - } - MmUnmapPageTable((PULONG)Pde); - } - } - else - { - PULONG Pde; - StartOffset = ADDR_TO_PDE_OFFSET(Address); - EndOffset = ADDR_TO_PDE_OFFSET((PVOID)((ULONG_PTR)Address + Size)); - - if (Process != NULL && Process != PsGetCurrentProcess()) - { - Pde = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.u.LowPart)); - } - else - { - Pde = (PULONG)PAGEDIRECTORY_MAP; - } - for (Offset = StartOffset; Offset <= EndOffset; Offset++) - { - if (Offset != ADDR_TO_PDE_OFFSET(PAGETABLE_MAP)) - { - (void)InterlockedCompareExchangeUL(&Pde[Offset], MmGlobalKernelPageDirectory[Offset], 0); - } - } - if (Pde != (PULONG)PAGEDIRECTORY_MAP) - { - MmDeleteHyperspaceMapping(Pde); - } - } -} - VOID INIT_FUNCTION NTAPI @@ -2297,53 +1708,4 @@ MmInitGlobalKernelPageDirectory(VOID) } } -ULONG -NTAPI -MiGetUserPageDirectoryCount(VOID) -{ - return Ke386Pae ? PAE_ADDR_TO_PDE_OFFSET(MmSystemRangeStart) : ADDR_TO_PDE_OFFSET(MmSystemRangeStart); -} - -VOID -INIT_FUNCTION -NTAPI -MiInitPageDirectoryMap(VOID) -{ - MEMORY_AREA* kernel_map_desc = NULL; - MEMORY_AREA* hyperspace_desc = NULL; - PVOID BaseAddress; - NTSTATUS Status; - - DPRINT("MiInitPageDirectoryMap()\n"); - - BaseAddress = (PVOID)PAGETABLE_MAP; - Status = MmCreateMemoryArea(MmGetKernelAddressSpace(), - MEMORY_AREA_SYSTEM, - &BaseAddress, - Ke386Pae ? 0x800000 : 0x400000, - PAGE_READWRITE, - &kernel_map_desc, - TRUE, - 0, - PAGE_SIZE); - if (!NT_SUCCESS(Status)) - { - ASSERT(FALSE); - } - BaseAddress = (PVOID)HYPERSPACE; - Status = MmCreateMemoryArea(MmGetKernelAddressSpace(), - MEMORY_AREA_SYSTEM, - &BaseAddress, - 0x400000, - PAGE_READWRITE, - &hyperspace_desc, - TRUE, - 0, - PAGE_SIZE); - if (!NT_SUCCESS(Status)) - { - ASSERT(FALSE); - } -} - /* EOF */ diff --git a/reactos/ntoskrnl/mm/marea.c b/reactos/ntoskrnl/mm/marea.c index 759be7aef28..5deec1abb9b 100644 --- a/reactos/ntoskrnl/mm/marea.c +++ b/reactos/ntoskrnl/mm/marea.c @@ -1205,7 +1205,7 @@ MmDeleteProcessAddressSpace(PEPROCESS Process) MmUnlockAddressSpace(&Process->Vm); - DPRINT("Finished MmReleaseMmInfo()\n"); + DPRINT("Finished MmDeleteProcessAddressSpace()\n"); MmDeleteProcessAddressSpace2(Process); return(STATUS_SUCCESS); } diff --git a/reactos/ntoskrnl/mm/pagefile.c b/reactos/ntoskrnl/mm/pagefile.c index 06563d97e32..f534a66e1df 100644 --- a/reactos/ntoskrnl/mm/pagefile.c +++ b/reactos/ntoskrnl/mm/pagefile.c @@ -351,37 +351,6 @@ MmInitPagingFile(VOID) MiPagingFileCount = 0; } -BOOLEAN -NTAPI -MmReserveSwapPages(ULONG Nr) -{ - KIRQL oldIrql; - ULONG MiAvailSwapPages; - - KeAcquireSpinLock(&PagingFileListLock, &oldIrql); - MiAvailSwapPages = - (MiFreeSwapPages * MM_PAGEFILE_COMMIT_RATIO) + MM_PAGEFILE_COMMIT_GRACE; - MiReservedSwapPages = MiReservedSwapPages + Nr; - if ((MM_PAGEFILE_COMMIT_RATIO != 0) && (MiAvailSwapPages < MiReservedSwapPages)) - { - KeReleaseSpinLock(&PagingFileListLock, oldIrql); - return(FALSE); - } - KeReleaseSpinLock(&PagingFileListLock, oldIrql); - return(TRUE); -} - -VOID -NTAPI -MmDereserveSwapPages(ULONG Nr) -{ - KIRQL oldIrql; - - KeAcquireSpinLock(&PagingFileListLock, &oldIrql); - MiReservedSwapPages = MiReservedSwapPages - Nr; - KeReleaseSpinLock(&PagingFileListLock, oldIrql); -} - static ULONG MiAllocPageFromPagingFile(PPAGINGFILE PagingFile) { @@ -439,13 +408,6 @@ MmFreeSwapPage(SWAPENTRY Entry) KeReleaseSpinLock(&PagingFileListLock, oldIrql); } -BOOLEAN -NTAPI -MmIsAvailableSwapPage(VOID) -{ - return(MiFreeSwapPages > 0); -} - SWAPENTRY NTAPI MmAllocSwapPage(VOID) diff --git a/reactos/ntoskrnl/mm/powerpc/page.c b/reactos/ntoskrnl/mm/powerpc/page.c index 33f051dc1f5..c0acc4825b2 100644 --- a/reactos/ntoskrnl/mm/powerpc/page.c +++ b/reactos/ntoskrnl/mm/powerpc/page.c @@ -17,7 +17,6 @@ #if defined (ALLOC_PRAGMA) #pragma alloc_text(INIT, MmInitGlobalKernelPageDirectory) -#pragma alloc_text(INIT, MiInitPageDirectoryMap) #endif /* GLOBALS *****************************************************************/ @@ -103,22 +102,6 @@ MmCopyMmInfo(PEPROCESS Src, return(STATUS_SUCCESS); } -NTSTATUS -NTAPI -MmInitializeHandBuiltProcess(IN PEPROCESS Process, - IN PLARGE_INTEGER DirectoryTableBase) -{ - /* Share the directory base with the idle process */ - *DirectoryTableBase = PsGetCurrentProcess()->Pcb.DirectoryTableBase; - - /* Initialize the Addresss Space */ - MmInitializeAddressSpace(Process, (PMADDRESS_SPACE)&Process->VadRoot); - - /* The process now has an address space */ - Process->HasAddressSpace = TRUE; - return STATUS_SUCCESS; -} - BOOLEAN NTAPI MmCreateProcessAddressSpace(IN ULONG MinWs, @@ -177,20 +160,6 @@ MmGetPhysicalAddressProcess(PEPROCESS Process, PVOID Addr) return (PVOID)info.phys; } -/* - * @implemented - */ -PHYSICAL_ADDRESS NTAPI -MmGetPhysicalAddress(PVOID vaddr) -/* - * FUNCTION: Returns the physical address corresponding to a virtual address - */ -{ - PHYSICAL_ADDRESS Addr; - Addr.QuadPart = (ULONG)MmGetPhysicalAddressProcess(PsGetCurrentProcess()->UniqueProcessId, vaddr); - return Addr; -} - PFN_NUMBER NTAPI MmGetPfnForProcess(PEPROCESS Process, @@ -274,24 +243,6 @@ MmIsDirtyPage(PEPROCESS Process, PVOID Address) return !!(info.flags & MMU_PAGE_DIRTY); } -BOOLEAN -NTAPI -MmIsAccessedAndResetAccessPage(PEPROCESS Process, PVOID Address) -{ - ppc_map_info_t info = { 0 }; - - if (Address < MmSystemRangeStart && Process == NULL) - { - DPRINT1("MmIsAccessedAndResetAccessPage is called for user space without a process.\n"); - ASSERT(FALSE); - } - - info.proc = Process ? (int)Process->UniqueProcessId : 0; - info.addr = (vaddr_t)Address; - MmuInqPage(&info, 1); - return !!(info.flags /*& MMU_PAGE_ACCESS*/); -} - VOID NTAPI MmSetCleanPage(PEPROCESS Process, PVOID Address) @@ -304,12 +255,6 @@ MmSetDirtyPage(PEPROCESS Process, PVOID Address) { } -VOID -NTAPI -MmEnableVirtualMapping(PEPROCESS Process, PVOID Address) -{ -} - BOOLEAN NTAPI MmIsPagePresent(PEPROCESS Process, PVOID Address) @@ -335,44 +280,6 @@ MmIsPageSwapEntry(PEPROCESS Process, PVOID Address) return !(Entry & PA_PRESENT) && Entry != 0 ? TRUE : FALSE; } -NTSTATUS -NTAPI -MmCreateVirtualMappingForKernel(PVOID Address, - ULONG flProtect, - PPFN_NUMBER Pages, - ULONG PageCount) -{ - ULONG i; - PVOID Addr; - - DPRINT("MmCreateVirtualMappingForKernel(%x, %x, %x, %d)\n", - Address, flProtect, Pages, PageCount); - - if (Address < MmSystemRangeStart) - { - DPRINT1("MmCreateVirtualMappingForKernel is called for user space\n"); - ASSERT(FALSE); - } - - Addr = Address; - - for (i = 0; i < PageCount; i++, Addr = (PVOID)((ULONG_PTR)Addr + PAGE_SIZE)) - { -#if 0 - if (!(Attributes & PA_PRESENT) && Pages[i] != 0) - { - DPRINT1("Setting physical address but not allowing access at address " - "0x%.8X with attributes %x/%x.\n", - Addr, Attributes, flProtect); - ASSERT(FALSE); - } - (void)InterlockedExchangeUL(Pt, PFN_TO_PTE(Pages[i]) | Attributes); -#endif - } - - return(STATUS_SUCCESS); -} - NTSTATUS NTAPI MmCreatePageFileMapping(PEPROCESS Process, @@ -568,23 +475,6 @@ MmCreateHyperspaceMapping(PFN_NUMBER Page) return Address; } -PFN_NUMBER -NTAPI -MmChangeHyperspaceMapping(PVOID Address, PFN_NUMBER NewPage) -{ - PFN_NUMBER OldPage; - ppc_map_info_t info = { 0 }; - - info.proc = 0; - info.addr = (vaddr_t)Address; - MmuUnmapPage(&info, 1); - OldPage = info.phys; - info.phys = (paddr_t)NewPage; - MmuMapPage(&info, 1); - - return NewPage; -} - PFN_NUMBER NTAPI MmDeleteHyperspaceMapping(PVOID Address) @@ -607,26 +497,6 @@ MmInitGlobalKernelPageDirectory(VOID) { } -VOID -INIT_FUNCTION -NTAPI -MiInitPageDirectoryMap(VOID) -{ -} - -ULONG -NTAPI -MiGetUserPageDirectoryCount(VOID) -{ - return 0; -} - -VOID -NTAPI -MmUpdatePageDir(PEPROCESS Process, PVOID Address, ULONG Size) -{ -} - /* Create a simple, primitive mapping at the specified address on a new page */ NTSTATUS MmPPCCreatePrimitiveMapping(ULONG_PTR PageAddr) { From a0173baa191ce5cf22e43ad7f348e3bdc239cce8 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 11 Mar 2014 22:56:31 +0000 Subject: [PATCH 098/113] [NTOSKRNL] Fix a bug in MmGetPhysicalAddress, that resulted in unwanted sign extension of physical addresses > 2GB. Will hopefully fix some uniata related issues. svn path=/trunk/; revision=62482 --- reactos/ntoskrnl/mm/ARM3/virtual.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/ntoskrnl/mm/ARM3/virtual.c b/reactos/ntoskrnl/mm/ARM3/virtual.c index 4630f52209d..0dc0196da34 100644 --- a/reactos/ntoskrnl/mm/ARM3/virtual.c +++ b/reactos/ntoskrnl/mm/ARM3/virtual.c @@ -5283,7 +5283,7 @@ MmGetPhysicalAddress(PVOID Address) if (TempPde.u.Hard.LargePage) { /* Physical address is base page + large page offset */ - PhysicalAddress.QuadPart = TempPde.u.Hard.PageFrameNumber << PAGE_SHIFT; + PhysicalAddress.QuadPart = (ULONG64)TempPde.u.Hard.PageFrameNumber << PAGE_SHIFT; PhysicalAddress.QuadPart += ((ULONG_PTR)Address & (PAGE_SIZE * PTE_PER_PAGE - 1)); return PhysicalAddress; } @@ -5293,7 +5293,7 @@ MmGetPhysicalAddress(PVOID Address) if (TempPte.u.Hard.Valid) { /* Physical address is base page + page offset */ - PhysicalAddress.QuadPart = TempPte.u.Hard.PageFrameNumber << PAGE_SHIFT; + PhysicalAddress.QuadPart = (ULONG64)TempPte.u.Hard.PageFrameNumber << PAGE_SHIFT; PhysicalAddress.QuadPart += ((ULONG_PTR)Address & (PAGE_SIZE - 1)); return PhysicalAddress; } From 3d31a14caae105051a26522636bfadceb60b7589 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Wed, 12 Mar 2014 19:54:08 +0000 Subject: [PATCH 099/113] [NTOSKRNL] Properly compute file name length for output buffer CORE-2582 svn path=/trunk/; revision=62484 --- reactos/ntoskrnl/fsrtl/notify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/fsrtl/notify.c b/reactos/ntoskrnl/fsrtl/notify.c index 1018edfdaef..9c2a420abae 100644 --- a/reactos/ntoskrnl/fsrtl/notify.c +++ b/reactos/ntoskrnl/fsrtl/notify.c @@ -494,7 +494,7 @@ FsRtlNotifyUpdateBuffer(OUT PFILE_NOTIFY_INFORMATION OutputBuffer, { OutputBuffer->NextEntryOffset = 0; OutputBuffer->Action = Action; - OutputBuffer->FileNameLength = DataLength - sizeof(FILE_NOTIFY_INFORMATION); + OutputBuffer->FileNameLength = DataLength - FIELD_OFFSET(FILE_NOTIFY_INFORMATION, FileName); if (IsUnicode) { if (ParentName->Length) From 6d582f3f95050c65444d6a19d473108740244778 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Wed, 12 Mar 2014 19:58:11 +0000 Subject: [PATCH 100/113] [FASTFAT] Also cleanup ongoing notifications during cleanup. This fixes kernel32:change winetests crash. This gets us from 300 tests executed, 134 failed to 312 executed, 33 failed. CORE-2582 svn path=/trunk/; revision=62485 --- reactos/drivers/filesystems/fastfat/cleanup.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/reactos/drivers/filesystems/fastfat/cleanup.c b/reactos/drivers/filesystems/fastfat/cleanup.c index 4887f9dfe4f..97c2515116e 100644 --- a/reactos/drivers/filesystems/fastfat/cleanup.c +++ b/reactos/drivers/filesystems/fastfat/cleanup.c @@ -57,6 +57,11 @@ VfatCleanupFile( return STATUS_PENDING; } + /* Notify about the cleanup */ + FsRtlNotifyCleanup(IrpContext->DeviceExt->NotifySync, + &(IrpContext->DeviceExt->NotifyList), + FileObject->FsContext2); + pFcb->OpenHandleCount--; if (!(*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY) && From fa0e017d2ac0a9b182709093f5d7649023581d6f Mon Sep 17 00:00:00 2001 From: James Tabor Date: Thu, 13 Mar 2014 01:36:31 +0000 Subject: [PATCH 101/113] [User32] - Patch by Henri Verbeet : Fix TEXT_WordBreak() when no characters fit. - Sync port from wine. svn path=/trunk/; revision=62486 --- reactos/win32ss/user/user32/windows/font.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/win32ss/user/user32/windows/font.c b/reactos/win32ss/user/user32/windows/font.c index 96b50d85b0c..7b5e1431f0d 100644 --- a/reactos/win32ss/user/user32/windows/font.c +++ b/reactos/win32ss/user/user32/windows/font.c @@ -605,7 +605,7 @@ static void TEXT_WordBreak (HDC hdc, WCHAR *str, unsigned int max_str, p = str + chars_fit; /* The character that doesn't fit */ word_fits = TRUE; if (!chars_fit) - ; /* we pretend that it fits anyway */ + word_fits = FALSE; else if (*p == SPACE) /* chars_fit < *len_str so this is valid */ p--; /* the word just fitted */ else @@ -615,7 +615,7 @@ static void TEXT_WordBreak (HDC hdc, WCHAR *str, unsigned int max_str, ; word_fits = (p != str || *p == SPACE || IsCJKT(p[1])); } - /* If there was one or the first character didn't fit then */ + /* If there was one. */ if (word_fits) { int next_is_space; From 4498725892b1f7d99bc6fe3a74fc74db369c210a Mon Sep 17 00:00:00 2001 From: James Tabor Date: Thu, 13 Mar 2014 01:39:31 +0000 Subject: [PATCH 102/113] [User32Test] - Patch by Henri Verbeet : Fix TEXT_WordBreak() when no characters fit. - Update text to wine head. svn path=/trunk/; revision=62487 --- rostests/winetests/user32/text.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/rostests/winetests/user32/text.c b/rostests/winetests/user32/text.c index 217baab89b1..19bcd72abbe 100755 --- a/rostests/winetests/user32/text.c +++ b/rostests/winetests/user32/text.c @@ -42,6 +42,8 @@ static void test_DrawTextCalcRect(void) 's','t','r','i','n','g','\0'}; static CHAR emptystring[] = ""; static WCHAR emptystringW[] = { 0 }; + static CHAR wordbreak_text[] = "line1 line2"; + static WCHAR wordbreak_textW[] = {'l','i','n','e','1',' ','l','i','n','e','2',0}; INT textlen, textheight, heightcheck; RECT rect = { 0, 0, 100, 0 }; BOOL ret; @@ -556,6 +558,20 @@ static void test_DrawTextCalcRect(void) ok(rect.bottom, "rect.bottom should not be 0\n"); } + SetRect(&rect, 0, 0, 1, 1); + heightcheck = DrawTextA(hdc, wordbreak_text, -1, &rect, DT_CALCRECT); + SetRect(&rect, 0, 0, 1, 1); + textheight = DrawTextA(hdc, wordbreak_text, -1, &rect, DT_CALCRECT | DT_WORDBREAK); + ok(textheight == heightcheck * 2, "Got unexpected textheight %d, expected %d.\n", + textheight, heightcheck * 2); + + SetRect(&rect, 0, 0, 1, 1); + heightcheck = DrawTextW(hdc, wordbreak_textW, -1, &rect, DT_CALCRECT); + SetRect(&rect, 0, 0, 1, 1); + textheight = DrawTextW(hdc, wordbreak_textW, -1, &rect, DT_CALCRECT | DT_WORDBREAK); + ok(textheight == heightcheck * 2, "Got unexpected textheight %d, expected %d.\n", + textheight, heightcheck * 2); + SelectObject(hdc, hOldFont); ret = DeleteObject(hFont); ok( ret, "DeleteObject error %u\n", GetLastError()); From 33acc4a2210a421471766dda0ac10a9453e29f1e Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Thu, 13 Mar 2014 15:04:47 +0000 Subject: [PATCH 103/113] [browseui] add partial german translation svn path=/trunk/; revision=62490 --- reactos/dll/win32/browseui/browseui.rc | 4 +- reactos/dll/win32/browseui/lang/de_DE.rc | 256 +++++++++++++++++++++++ 2 files changed, 259 insertions(+), 1 deletion(-) create mode 100644 reactos/dll/win32/browseui/lang/de_DE.rc diff --git a/reactos/dll/win32/browseui/browseui.rc b/reactos/dll/win32/browseui/browseui.rc index 63a07c00f2d..8e8b15aad20 100644 --- a/reactos/dll/win32/browseui/browseui.rc +++ b/reactos/dll/win32/browseui/browseui.rc @@ -49,7 +49,6 @@ IDR_REGTREEOPTIONS REGISTRY "res/regtreeoptions.rgs" //#include "lang/ca-ES.rc" //#include "lang/cs-CZ.rc" //#include "lang/da-DK.rc" -//#include "lang/de-DE.rc" //#include "lang/el-GR.rc" //#include "lang/en-GB.rc" //#include "lang/fi-FI.rc" @@ -74,6 +73,9 @@ IDR_REGTREEOPTIONS REGISTRY "res/regtreeoptions.rgs" #ifdef LANGUAGE_BG_BG #include "lang/bg-BG.rc" #endif +#ifdef LANGUAGE_DE_DE + #include "lang/de-DE.rc" +#endif #ifdef LANGUAGE_EN_US #include "lang/en-US.rc" #endif diff --git a/reactos/dll/win32/browseui/lang/de_DE.rc b/reactos/dll/win32/browseui/lang/de_DE.rc new file mode 100644 index 00000000000..d5bb0fdcfc4 --- /dev/null +++ b/reactos/dll/win32/browseui/lang/de_DE.rc @@ -0,0 +1,256 @@ +/* + * Copyright 2009 Andrew Hill + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL + +/* Menus */ + +IDM_CABINET_CONTEXTMENU MENUEX +BEGIN + POPUP "", 264,MFT_STRING,MFS_ENABLED + BEGIN + MENUITEM "&Standardschaltflächen", IDM_TOOLBARS_STANDARDBUTTONS, MFT_STRING, MFS_ENABLED + MENUITEM "&Adressleiste", IDM_TOOLBARS_ADDRESSBAR, MFT_STRING, MFS_ENABLED + MENUITEM "&Links", IDM_TOOLBARS_LINKSBAR, MFT_STRING, MFS_ENABLED + MENUITEM "", -1, MFT_SEPARATOR + MENUITEM "S&ymbolleisten fixieren", IDM_TOOLBARS_LOCKTOOLBARS, MFT_STRING, MFS_ENABLED + MENUITEM "&Anpassen...", IDM_TOOLBARS_CUSTOMIZE, MFT_STRING, MFS_ENABLED + MENUITEM "&Text Labels", IDM_TOOLBARS_TEXTLABELS, MFT_STRING, MFS_ENABLED + MENUITEM "&Go Button", IDM_TOOLBARS_GOBUTTON, MFT_STRING, MFS_ENABLED + END +END + +IDM_CABINET_MAINMENU MENUEX +BEGIN + POPUP "&Datei", FCIDM_MENU_FILE + BEGIN + MENUITEM "", -1, MFT_SEPARATOR + MENUITEM "&Schließen", IDM_FILE_CLOSE + END + POPUP "&Bearbeiten", FCIDM_MENU_EDIT + BEGIN + MENUITEM "", -1, MFT_SEPARATOR + END + POPUP "&Ansicht", FCIDM_MENU_VIEW + BEGIN + POPUP "&Symbolleisten", IDM_VIEW_TOOLBARS + BEGIN + MENUITEM "", -1, MFT_SEPARATOR + END + MENUITEM "S&tatusleiste", IDM_VIEW_STATUSBAR + POPUP "&Explorerleiste", IDM_VIEW_EXPLORERBAR + BEGIN + MENUITEM "Su&chen\tCtrl+E", IDM_EXPLORERBAR_SEARCH + MENUITEM "&Favoriten\tCtrl+I", IDM_EXPLORERBAR_FAVORITES + MENUITEM "&Media", IDM_EXPLORERBAR_MEDIA + MENUITEM "&Verlauf\tCtrl+H", IDM_EXPLORERBAR_HISTORY + MENUITEM "F&olders", IDM_EXPLORERBAR_FOLDERS + MENUITEM "", IDM_EXPLORERBAR_SEPARATOR + END + MENUITEM "", FCIDM_MENU_VIEW_SEP_OPTIONS, MFT_SEPARATOR + POPUP "&Wechseln zu", FCIDM_MENU_EXPLORE + BEGIN + MENUITEM "&Zurück\tAlt+Left Arrow", IDM_GOTO_BACK + MENUITEM "&Vorwärts\tAlt+Right Arrow", IDM_GOTO_FORWARD + MENUITEM "Ü&bergeordneter Ordner", IDM_GOTO_UPONELEVEL + MENUITEM "", -1, MFT_SEPARATOR + MENUITEM "&Startseite\tAlt+Home", IDM_GOTO_HOMEPAGE + END + MENUITEM "&Aktualisieren", IDM_VIEW_REFRESH + END + POPUP "F&avoriten", FCIDM_MENU_FAVORITES + BEGIN + MENUITEM "&Zu Favoriten hinzufügen...", IDM_FAVORITES_ADDTOFAVORITES + MENUITEM "Fav&oriten verwalten...", IDM_FAVORITES_ORGANIZEFAVORITES + MENUITEM "", -1, MFT_SEPARATOR + MENUITEM "(Leer)", IDM_FAVORITES_EMPTY + END + POPUP "E&xtras", FCIDM_MENU_TOOLS + BEGIN + MENUITEM "&Netzlaufwerk verbinden...", IDM_TOOLS_MAPNETWORKDRIVE + MENUITEM "Netzlaufwerk &trennen...", IDM_TOOLS_DISCONNECTNETWORKDRIVE + MENUITEM "&Synchronisieren...", IDM_TOOLS_SYNCHRONIZE + MENUITEM "", -1, MFT_SEPARATOR + MENUITEM "&Ordneroptionen...", IDM_TOOLS_FOLDEROPTIONS + END + POPUP "&?", FCIDM_MENU_HELP + BEGIN + MENUITEM "Ist diese Kopie von ReactOS &legal?", IDM_HELP_ISTHISCOPYLEGAL + MENUITEM "Ü&ber ReactOS", IDM_HELP_ABOUT + END +END + +/* Dialogs */ + +IDD_CUSTOMIZETOOLBAREX DIALOGEX 0, 0, 357, 33 +STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CAPTION +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + LTEXT "Te&xt Optionen:", -1, 4, 2, 48, 15 + COMBOBOX IDC_TEXTOPTIONS, 52, 0, 123, 57, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Ico&n Optionen:", -1, 4, 20, 48, 15 + COMBOBOX IDC_ICONOPTIONS, 52, 18, 123, 57, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +END + +/* Accelerators */ + +IDR_ACCELERATORS ACCELERATORS +BEGIN + VK_F5, IDM_VIEW_REFRESH, VIRTKEY, NOINVERT + VK_F5, IDM_VIEW_REFRESH, VIRTKEY, CONTROL, NOINVERT + "R", IDM_VIEW_REFRESH, VIRTKEY, CONTROL, NOINVERT + VK_HOME, IDM_GOTO_HOMEPAGE, VIRTKEY, ALT, NOINVERT + "D", IDM_FAVORITES_ADDTOFAVORITES, VIRTKEY, CONTROL, NOINVERT + "B", IDM_FAVORITES_ORGANIZEFAVORITES, VIRTKEY, CONTROL, NOINVERT + VK_LEFT, IDM_GOTO_BACK, VIRTKEY, ALT + VK_RIGHT, IDM_GOTO_FORWARD, VIRTKEY, ALT + "W", IDM_FILE_CLOSE, VIRTKEY, CONTROL, NOINVERT + "E", IDM_EXPLORERBAR_SEARCH, VIRTKEY, CONTROL, NOINVERT + "I", IDM_EXPLORERBAR_FAVORITES, VIRTKEY, CONTROL, NOINVERT + "H", IDM_EXPLORERBAR_HISTORY, VIRTKEY, CONTROL, NOINVERT +END + +/* Strings */ + +STRINGTABLE +BEGIN + 800 "Contains commands for manipulating the selected items." +END + +STRINGTABLE +BEGIN + 864 "Contains edit commands." +END + +STRINGTABLE +BEGIN + 928 "Contains commands for manipulating the view." +END + +STRINGTABLE +BEGIN + 992 "Contains tools commands." +END + +STRINGTABLE +BEGIN + 1056 "Contains commands for displaying Help." +END + +STRINGTABLE +BEGIN + 9025 "Closes the window." + 9026 "Goes up one level." +END + +STRINGTABLE +BEGIN + 9121 "Connects to a network drive." + 9122 "Disconnects from a network drive." +END + +STRINGTABLE +BEGIN + 9250 "Displays program information, version number, and copyright." + 9252 "Displays information for debugging." +END + +STRINGTABLE +BEGIN + 9281 "Goes to the previous page." + 9282 "Goes to the next page." + 9283 "Enables you to change settings." + 9285 "Goes to your home page." +END + +STRINGTABLE +BEGIN + 9362 "Opens the Favorites folder." + 9363 "Adds the current page to your Favorites list." +END + +STRINGTABLE +BEGIN + 9505 "Shows or hides toolbars." + 9506 "Shows or hides the status bar." + 9508 "Displays the Standard Buttons toolbar." + 9509 "Displays the Address bar." + 9510 "Displays the Quick Links bar." + 9516 "Locks the sizes and positions of the toolbars." +END + +STRINGTABLE +BEGIN + 9533 "Customizes the toolbar." +END + +STRINGTABLE +BEGIN + 9552 "Shows or hides an Explorer bar." + 9553 "Shows the Search bar." + 9554 "Shows the Favorites bar." + 9555 "Shows the History bar." + 9557 "Shows the Folders bar." + 9559 "Shows the Media Bar." +END + +STRINGTABLE +BEGIN + IDS_SMALLICONS "Kleine Symbole" + IDS_LARGEICONS "Große Symbole" + IDS_SHOWTEXTLABELS "Show text labels" +END + +STRINGTABLE +BEGIN + IDS_NOTEXTLABELS "No text labels" + IDS_SELECTIVETEXTONRIGHT "Selective text on right" +END + +STRINGTABLE +BEGIN + IDS_GOBUTTONLABEL "|Wechseln zu||" + IDS_GOBUTTONTIPTEMPLATE "Wechseln zu ""%s""" +END + +STRINGTABLE +BEGIN + IDS_SEARCHLABEL "Suchen" + IDS_ADDRESSBANDLABEL "A&dresse" +END + +STRINGTABLE +BEGIN + IDS_FOLDERSLABEL "Ordner" +END + +STRINGTABLE +BEGIN + IDS_HISTORYTEXT "&Verlauf\tCtrl+H" +END + +STRINGTABLE +BEGIN + IDS_UP "Aufwärts" +END + +STRINGTABLE +BEGIN + IDS_BACK "Zurück" + IDS_FORWARD "Vorwärts" +END From 3d21f7f3d09f540ad5ad8e4ad1c2a3895eb92da5 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Thu, 13 Mar 2014 15:07:20 +0000 Subject: [PATCH 104/113] fix build... svn path=/trunk/; revision=62491 --- reactos/dll/win32/browseui/lang/{de_DE.rc => de-DE.rc} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename reactos/dll/win32/browseui/lang/{de_DE.rc => de-DE.rc} (100%) diff --git a/reactos/dll/win32/browseui/lang/de_DE.rc b/reactos/dll/win32/browseui/lang/de-DE.rc similarity index 100% rename from reactos/dll/win32/browseui/lang/de_DE.rc rename to reactos/dll/win32/browseui/lang/de-DE.rc From 5783342323f2036abca4bd986cb1a2b207b18639 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Thu, 13 Mar 2014 18:54:06 +0000 Subject: [PATCH 105/113] [uniata] update uniata to 45a3 fixes installation on ATI IXP700 SATA controller svn path=/trunk/; revision=62493 --- reactos/drivers/storage/ide/uniata/bm_devs.h | 315 +++++++++++++----- reactos/drivers/storage/ide/uniata/bsmaster.h | 63 +++- reactos/drivers/storage/ide/uniata/id_ata.cpp | 82 +++-- reactos/drivers/storage/ide/uniata/id_dma.cpp | 12 +- .../drivers/storage/ide/uniata/id_init.cpp | 249 ++++++++++++-- .../drivers/storage/ide/uniata/id_sata.cpp | 45 ++- .../drivers/storage/ide/uniata/uniata_ver.h | 18 +- 7 files changed, 627 insertions(+), 157 deletions(-) diff --git a/reactos/drivers/storage/ide/uniata/bm_devs.h b/reactos/drivers/storage/ide/uniata/bm_devs.h index dcafd391935..3c11ffe9784 100644 --- a/reactos/drivers/storage/ide/uniata/bm_devs.h +++ b/reactos/drivers/storage/ide/uniata/bm_devs.h @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2002-2012 Alexandr A. Telyatnikov (Alter) +Copyright (c) 2002-2014 Alexandr A. Telyatnikov (Alter) Module Name: bm_devs.h @@ -103,14 +103,6 @@ typedef struct _BUSMASTER_CONTROLLER_INFORMATION { #define ATA_ATP865A 0x00081191 #define ATA_ATP865R 0x00091191 -#define ATA_AMD_ID 0x1022 -#define ATA_AMD755 0x74011022 -#define ATA_AMD756 0x74091022 -#define ATA_AMD766 0x74111022 -#define ATA_AMD768 0x74411022 -#define ATA_AMD8111 0x74691022 -#define ATA_AMD5536 0x209a1022 - #define ATA_ACER_LABS_ID 0x10b9 #define ATA_ALI_1533 0x153310b9 #define ATA_ALI_5228 0x522810b9 @@ -120,6 +112,24 @@ typedef struct _BUSMASTER_CONTROLLER_INFORMATION { #define ATA_ALI_5288 0x528810b9 #define ATA_ALI_5289 0x528910b9 +#define ATA_AMD_ID 0x1022 +#define ATA_AMD755 0x74011022 +#define ATA_AMD756 0x74091022 +#define ATA_AMD766 0x74111022 +#define ATA_AMD768 0x74411022 +#define ATA_AMD8111 0x74691022 +#define ATA_AMD5536 0x209a1022 +#define ATA_AMD_HUDSON2_S1 0x78001022 +#define ATA_AMD_HUDSON2_S2 0x78011022 +#define ATA_AMD_HUDSON2_S3 0x78021022 +#define ATA_AMD_HUDSON2_S4 0x78031022 +#define ATA_AMD_HUDSON2_S5 0x78041022 +#define ATA_AMD_HUDSON2 0x780c1022 + +#define ATA_ADAPTEC_ID 0x9005 +#define ATA_ADAPTEC_1420 0x02419005 +#define ATA_ADAPTEC_1430 0x02439005 + #define ATA_ATI_ID 0x1002 #define ATA_ATI_IXP200 0x43491002 #define ATA_ATI_IXP300 0x43691002 @@ -136,6 +146,7 @@ typedef struct _BUSMASTER_CONTROLLER_INFORMATION { #define ATA_ATI_IXP700_S4 0x43931002 #define ATA_ATI_IXP800_S1 0x43941002 #define ATA_ATI_IXP800_S2 0x43951002 +#define ATA_ATI_4385 0x43851002 #define ATA_CENATEK_ID 0x16ca #define ATA_CENATEK_ROCKET 0x000116ca @@ -209,6 +220,10 @@ typedef struct _BUSMASTER_CONTROLLER_INFORMATION { #define ATA_I82801IB_AH4 0x29238086 #define ATA_I82801IB_R1 0x29258086 #define ATA_I82801IB_S2 0x29268086 +#define ATA_I82801IBM_S1 0x29288086 +#define ATA_I82801IBM_AH 0x29298086 +#define ATA_I82801IBM_R1 0x292a8086 +#define ATA_I82801IBM_S2 0x292d8086 #define ATA_I82801JIB_S1 0x3a208086 #define ATA_I82801JIB_AH 0x3a228086 #define ATA_I82801JIB_R1 0x3a258086 @@ -265,13 +280,31 @@ typedef struct _BUSMASTER_CONTROLLER_INFORMATION { #define ATA_PPT_R5 0x1e0e8086 #define ATA_PPT_R6 0x1e0f8086 +#define ATA_LPT_S1 0x8c008086 +#define ATA_LPT_S2 0x8c018086 +#define ATA_LPT_AH1 0x8c028086 +#define ATA_LPT_AH2 0x8c038086 +#define ATA_LPT_R1 0x8c048086 +#define ATA_LPT_R2 0x8c058086 +#define ATA_LPT_R3 0x8c068086 +#define ATA_LPT_R4 0x8c078086 +#define ATA_LPT_S3 0x8c088086 +#define ATA_LPT_S4 0x8c098086 +#define ATA_LPT_R5 0x8c0e8086 +#define ATA_LPT_R6 0x8c0f8086 + #define ATA_I31244 0x32008086 #define ATA_ISCH 0x811a8086 #define ATA_DH89XXCC 0x23238086 +#define ATA_COLETOCRK_AH1 0x23a38086 +#define ATA_COLETOCRK_S1 0x23a18086 +#define ATA_COLETOCRK_S2 0x23a68086 + #define ATA_JMICRON_ID 0x197b #define ATA_JMB360 0x2360197b #define ATA_JMB361 0x2361197b +#define ATA_JMB362 0x2362197b #define ATA_JMB363 0x2363197b #define ATA_JMB365 0x2365197b #define ATA_JMB366 0x2366197b @@ -596,12 +629,14 @@ typedef struct _BUSMASTER_CONTROLLER_INFORMATION { #define PRNEW 1 #define PRTX 2 #define PRMIO 3 -#define PRIDX 4 #define PRTX4 0x0100 #define PRSX4K 0x0200 #define PRSX6K 0x0400 #define PRSATA 0x0800 -#define PRDUAL 0x1000 +#define PRCMBO 0x1000 +#define PRG2 0x2000 +#define PRCMBO2 (PRCMBO | PRG2) +#define PRSATA2 (PRSATA | PRG2) #define SWKS33 0 #define SWKS66 1 @@ -611,6 +646,7 @@ typedef struct _BUSMASTER_CONTROLLER_INFORMATION { #define SIIOLD 0 #define SIICMD 1 #define SIIMIO 2 +#define ATI700 3 #define SIIINTR 0x0100 #define SIIENINTR 0x0200 @@ -644,11 +680,11 @@ typedef struct _BUSMASTER_CONTROLLER_INFORMATION { #define NV4OFF 0x0100 #define NVQ 0x0200 -#define VIA33 0 +#define VIA33 4 #define VIA66 1 #define VIA100 2 #define VIA133 3 -#define AMDNVIDIA 4 +#define AMDNVIDIA 0 #define AMDCABLE 0x0100 #define AMDBUG 0x0200 #define VIABAR 0x0400 @@ -692,12 +728,12 @@ BUSMASTER_CONTROLLER_INFORMATION const BusMasterAdapters[] = { PCI_DEV_HW_SPEC_BM( 5229, 10b9, 0x20, ATA_UDMA2, "ALI M5229 UDMA2" , ALIOLD ), PCI_DEV_HW_SPEC_BM( 5229, 10b9, 0x00, ATA_WDMA2, "ALI M5229 WDMA2" , ALIOLD ), - PCI_DEV_HW_SPEC_BM( 7401, 1022, 0x00, ATA_UDMA2, "AMD 755" , AMDNVIDIA | 0x00 ), - PCI_DEV_HW_SPEC_BM( 7409, 1022, 0x00, ATA_UDMA4, "AMD 756" , AMDNVIDIA | UNIATA_NO80CHK ), - PCI_DEV_HW_SPEC_BM( 7411, 1022, 0x00, ATA_UDMA5, "AMD 766" , AMDNVIDIA | AMDBUG ), - PCI_DEV_HW_SPEC_BM( 7441, 1022, 0x00, ATA_UDMA5, "AMD 768" , AMDNVIDIA ), - PCI_DEV_HW_SPEC_BM( 7469, 1022, 0x00, ATA_UDMA6, "AMD 8111" , AMDNVIDIA ), - PCI_DEV_HW_SPEC_BM( 209a, 1022, 0x00, ATA_UDMA5, "AMD CS5536" , AMDNVIDIA ), + PCI_DEV_HW_SPEC_BM( 7401, 1022, 0x00, ATA_UDMA2, "AMD 755" , 0 | 0x00 ), + PCI_DEV_HW_SPEC_BM( 7409, 1022, 0x00, ATA_UDMA4, "AMD 756" , 0 | UNIATA_NO80CHK ), + PCI_DEV_HW_SPEC_BM( 7411, 1022, 0x00, ATA_UDMA5, "AMD 766" , 0 | AMDBUG ), + PCI_DEV_HW_SPEC_BM( 7441, 1022, 0x00, ATA_UDMA5, "AMD 768" , 0 ), + PCI_DEV_HW_SPEC_BM( 7469, 1022, 0x00, ATA_UDMA6, "AMD 8111" , 0 ), + PCI_DEV_HW_SPEC_BM( 209a, 1022, 0x00, ATA_UDMA5, "AMD CS5536" , 0 ), PCI_DEV_HW_SPEC_BM( 4349, 1002, 0x00, ATA_UDMA5, "ATI IXP200" , 0 ), PCI_DEV_HW_SPEC_BM( 4369, 1002, 0x00, ATA_UDMA6, "ATI IXP300" , 0 ), @@ -706,9 +742,21 @@ BUSMASTER_CONTROLLER_INFORMATION const BusMasterAdapters[] = { PCI_DEV_HW_SPEC_BM( 4379, 1002, 0x00, ATA_SA150, "ATI IXP400" , SIIMIO | SIIBUG | SIINOSATAIRQ | UNIATA_SATA ), PCI_DEV_HW_SPEC_BM( 437a, 1002, 0x00, ATA_SA300, "ATI IXP400" , SIIMIO | SIIBUG | SIINOSATAIRQ | UNIATA_SATA ), PCI_DEV_HW_SPEC_BM( 438c, 1002, 0x00, ATA_UDMA6, "ATI IXP600" , 0 ), - PCI_DEV_HW_SPEC_BM( 4380, 1002, 0x00, ATA_SA150, "ATI IXP600" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 4380, 1002, 0x00, ATA_SA300, "ATI IXP600" , UNIATA_SATA | UNIATA_AHCI ), PCI_DEV_HW_SPEC_BM( 439c, 1002, 0x00, ATA_UDMA6, "ATI IXP700" , 0 ), - PCI_DEV_HW_SPEC_BM( 4390, 1002, 0x00, ATA_SA150, "ATI IXP700" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 4390, 1002, 0x00, ATA_SA300, "ATI IXP700" , ATI700 | UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 4391, 1002, 0x00, ATA_SA300, "ATI IXP700" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 4392, 1002, 0x00, ATA_SA300, "ATI IXP700" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 4393, 1002, 0x00, ATA_SA300, "ATI IXP700" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 4394, 1002, 0x00, ATA_SA300, "ATI IXP700/800" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 4395, 1002, 0x00, ATA_SA300, "ATI IXP700/800" , UNIATA_SATA | UNIATA_AHCI ), + + PCI_DEV_HW_SPEC_BM( 780c, 1002, 0x00, ATA_UDMA6, "ATI Hudson-2" , 0 ), + PCI_DEV_HW_SPEC_BM( 7800, 1002, 0x00, ATA_SA300, "ATI Hudson-2" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 7801, 1002, 0x00, ATA_SA300, "ATI Hudson-2" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 7802, 1002, 0x00, ATA_SA300, "ATI Hudson-2" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 7803, 1002, 0x00, ATA_SA300, "ATI Hudson-2" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 7804, 1002, 0x00, ATA_SA300, "ATI Hudson-2" , UNIATA_SATA | UNIATA_AHCI ), PCI_DEV_HW_SPEC_BM( 0004, 1103, 0x05, ATA_UDMA6, "HighPoint HPT372" , HPT372 | 0x00 | UNIATA_RAID_CONTROLLER), PCI_DEV_HW_SPEC_BM( 0004, 1103, 0x03, ATA_UDMA5, "HighPoint HPT370" , HPT370 | 0x00 | UNIATA_RAID_CONTROLLER), @@ -778,7 +826,6 @@ BUSMASTER_CONTROLLER_INFORMATION const BusMasterAdapters[] = { PCI_DEV_HW_SPEC_BM( 2920, 8086, 0x00, ATA_SA300, "Intel ICH9" , I6CH | UNIATA_SATA ), PCI_DEV_HW_SPEC_BM( 2926, 8086, 0x00, ATA_SA300, "Intel ICH9" , I6CH2 | UNIATA_SATA ), - PCI_DEV_HW_SPEC_BM( 282a, 8086, 0x00, ATA_SA300, "Intel ICH9" , I6CH2 | UNIATA_SATA ), PCI_DEV_HW_SPEC_BM( 2921, 8086, 0x00, ATA_SA300, "Intel ICH9" , UNIATA_SATA | UNIATA_AHCI ),/* ??? */ PCI_DEV_HW_SPEC_BM( 2922, 8086, 0x00, ATA_SA300, "Intel ICH9" , UNIATA_SATA | UNIATA_AHCI ), PCI_DEV_HW_SPEC_BM( 2923, 8086, 0x00, ATA_SA300, "Intel ICH9" , UNIATA_SATA | UNIATA_AHCI ), @@ -846,56 +893,150 @@ BUSMASTER_CONTROLLER_INFORMATION const BusMasterAdapters[] = { PCI_DEV_HW_SPEC_BM( 1e0e, 8086, 0x00, ATA_SA300, "Intel Panther Point" , UNIATA_SATA | UNIATA_AHCI ), PCI_DEV_HW_SPEC_BM( 1e0f, 8086, 0x00, ATA_SA300, "Intel Panther Point" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 8c00, 8086, 0x00, ATA_SA300, "Intel Lynx Point" , I6CH | UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 8c01, 8086, 0x00, ATA_SA300, "Intel Lynx Point" , I6CH | UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 8c02, 8086, 0x00, ATA_SA300, "Intel Lynx Point" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 8c03, 8086, 0x00, ATA_SA300, "Intel Lynx Point" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 8c04, 8086, 0x00, ATA_SA300, "Intel Lynx Point" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 8c05, 8086, 0x00, ATA_SA300, "Intel Lynx Point" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 8c06, 8086, 0x00, ATA_SA300, "Intel Lynx Point" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 8c07, 8086, 0x00, ATA_SA300, "Intel Lynx Point" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 8c08, 8086, 0x00, ATA_SA300, "Intel Lynx Point" , I6CH2 | UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 8c09, 8086, 0x00, ATA_SA300, "Intel Lynx Point" , I6CH2 | UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 8c0e, 8086, 0x00, ATA_SA300, "Intel Lynx Point" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 8c0f, 8086, 0x00, ATA_SA300, "Intel Lynx Point" , UNIATA_SATA | UNIATA_AHCI ), + // PCI_DEV_HW_SPEC_BM( 3200, 8086, 0x00, ATA_SA150, "Intel 31244" , UNIATA_SATA ), PCI_DEV_HW_SPEC_BM( 811a, 8086, 0x00, ATA_UDMA5, "Intel SCH" , 0 ), PCI_DEV_HW_SPEC_BM( 2323, 8086, 0x00, ATA_SA300, "Intel DH98xxCC" , UNIATA_SATA | UNIATA_AHCI ), - PCI_DEV_HW_SPEC_BM( 2360, 197b, 0x00, ATA_SA300, "JMB360" , UNIATA_SATA | UNIATA_AHCI ), - - PCI_DEV_HW_SPEC_BM( 2361, 197b, 0x00, ATA_UDMA6, "JMB361" , 0 ), - PCI_DEV_HW_SPEC_BM( 2363, 197b, 0x00, ATA_UDMA6, "JMB363" , 0 ), - PCI_DEV_HW_SPEC_BM( 2365, 197b, 0x00, ATA_UDMA6, "JMB365" , 0 ), - PCI_DEV_HW_SPEC_BM( 2366, 197b, 0x00, ATA_UDMA6, "JMB366" , 0 ), - PCI_DEV_HW_SPEC_BM( 2368, 197b, 0x00, ATA_UDMA6, "JMB368" , 0 ), + PCI_DEV_HW_SPEC_BM( 23a3, 8086, 0x00, ATA_SA300, "COLETOCRK" , I6CH2 | UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 23a1, 8086, 0x00, ATA_SA300, "COLETOCRK" , I6CH2 | UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 23a6, 8086, 0x00, ATA_SA300, "COLETOCRK" , UNIATA_SATA | UNIATA_AHCI ), + + PCI_DEV_HW_SPEC_BM( 2360, 197b, 0x00, ATA_SA300, "JMB360" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 2361, 197b, 0x00, ATA_UDMA6, "JMB361" , 0 ), + PCI_DEV_HW_SPEC_BM( 2362, 197b, 0x00, ATA_SA300, "JMB362" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 2363, 197b, 0x00, ATA_UDMA6, "JMB363" , 0 ), + PCI_DEV_HW_SPEC_BM( 2365, 197b, 0x00, ATA_UDMA6, "JMB365" , 0 ), + PCI_DEV_HW_SPEC_BM( 2366, 197b, 0x00, ATA_UDMA6, "JMB366" , 0 ), + PCI_DEV_HW_SPEC_BM( 2368, 197b, 0x00, ATA_UDMA6, "JMB368" , 0 ), /* - PCI_DEV_HW_SPEC_BM( 5040, 11ab, 0x00, ATA_SA150, "Marvell 88SX5040" , UNIATA_SATA ), - PCI_DEV_HW_SPEC_BM( 5041, 11ab, 0x00, ATA_SA150, "Marvell 88SX5041" , UNIATA_SATA ), - PCI_DEV_HW_SPEC_BM( 5080, 11ab, 0x00, ATA_SA150, "Marvell 88SX5080" , UNIATA_SATA ), - PCI_DEV_HW_SPEC_BM( 5081, 11ab, 0x00, ATA_SA150, "Marvell 88SX5081" , UNIATA_SATA ), - PCI_DEV_HW_SPEC_BM( 6041, 11ab, 0x00, ATA_SA300, "Marvell 88SX6041" , UNIATA_SATA ), - PCI_DEV_HW_SPEC_BM( 6081, 11ab, 0x00, ATA_SA300, "Marvell 88SX6081" , UNIATA_SATA ),*/ - PCI_DEV_HW_SPEC_BM( 6101, 11ab, 0x00, ATA_UDMA6, "Marvell 88SX6101" , 0 ), - PCI_DEV_HW_SPEC_BM( 6121, 11ab, 0x00, ATA_UDMA6, "Marvell 88SX6121" , 0 ), - PCI_DEV_HW_SPEC_BM( 6145, 11ab, 0x00, ATA_UDMA6, "Marvell 88SX6145" , 0 ), + PCI_DEV_HW_SPEC_BM( 5040, 11ab, 0x00, ATA_SA150, "Marvell 88SX5040" , UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 5041, 11ab, 0x00, ATA_SA150, "Marvell 88SX5041" , UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 5080, 11ab, 0x00, ATA_SA150, "Marvell 88SX5080" , UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 5081, 11ab, 0x00, ATA_SA150, "Marvell 88SX5081" , UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 6041, 11ab, 0x00, ATA_SA300, "Marvell 88SX6041" , UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 6081, 11ab, 0x00, ATA_SA300, "Marvell 88SX6081" , UNIATA_SATA ),*/ + PCI_DEV_HW_SPEC_BM( 6101, 11ab, 0x00, ATA_UDMA6, "Marvell 88SX6101" , 0 ), + PCI_DEV_HW_SPEC_BM( 6102, 11ab, 0x00, ATA_UDMA6, "Marvell 88SX6102" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 6111, 11ab, 0x00, ATA_UDMA6, "Marvell 88SX6111" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 6121, 11ab, 0x00, ATA_UDMA6, "Marvell 88SX6121" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 6141, 11ab, 0x00, ATA_UDMA6, "Marvell 88SX6141" , UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 6145, 11ab, 0x00, ATA_UDMA6, "Marvell 88SX6145" , UNIATA_SATA | UNIATA_AHCI ), +/* PCI_DEV_HW_SPEC_BM( 91a4, 1b4b, 0x00, ATA_UDMA6, "Marvell 88SE912x" , 0 ),*/ - PCI_DEV_HW_SPEC_BM( 01bc, 10de, 0x00, ATA_UDMA5, "nVidia nForce" , AMDNVIDIA ), - PCI_DEV_HW_SPEC_BM( 0065, 10de, 0x00, ATA_UDMA6, "nVidia nForce2" , AMDNVIDIA ), - PCI_DEV_HW_SPEC_BM( 0085, 10de, 0x00, ATA_UDMA6, "nVidia nForce2 Pro",AMDNVIDIA ), - PCI_DEV_HW_SPEC_BM( 008e, 10de, 0x00, ATA_SA150, "nVidia nForce2 Pro S1",UNIATA_SATA ), - PCI_DEV_HW_SPEC_BM( 00d5, 10de, 0x00, ATA_UDMA6, "nVidia nForce3" , AMDNVIDIA ), - PCI_DEV_HW_SPEC_BM( 00e5, 10de, 0x00, ATA_UDMA6, "nVidia nForce3 Pro",AMDNVIDIA ), - PCI_DEV_HW_SPEC_BM( 00e3, 10de, 0x00, ATA_SA150, "nVidia nForce3 Pro S1",UNIATA_SATA ), - PCI_DEV_HW_SPEC_BM( 00ee, 10de, 0x00, ATA_SA150, "nVidia nForce3 Pro S2",UNIATA_SATA ), - PCI_DEV_HW_SPEC_BM( 0035, 10de, 0x00, ATA_UDMA6, "nVidia nForce MCP", AMDNVIDIA ), - PCI_DEV_HW_SPEC_BM( 0036, 10de, 0x00, ATA_SA150, "nVidia nForce MCP S1",NV4OFF | UNIATA_SATA ), - PCI_DEV_HW_SPEC_BM( 003e, 10de, 0x00, ATA_SA150, "nVidia nForce MCP S2",NV4OFF | UNIATA_SATA ), - PCI_DEV_HW_SPEC_BM( 0053, 10de, 0x00, ATA_UDMA6, "nVidia nForce CK804", AMDNVIDIA ), - PCI_DEV_HW_SPEC_BM( 0054, 10de, 0x00, ATA_SA300, "nVidia nForce CK804 S1",NV4OFF | UNIATA_SATA ), - PCI_DEV_HW_SPEC_BM( 0055, 10de, 0x00, ATA_SA300, "nVidia nForce CK804 S2",NV4OFF | UNIATA_SATA ), - PCI_DEV_HW_SPEC_BM( 0265, 10de, 0x00, ATA_UDMA6, "nVidia nForce MCP51", AMDNVIDIA ), - PCI_DEV_HW_SPEC_BM( 0266, 10de, 0x00, ATA_SA300, "nVidia nForce MCP51 S1",NV4OFF | NVQ | UNIATA_SATA ), - PCI_DEV_HW_SPEC_BM( 0267, 10de, 0x00, ATA_SA300, "nVidia nForce MCP51 S2",NV4OFF | NVQ | UNIATA_SATA ), - PCI_DEV_HW_SPEC_BM( 036e, 10de, 0x00, ATA_UDMA6, "nVidia nForce MCP55", AMDNVIDIA ), - PCI_DEV_HW_SPEC_BM( 037e, 10de, 0x00, ATA_SA300, "nVidia nForce MCP55 S1",NV4OFF | NVQ | UNIATA_SATA ), - PCI_DEV_HW_SPEC_BM( 037f, 10de, 0x00, ATA_SA300, "nVidia nForce MCP55 S2",NV4OFF | NVQ | UNIATA_SATA ), - PCI_DEV_HW_SPEC_BM( 03ec, 10de, 0x00, ATA_UDMA6, "nVidia nForce MCP61", AMDNVIDIA ), - PCI_DEV_HW_SPEC_BM( 03e7, 10de, 0x00, ATA_SA300, "nVidia nForce MCP61 S1",NV4OFF | NVQ | UNIATA_SATA ), - PCI_DEV_HW_SPEC_BM( 03f6, 10de, 0x00, ATA_SA300, "nVidia nForce MCP61 S2",NV4OFF | NVQ | UNIATA_SATA ), - PCI_DEV_HW_SPEC_BM( 03f7, 10de, 0x00, ATA_SA300, "nVidia nForce MCP61 S3",NV4OFF | NVQ | UNIATA_SATA ), - PCI_DEV_HW_SPEC_BM( 0448, 10de, 0x00, ATA_UDMA6, "nVidia nForce MCP65", AMDNVIDIA ), - PCI_DEV_HW_SPEC_BM( 0560, 10de, 0x00, ATA_UDMA6, "nVidia nForce MCP67", AMDNVIDIA ), - PCI_DEV_HW_SPEC_BM( 056c, 10de, 0x00, ATA_UDMA6, "nVidia nForce MCP73", AMDNVIDIA ), - PCI_DEV_HW_SPEC_BM( 0759, 10de, 0x00, ATA_UDMA6, "nVidia nForce MCP77", AMDNVIDIA ), + PCI_DEV_HW_SPEC_BM( 01bc, 10de, 0x00, ATA_UDMA5, "nVidia nForce" , 0 ), + PCI_DEV_HW_SPEC_BM( 0065, 10de, 0x00, ATA_UDMA6, "nVidia nForce2" , 0 ), + PCI_DEV_HW_SPEC_BM( 0085, 10de, 0x00, ATA_UDMA6, "nVidia nForce2 Pro",0 ), + PCI_DEV_HW_SPEC_BM( 008e, 10de, 0x00, ATA_SA150, "nVidia nForce2 Pro S1",UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 00d5, 10de, 0x00, ATA_UDMA6, "nVidia nForce3" , 0 ), + PCI_DEV_HW_SPEC_BM( 00e5, 10de, 0x00, ATA_UDMA6, "nVidia nForce3 Pro",0 ), + PCI_DEV_HW_SPEC_BM( 00e3, 10de, 0x00, ATA_SA150, "nVidia nForce3 Pro S1",UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 00ee, 10de, 0x00, ATA_SA150, "nVidia nForce3 Pro S2",UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 0035, 10de, 0x00, ATA_UDMA6, "nVidia nForce MCP", 0 ), + PCI_DEV_HW_SPEC_BM( 0036, 10de, 0x00, ATA_SA150, "nVidia nForce MCP S1",NV4OFF | UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 003e, 10de, 0x00, ATA_SA150, "nVidia nForce MCP S2",NV4OFF | UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 0053, 10de, 0x00, ATA_UDMA6, "nVidia nForce CK804", 0 ), + PCI_DEV_HW_SPEC_BM( 0054, 10de, 0x00, ATA_SA300, "nVidia nForce CK804 S1",NV4OFF | UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 0055, 10de, 0x00, ATA_SA300, "nVidia nForce CK804 S2",NV4OFF | UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 0265, 10de, 0x00, ATA_UDMA6, "nVidia nForce MCP51", 0 ), + PCI_DEV_HW_SPEC_BM( 0266, 10de, 0x00, ATA_SA300, "nVidia nForce MCP51 S1",NV4OFF | NVQ | UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 0267, 10de, 0x00, ATA_SA300, "nVidia nForce MCP51 S2",NV4OFF | NVQ | UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 036e, 10de, 0x00, ATA_UDMA6, "nVidia nForce MCP55", 0 ), + PCI_DEV_HW_SPEC_BM( 037e, 10de, 0x00, ATA_SA300, "nVidia nForce MCP55 S1",NV4OFF | NVQ | UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 037f, 10de, 0x00, ATA_SA300, "nVidia nForce MCP55 S2",NV4OFF | NVQ | UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 03ec, 10de, 0x00, ATA_UDMA6, "nVidia nForce MCP61", 0 ), + PCI_DEV_HW_SPEC_BM( 03e7, 10de, 0x00, ATA_SA300, "nVidia nForce MCP61 S1",NV4OFF | NVQ | UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 03f6, 10de, 0x00, ATA_SA300, "nVidia nForce MCP61 S2",NV4OFF | NVQ | UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 03f7, 10de, 0x00, ATA_SA300, "nVidia nForce MCP61 S3",NV4OFF | NVQ | UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 0448, 10de, 0x00, ATA_UDMA6, "nVidia nForce MCP65", 0 ), + PCI_DEV_HW_SPEC_BM( 044c, 10de, 0x00, ATA_SA300, "nVidia nForce MCP65 A0", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 044d, 10de, 0x00, ATA_SA300, "nVidia nForce MCP65 A1", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 044e, 10de, 0x00, ATA_SA300, "nVidia nForce MCP65 A2", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 044f, 10de, 0x00, ATA_SA300, "nVidia nForce MCP65 A3", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 045c, 10de, 0x00, ATA_SA300, "nVidia nForce MCP65 A4", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 045d, 10de, 0x00, ATA_SA300, "nVidia nForce MCP65 A5", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 045e, 10de, 0x00, ATA_SA300, "nVidia nForce MCP65 A6", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 045f, 10de, 0x00, ATA_SA300, "nVidia nForce MCP65 A7", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0560, 10de, 0x00, ATA_UDMA6, "nVidia nForce MCP67", 0 ), + PCI_DEV_HW_SPEC_BM( 0550, 10de, 0x00, ATA_SA300, "nVidia nForce MCP67 A0", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0551, 10de, 0x00, ATA_SA300, "nVidia nForce MCP67 A1", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0552, 10de, 0x00, ATA_SA300, "nVidia nForce MCP67 A2", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0553, 10de, 0x00, ATA_SA300, "nVidia nForce MCP67 A3", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0554, 10de, 0x00, ATA_SA300, "nVidia nForce MCP67 A4", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0555, 10de, 0x00, ATA_SA300, "nVidia nForce MCP67 A5", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0556, 10de, 0x00, ATA_SA300, "nVidia nForce MCP67 A6", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0557, 10de, 0x00, ATA_SA300, "nVidia nForce MCP67 A7", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0558, 10de, 0x00, ATA_SA300, "nVidia nForce MCP67 A8", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0559, 10de, 0x00, ATA_SA300, "nVidia nForce MCP67 A9", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 055A, 10de, 0x00, ATA_SA300, "nVidia nForce MCP67 AA", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 055B, 10de, 0x00, ATA_SA300, "nVidia nForce MCP67 AB", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0584, 10de, 0x00, ATA_SA300, "nVidia nForce MCP67 AC", UNIATA_SATA | UNIATA_AHCI ), + + PCI_DEV_HW_SPEC_BM( 056c, 10de, 0x00, ATA_UDMA6, "nVidia nForce MCP73", 0 ), + PCI_DEV_HW_SPEC_BM( 07f0, 10de, 0x00, ATA_SA300, "nVidia nForce MCP73 A0", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 07f1, 10de, 0x00, ATA_SA300, "nVidia nForce MCP73 A1", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 07f2, 10de, 0x00, ATA_SA300, "nVidia nForce MCP73 A2", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 07f3, 10de, 0x00, ATA_SA300, "nVidia nForce MCP73 A3", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 07f4, 10de, 0x00, ATA_SA300, "nVidia nForce MCP73 A4", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 07f5, 10de, 0x00, ATA_SA300, "nVidia nForce MCP73 A5", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 07f6, 10de, 0x00, ATA_SA300, "nVidia nForce MCP73 A6", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 07f7, 10de, 0x00, ATA_SA300, "nVidia nForce MCP73 A7", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 07f8, 10de, 0x00, ATA_SA300, "nVidia nForce MCP73 A8", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 07f9, 10de, 0x00, ATA_SA300, "nVidia nForce MCP73 A9", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 07fa, 10de, 0x00, ATA_SA300, "nVidia nForce MCP73 AA", UNIATA_SATA | UNIATA_AHCI ), + + PCI_DEV_HW_SPEC_BM( 07fb, 10de, 0x00, ATA_SA300, "nVidia nForce MCP73 AB", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0759, 10de, 0x00, ATA_UDMA6, "nVidia nForce MCP77", 0 ), + PCI_DEV_HW_SPEC_BM( 0ad0, 10de, 0x00, ATA_SA300, "nVidia nForce MCP77 A0", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0ad1, 10de, 0x00, ATA_SA300, "nVidia nForce MCP77 A1", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0ad2, 10de, 0x00, ATA_SA300, "nVidia nForce MCP77 A2", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0ad3, 10de, 0x00, ATA_SA300, "nVidia nForce MCP77 A3", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0ad4, 10de, 0x00, ATA_SA300, "nVidia nForce MCP77 A4", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0ad5, 10de, 0x00, ATA_SA300, "nVidia nForce MCP77 A5", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0ad6, 10de, 0x00, ATA_SA300, "nVidia nForce MCP77 A6", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0ad7, 10de, 0x00, ATA_SA300, "nVidia nForce MCP77 A7", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0ad8, 10de, 0x00, ATA_SA300, "nVidia nForce MCP77 A8", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0ad9, 10de, 0x00, ATA_SA300, "nVidia nForce MCP77 A9", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0ada, 10de, 0x00, ATA_SA300, "nVidia nForce MCP77 AA", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0adb, 10de, 0x00, ATA_SA300, "nVidia nForce MCP77 AB", UNIATA_SATA | UNIATA_AHCI ), + + PCI_DEV_HW_SPEC_BM( 0ab4, 10de, 0x00, ATA_SA300, "nVidia nForce MCP79 A0", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0ab5, 10de, 0x00, ATA_SA300, "nVidia nForce MCP79 A1", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0ab6, 10de, 0x00, ATA_SA300, "nVidia nForce MCP79 A2", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0ab7, 10de, 0x00, ATA_SA300, "nVidia nForce MCP79 A3", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0ab8, 10de, 0x00, ATA_SA300, "nVidia nForce MCP79 A4", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0ab9, 10de, 0x00, ATA_SA300, "nVidia nForce MCP79 A5", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0aba, 10de, 0x00, ATA_SA300, "nVidia nForce MCP79 A6", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0abb, 10de, 0x00, ATA_SA300, "nVidia nForce MCP79 A7", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0abc, 10de, 0x00, ATA_SA300, "nVidia nForce MCP79 A8", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0abd, 10de, 0x00, ATA_SA300, "nVidia nForce MCP79 A9", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0abe, 10de, 0x00, ATA_SA300, "nVidia nForce MCP79 AA", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0abf, 10de, 0x00, ATA_SA300, "nVidia nForce MCP79 AB", UNIATA_SATA | UNIATA_AHCI ), + + PCI_DEV_HW_SPEC_BM( 0d84, 10de, 0x00, ATA_SA300, "nVidia nForce MCP89 A0", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0d85, 10de, 0x00, ATA_SA300, "nVidia nForce MCP89 A1", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0d86, 10de, 0x00, ATA_SA300, "nVidia nForce MCP89 A2", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0d87, 10de, 0x00, ATA_SA300, "nVidia nForce MCP89 A3", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0d88, 10de, 0x00, ATA_SA300, "nVidia nForce MCP89 A4", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0d89, 10de, 0x00, ATA_SA300, "nVidia nForce MCP89 A5", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0d8a, 10de, 0x00, ATA_SA300, "nVidia nForce MCP89 A6", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0d8b, 10de, 0x00, ATA_SA300, "nVidia nForce MCP89 A7", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0d8c, 10de, 0x00, ATA_SA300, "nVidia nForce MCP89 A8", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0d8d, 10de, 0x00, ATA_SA300, "nVidia nForce MCP89 A9", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0d8e, 10de, 0x00, ATA_SA300, "nVidia nForce MCP89 AA", UNIATA_SATA | UNIATA_AHCI ), + PCI_DEV_HW_SPEC_BM( 0d8f, 10de, 0x00, ATA_SA300, "nVidia nForce MCP89 AB", UNIATA_SATA | UNIATA_AHCI ), PCI_DEV_HW_SPEC_BM( 0502, 100b, 0x00, ATA_UDMA2, "National Geode SC1100", 0 ), @@ -913,18 +1054,28 @@ BUSMASTER_CONTROLLER_INFORMATION const BusMasterAdapters[] = { PCI_DEV_HW_SPEC_BM( 7275, 105a, 0x00, ATA_UDMA6, "Promise PDC20277" , PRTX | 0x00 | UNIATA_RAID_CONTROLLER), PCI_DEV_HW_SPEC_BM( 3318, 105a, 0x00, ATA_SA150, "Promise PDC20318" , PRMIO | PRSATA | UNIATA_RAID_CONTROLLER | UNIATA_SATA), PCI_DEV_HW_SPEC_BM( 3319, 105a, 0x00, ATA_SA150, "Promise PDC20319" , PRMIO | PRSATA | UNIATA_RAID_CONTROLLER | UNIATA_SATA), - PCI_DEV_HW_SPEC_BM( 3371, 105a, 0x00, ATA_SA150, "Promise PDC20371" , PRMIO | PRSATA | UNIATA_RAID_CONTROLLER | UNIATA_SATA), - PCI_DEV_HW_SPEC_BM( 3375, 105a, 0x00, ATA_SA150, "Promise PDC20375" , PRMIO | PRSATA | UNIATA_RAID_CONTROLLER | UNIATA_SATA), - PCI_DEV_HW_SPEC_BM( 3376, 105a, 0x00, ATA_SA150, "Promise PDC20376" , PRMIO | PRSATA | UNIATA_RAID_CONTROLLER | UNIATA_SATA), - PCI_DEV_HW_SPEC_BM( 3377, 105a, 0x00, ATA_SA150, "Promise PDC20377" , PRMIO | PRSATA | UNIATA_RAID_CONTROLLER | UNIATA_SATA), - PCI_DEV_HW_SPEC_BM( 3373, 105a, 0x00, ATA_SA150, "Promise PDC20378" , PRMIO | PRSATA | UNIATA_RAID_CONTROLLER | UNIATA_SATA), - PCI_DEV_HW_SPEC_BM( 3372, 105a, 0x00, ATA_SA150, "Promise PDC20379" , PRMIO | PRSATA | UNIATA_RAID_CONTROLLER | UNIATA_SATA), - PCI_DEV_HW_SPEC_BM( 6617, 105a, 0x00, ATA_UDMA6, "Promise PDC20617" , PRMIO | PRDUAL | UNIATA_RAID_CONTROLLER), - PCI_DEV_HW_SPEC_BM( 6626, 105a, 0x00, ATA_UDMA6, "Promise PDC20618" , PRMIO | PRDUAL | UNIATA_RAID_CONTROLLER), - PCI_DEV_HW_SPEC_BM( 6629, 105a, 0x00, ATA_UDMA6, "Promise PDC20619" , PRMIO | PRDUAL | UNIATA_RAID_CONTROLLER), - PCI_DEV_HW_SPEC_BM( 6620, 105a, 0x00, ATA_UDMA6, "Promise PDC20620" , PRMIO | PRDUAL | UNIATA_RAID_CONTROLLER), + PCI_DEV_HW_SPEC_BM( 3371, 105a, 0x00, ATA_SA150, "Promise PDC20371" , PRMIO | PRCMBO | UNIATA_RAID_CONTROLLER | UNIATA_SATA), + PCI_DEV_HW_SPEC_BM( 3375, 105a, 0x00, ATA_SA150, "Promise PDC20375" , PRMIO | PRCMBO | UNIATA_RAID_CONTROLLER | UNIATA_SATA), + PCI_DEV_HW_SPEC_BM( 3376, 105a, 0x00, ATA_SA150, "Promise PDC20376" , PRMIO | PRCMBO | UNIATA_RAID_CONTROLLER | UNIATA_SATA), + PCI_DEV_HW_SPEC_BM( 3377, 105a, 0x00, ATA_SA150, "Promise PDC20377" , PRMIO | PRCMBO | UNIATA_RAID_CONTROLLER | UNIATA_SATA), + PCI_DEV_HW_SPEC_BM( 3373, 105a, 0x00, ATA_SA150, "Promise PDC20378" , PRMIO | PRCMBO | UNIATA_RAID_CONTROLLER | UNIATA_SATA), + PCI_DEV_HW_SPEC_BM( 3372, 105a, 0x00, ATA_SA150, "Promise PDC20379" , PRMIO | PRCMBO | UNIATA_RAID_CONTROLLER | UNIATA_SATA), + PCI_DEV_HW_SPEC_BM( 3571, 105a, 0x00, ATA_SA150, "Promise PDC20571" , PRMIO | PRCMBO2 | UNIATA_RAID_CONTROLLER | UNIATA_SATA), + PCI_DEV_HW_SPEC_BM( 3d75, 105a, 0x00, ATA_SA150, "Promise PDC20575" , PRMIO | PRCMBO2 | UNIATA_RAID_CONTROLLER | UNIATA_SATA), + PCI_DEV_HW_SPEC_BM( 3574, 105a, 0x00, ATA_SA150, "Promise PDC20579" , PRMIO | PRCMBO2 | UNIATA_RAID_CONTROLLER | UNIATA_SATA), + PCI_DEV_HW_SPEC_BM( 3570, 105a, 0x00, ATA_SA300, "Promise PDC20771" , PRMIO | PRCMBO2 | UNIATA_RAID_CONTROLLER | UNIATA_SATA), + PCI_DEV_HW_SPEC_BM( 3d73, 105a, 0x00, ATA_SA300, "Promise PDC40775" , PRMIO | PRCMBO2 | UNIATA_RAID_CONTROLLER | UNIATA_SATA), + PCI_DEV_HW_SPEC_BM( 6617, 105a, 0x00, ATA_UDMA6, "Promise PDC20617" , PRMIO | 0x00 | UNIATA_RAID_CONTROLLER), + PCI_DEV_HW_SPEC_BM( 6626, 105a, 0x00, ATA_UDMA6, "Promise PDC20618" , PRMIO | 0x00 | UNIATA_RAID_CONTROLLER), + PCI_DEV_HW_SPEC_BM( 6629, 105a, 0x00, ATA_UDMA6, "Promise PDC20619" , PRMIO | 0x00 | UNIATA_RAID_CONTROLLER), + PCI_DEV_HW_SPEC_BM( 6620, 105a, 0x00, ATA_UDMA6, "Promise PDC20620" , PRMIO | 0x00 | UNIATA_RAID_CONTROLLER), /* PCI_DEV_HW_SPEC_BM( 6621, 105a, 0x00, ATA_UDMA6, "Promise PDC20621" , PRMIO | PRSX4X | UNIATA_RAID_CONTROLLER), PCI_DEV_HW_SPEC_BM( 6622, 105a, 0x00, ATA_UDMA6, "Promise PDC20622" , PRMIO | PRSX4X | UNIATA_RAID_CONTROLLER),*/ + PCI_DEV_HW_SPEC_BM( 3571, 105a, 0x00, ATA_SA150, "Promise PDC40518" , PRMIO | PRSATA2 | UNIATA_RAID_CONTROLLER | UNIATA_SATA), + PCI_DEV_HW_SPEC_BM( 3d75, 105a, 0x00, ATA_SA150, "Promise PDC40519" , PRMIO | PRSATA2 | UNIATA_RAID_CONTROLLER | UNIATA_SATA), + PCI_DEV_HW_SPEC_BM( 3574, 105a, 0x00, ATA_SA150, "Promise PDC40718" , PRMIO | PRSATA2 | UNIATA_RAID_CONTROLLER | UNIATA_SATA), + PCI_DEV_HW_SPEC_BM( 3570, 105a, 0x00, ATA_SA300, "Promise PDC40719" , PRMIO | PRSATA2 | UNIATA_RAID_CONTROLLER | UNIATA_SATA), + PCI_DEV_HW_SPEC_BM( 3d73, 105a, 0x00, ATA_SA300, "Promise PDC40779" , PRMIO | PRSATA2 | UNIATA_RAID_CONTROLLER | UNIATA_SATA), PCI_DEV_HW_SPEC_BM( 0211, 1166, 0x00, ATA_UDMA2, "ServerWorks ROSB4", SWKS33 | UNIATA_NO_DPC ), PCI_DEV_HW_SPEC_BM( 0212, 1166, 0x92, ATA_UDMA5, "ServerWorks CSB5" , SWKS100 ), @@ -990,6 +1141,13 @@ BUSMASTER_CONTROLLER_INFORMATION const BusMasterAdapters[] = { PCI_DEV_HW_SPEC_BM( 5513, 1039, 0x00, ATA_WDMA2, "SiS ATA-xxx" , 0 ), PCI_DEV_HW_SPEC_BM( 0601, 1039, 0x00, ATA_WDMA2, "SiS ATA-xxx" , 0 ), + PCI_DEV_HW_SPEC_BM( 1183, 1039, 0x00, ATA_UDMA6, "SiS PATA-1183" , SIS133NEW), + PCI_DEV_HW_SPEC_BM( 1182, 1039, 0x00, ATA_SA150, "SiS SATA 1182" , SISSATA | UNIATA_SATA), + PCI_DEV_HW_SPEC_BM( 0183, 1039, 0x00, ATA_SA150, "SiS SATA 183" , SISSATA | UNIATA_SATA), + PCI_DEV_HW_SPEC_BM( 0182, 1039, 0x00, ATA_SA150, "SiS SATA 182" , SISSATA | UNIATA_SATA), + PCI_DEV_HW_SPEC_BM( 0181, 1039, 0x00, ATA_SA150, "SiS SATA 181" , SISSATA | UNIATA_SATA), + PCI_DEV_HW_SPEC_BM( 0180, 1039, 0x00, ATA_SA150, "SiS SATA 180" , SISSATA | UNIATA_SATA), + /* PCI_DEV_HW_SPEC_BM( 0586, 1106, 0x41, ATA_UDMA2, "VIA 82C586B" , VIA33 | 0x00 ), PCI_DEV_HW_SPEC_BM( 0586, 1106, 0x40, ATA_UDMA2, "VIA 82C586B" , VIA33 | VIAPRQ ), PCI_DEV_HW_SPEC_BM( 0586, 1106, 0x02, ATA_UDMA2, "VIA 82C586B" , VIA33 | 0x00 ), @@ -1016,7 +1174,7 @@ BUSMASTER_CONTROLLER_INFORMATION const BusMasterAdapters[] = { PCI_DEV_HW_SPEC_BM( 5337, 1106, 0x00, ATA_SA150, "VIA 8237S" , 0 | UNIATA_SATA ), PCI_DEV_HW_SPEC_BM( 5372, 1106, 0x00, ATA_SA300, "VIA 8237" , 0 | UNIATA_SATA ), PCI_DEV_HW_SPEC_BM( 7372, 1106, 0x00, ATA_SA300, "VIA 8237" , 0 | UNIATA_SATA ), - //PCI_DEV_HW_SPEC_BM( 3349, 1106, 0x00, ATA_SA150, "VIA 8251" , VIAAHCI| UNIATA_SATA ), + PCI_DEV_HW_SPEC_BM( 3349, 1106, 0x00, ATA_SA150, "VIA 8251" , 0 | UNIATA_SATA | UNIATA_AHCI ), PCI_DEV_HW_SPEC_BM( c693, 1080, 0x00, ATA_WDMA2, "Cypress 82C693" ,0 ), @@ -1045,7 +1203,8 @@ BUSMASTER_CONTROLLER_INFORMATION const BusMasterAdapters[] = { PCI_DEV_HW_SPEC_BM( 0102, 1078, 0x00, ATA_UDMA2, "Cyrix 5530" , 0 ), - PCI_DEV_HW_SPEC_BM( 0102, 1042, 0x00, ATA_PIO4, "RZ 100x" , 0 ), + PCI_DEV_HW_SPEC_BM( 1000, 1042, 0x00, ATA_PIO4, "RZ 100x" , 0 ), + PCI_DEV_HW_SPEC_BM( 1001, 1042, 0x00, ATA_PIO4, "RZ 100x" , 0 ), PCI_DEV_HW_SPEC_BM( 8172, 1283, 0x00, ATA_UDMA2, "IT8172" , 0 ), PCI_DEV_HW_SPEC_BM( 8213, 1283, 0x00, ATA_UDMA6, "IT8213F" , ITE_133_NEW ), diff --git a/reactos/drivers/storage/ide/uniata/bsmaster.h b/reactos/drivers/storage/ide/uniata/bsmaster.h index bb24ead357b..815bbe477c0 100644 --- a/reactos/drivers/storage/ide/uniata/bsmaster.h +++ b/reactos/drivers/storage/ide/uniata/bsmaster.h @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2002-2012 Alexandr A. Telyatnikov (Alter) +Copyright (c) 2002-2014 Alexandr A. Telyatnikov (Alter) Module Name: bsmaster.h @@ -31,10 +31,10 @@ Notes: Revision History: Code was created by - Alter, Copyright (c) 2002-2008 + Alter, Copyright (c) 2002-2014 - Some definitions were taken from FreeBSD 4.3-4.6 ATA driver by - Sren Schmidt, Copyright (c) 1998,1999,2000,2001 + Some definitions were taken from FreeBSD 4.3-9.2 ATA driver by + Sren Schmidt, Copyright (c) 1998-2014 --*/ @@ -245,6 +245,12 @@ typedef struct _IDE_AHCI_REGISTERS { ULONG Reserved:27; } BOHC; +#define AHCI_BOHC_BB 0x00000001 +#define AHCI_BOHC_OOC 0x00000002 +#define AHCI_BOHC_SOOE 0x00000004 +#define AHCI_BOHC_OOS 0x00000008 +#define AHCI_BOHC_BOS 0x00000010 + UCHAR Reserved2[0x74]; UCHAR VendorSpec[0x60]; @@ -289,6 +295,22 @@ typedef union _SATA_SSTATUS_REG { } SATA_SSTATUS_REG, *PSATA_SSTATUS_REG; +#define ATA_SS_DET_MASK 0x0000000f +#define ATA_SS_DET_NO_DEVICE 0x00000000 +#define ATA_SS_DET_DEV_PRESENT 0x00000001 +#define ATA_SS_DET_PHY_ONLINE 0x00000003 +#define ATA_SS_DET_PHY_OFFLINE 0x00000004 + +#define ATA_SS_SPD_MASK 0x000000f0 +#define ATA_SS_SPD_NO_SPEED 0x00000000 +#define ATA_SS_SPD_GEN1 0x00000010 +#define ATA_SS_SPD_GEN2 0x00000020 + +#define ATA_SS_IPM_MASK 0x00000f00 +#define ATA_SS_IPM_NO_DEVICE 0x00000000 +#define ATA_SS_IPM_ACTIVE 0x00000100 +#define ATA_SS_IPM_PARTIAL 0x00000200 +#define ATA_SS_IPM_SLUMBER 0x00000600 typedef union _SATA_SCONTROL_REG { @@ -322,6 +344,21 @@ typedef union _SATA_SCONTROL_REG { } SATA_SCONTROL_REG, *PSATA_SCONTROL_REG; +#define ATA_SC_DET_MASK 0x0000000f +#define ATA_SC_DET_IDLE 0x00000000 +#define ATA_SC_DET_RESET 0x00000001 +#define ATA_SC_DET_DISABLE 0x00000004 + +#define ATA_SC_SPD_MASK 0x000000f0 +#define ATA_SC_SPD_NO_SPEED 0x00000000 +#define ATA_SC_SPD_SPEED_GEN1 0x00000010 +#define ATA_SC_SPD_SPEED_GEN2 0x00000020 +#define ATA_SC_SPD_SPEED_GEN3 0x00000040 + +#define ATA_SC_IPM_MASK 0x00000f00 +#define ATA_SC_IPM_NONE 0x00000000 +#define ATA_SC_IPM_DIS_PARTIAL 0x00000100 +#define ATA_SC_IPM_DIS_SLUMBER 0x00000200 typedef union _SATA_SERROR_REG { @@ -358,6 +395,22 @@ typedef union _SATA_SERROR_REG { } SATA_SERROR_REG, *PSATA_SERROR_REG; +#define ATA_SE_DATA_CORRECTED 0x00000001 +#define ATA_SE_COMM_CORRECTED 0x00000002 +#define ATA_SE_DATA_ERR 0x00000100 +#define ATA_SE_COMM_ERR 0x00000200 +#define ATA_SE_PROT_ERR 0x00000400 +#define ATA_SE_HOST_ERR 0x00000800 +#define ATA_SE_PHY_CHANGED 0x00010000 +#define ATA_SE_PHY_IERROR 0x00020000 +#define ATA_SE_COMM_WAKE 0x00040000 +#define ATA_SE_DECODE_ERR 0x00080000 +#define ATA_SE_PARITY_ERR 0x00100000 +#define ATA_SE_CRC_ERR 0x00200000 +#define ATA_SE_HANDSHAKE_ERR 0x00400000 +#define ATA_SE_LINKSEQ_ERR 0x00800000 +#define ATA_SE_TRANSPORT_ERR 0x01000000 +#define ATA_SE_UNKNOWN_FIS 0x02000000 typedef struct _IDE_SATA_REGISTERS { union { @@ -842,6 +895,7 @@ typedef union _ATA_REQ { PIDE_AHCI_CMD ahci_cmd_ptr; ULONG in_bcount; ULONG in_status; + ULONG in_serror; USHORT io_cmd_flags; // out UCHAR in_error; } ahci; @@ -1032,6 +1086,7 @@ typedef struct _HW_CHANNEL { ULONG AhciPrevCI; ULONG AhciCompleteCI; ULONG AhciLastIS; + ULONG AhciLastSError; //PVOID AHCI_FIS; // is not actually used by UniATA now, but is required by AHCI controller //ULONGLONG AHCI_FIS_PhAddr; // Note: in contrast to FBSD, we keep PRD and CMD item in AtaReq structure diff --git a/reactos/drivers/storage/ide/uniata/id_ata.cpp b/reactos/drivers/storage/ide/uniata/id_ata.cpp index 9c535055e5a..122431b1447 100644 --- a/reactos/drivers/storage/ide/uniata/id_ata.cpp +++ b/reactos/drivers/storage/ide/uniata/id_ata.cpp @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2002-2012 Alexandr A. Telyatnikov (Alter) +Copyright (c) 2002-2014 Alexandr A. Telyatnikov (Alter) Module Name: id_ata.cpp @@ -37,8 +37,8 @@ Revision History: Some parts of code were taken from FreeBSD 4.3-6.1 ATA driver by Sren Schmidt, Copyright (c) 1998-2007 - All parts of code are greatly changed/updated by - Alter, Copyright (c) 2002-2007: + All parts of code are significantly changed/updated by + Alter, Copyright (c) 2002-2014: 1. Internal command queueing/reordering 2. Drive identification @@ -4182,23 +4182,41 @@ AtapiCheckInterrupt__( return INTERRUPT_REASON_IGNORE; } break; - case PRMIO: - status = AtapiReadPortEx4(chan, (ULONGIO_PTR)(&deviceExtension->BaseIoAddressBM_0),0x0040); - if(ChipFlags & PRSATA) { - pr_status = AtapiReadPortEx4(chan, (ULONGIO_PTR)(&deviceExtension->BaseIoAddressBM_0),0x006c); - AtapiWritePortEx4(chan, (ULONGIO_PTR)(&deviceExtension->BaseIoAddressBM_0),0x006c, pr_status & 0x000000ff); - } - if(pr_status & (0x11 << Channel)) { - // TODO: reset channel - KdPrint2((PRINT_PREFIX " Promise mio unexpected + reset req\n")); - return INTERRUPT_REASON_IGNORE; - } - if(!(status & (0x01 << Channel))) { + case PRMIO: { + ULONG stat_reg = (ChipFlags & PRG2) ? 0x60 : 0x6c; + status = AtapiReadPortEx4(chan, (ULONGIO_PTR)(&deviceExtension->BaseIoAddressBM_0),0x40); + AtapiWritePortEx4(chan, (ULONGIO_PTR)(&deviceExtension->BaseIoAddressBM_0),0x40, status); + + if(status & (1 << (Channel+1))) { + // our + } else { KdPrint2((PRINT_PREFIX " Promise mio unexpected\n")); return INTERRUPT_REASON_IGNORE; } + + if(!(ChipFlags & UNIATA_SATA)) + break; + + pr_status = AtapiReadPortEx4(chan, (ULONGIO_PTR)(&deviceExtension->BaseIoAddressBM_0),stat_reg); + AtapiWritePortEx4(chan, (ULONGIO_PTR)(&deviceExtension->BaseIoAddressBM_0),stat_reg, (pr_status & (0x11 << Channel))); + if(pr_status & (0x11 << Channel)) { + // TODO: reset channel + KdPrint2((PRINT_PREFIX " Promise mio unexpected + reset req\n")); + UniataSataEvent(deviceExtension, lChannel, UNIATA_SATA_EVENT_DETACH, 0); + } + if(!(status & (0x01 << Channel))) { + // Connect event + KdPrint2((PRINT_PREFIX " Promise mio unexpected attach\n")); + UniataSataEvent(deviceExtension, lChannel, UNIATA_SATA_EVENT_ATTACH, 0); + } + if(UniataSataClearErr(HwDeviceExtension, c, UNIATA_SATA_DO_CONNECT, 0)) { + OurInterrupt = INTERRUPT_REASON_UNEXPECTED; + } else { + return INTERRUPT_REASON_IGNORE; + } + AtapiWritePort4(chan, IDX_BM_DeviceSpecific0, 0x00000001); - break; + break; } } break; } case ATA_NVIDIA_ID: { @@ -4551,6 +4569,7 @@ AtapiInterrupt__( // BOOLEAN RestoreUseDpc = FALSE; BOOLEAN DataOverrun = FALSE; BOOLEAN NoStartIo = TRUE; + BOOLEAN NoRetry = FALSE; KdPrint2((PRINT_PREFIX "AtapiInterrupt:\n")); if(InDpc) { @@ -4763,12 +4782,19 @@ ServiceInterrupt: statusByte = (UCHAR)(AtaReq->ahci.in_status & IDE_STATUS_MASK); if(chan->AhciLastIS & ~(ATA_AHCI_P_IX_DHR | ATA_AHCI_P_IX_PS | ATA_AHCI_P_IX_DS | ATA_AHCI_P_IX_SDB)) { - KdPrint3((PRINT_PREFIX "Err intr (%#x)\n", chan->AhciLastIS & ~(ATA_AHCI_P_IX_DHR | ATA_AHCI_P_IX_PS | ATA_AHCI_P_IX_DS | ATA_AHCI_P_IX_SDB))); + KdPrint3((PRINT_PREFIX "Err intr (%#x), SE (%#x)\n", + chan->AhciLastIS & ~(ATA_AHCI_P_IX_DHR | ATA_AHCI_P_IX_PS | ATA_AHCI_P_IX_DS | ATA_AHCI_P_IX_SDB), + chan->AhciLastSError)); if(chan->AhciLastIS & ~ATA_AHCI_P_IX_OF) { //KdPrint3((PRINT_PREFIX "Err mask (%#x)\n", chan->AhciLastIS & ~ATA_AHCI_P_IX_OF)); // We have some other error except Overflow // Just signal ERROR, operation will be aborted in ERROR branch. statusByte |= IDE_STATUS_ERROR; + AtaReq->ahci.in_serror = chan->AhciLastSError; + if(chan->AhciLastSError & (ATA_SE_HANDSHAKE_ERR | ATA_SE_LINKSEQ_ERR | ATA_SE_TRANSPORT_ERR | ATA_SE_UNKNOWN_FIS)) { + KdPrint2((PRINT_PREFIX "Unrecoverable\n")); + NoRetry = TRUE; + } } else { // We have only Overflow. Abort operation and continue #ifdef _DEBUG @@ -4960,6 +4986,13 @@ try_dpc_wait: UniataDumpAhciPortRegs(chan); #endif UniataAhciStatus(HwDeviceExtension, lChannel, DEVNUM_NOT_SPECIFIED); + if(NoRetry) { + AtaReq->retry += MAX_RETRIES; + if(!error && (statusByte & IDE_STATUS_ERROR)) { + KdPrint2((PRINT_PREFIX "AtapiInterrupt: force error status\n")); + error |= IDE_STATUS_ERROR; + } + } #ifdef _DEBUG UniataDumpAhciPortRegs(chan); #endif @@ -4980,7 +5013,9 @@ try_dpc_wait: KdPrint2((PRINT_PREFIX " Bad Lba unknown\n")); } - + if(deviceExtension->HwFlags & UNIATA_AHCI) { + KdPrint2((PRINT_PREFIX " no wait ready after error\n")); + } else if(!atapiDev) { KdPrint2((PRINT_PREFIX " wait 100 ready after IDE error\n")); AtapiStallExecution(100); @@ -5012,11 +5047,14 @@ continue_err: #endif //IO_STATISTICS if(DmaTransfer /*&& (error & IDE_ERROR_ICRC)*/) { + KdPrint2((PRINT_PREFIX "Errors in DMA mode\n")); if(AtaReq->retry < MAX_RETRIES) { //fallback_pio: - AtaReq->Flags &= ~REQ_FLAG_DMA_OPERATION; - AtaReq->Flags |= REQ_FLAG_FORCE_DOWNRATE; + if(!(deviceExtension->HwFlags & UNIATA_AHCI)) { + AtaReq->Flags &= ~REQ_FLAG_DMA_OPERATION; + AtaReq->Flags |= REQ_FLAG_FORCE_DOWNRATE; // LunExt->DeviceFlags |= DFLAGS_FORCE_DOWNRATE; + } AtaReq->ReqState = REQ_STATE_QUEUED; goto reenqueue_req; } @@ -10671,8 +10709,8 @@ AtapiRegCheckParameterValue( // KdPrint(( "AtapiCheckRegValue: RegistryPath %ws\n", RegistryPath->Buffer)); paramPath.Length = 0; - paramPath.MaximumLength = (USHORT)(RegistryPath->Length + - (wcslen(PathSuffix)+2)*sizeof(WCHAR)); + paramPath.MaximumLength = RegistryPath->Length + + (wcslen(PathSuffix)+2)*sizeof(WCHAR); paramPath.Buffer = (PWCHAR)ExAllocatePool(NonPagedPool, paramPath.MaximumLength); if(!paramPath.Buffer) { KdPrint(("AtapiCheckRegValue: couldn't allocate paramPath\n")); diff --git a/reactos/drivers/storage/ide/uniata/id_dma.cpp b/reactos/drivers/storage/ide/uniata/id_dma.cpp index 1adeba6946c..2f04ff488f0 100644 --- a/reactos/drivers/storage/ide/uniata/id_dma.cpp +++ b/reactos/drivers/storage/ide/uniata/id_dma.cpp @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2002-2012 Alexander A. Telyatnikov (Alter) +Copyright (c) 2002-2014 Alexander A. Telyatnikov (Alter) Module Name: id_dma.cpp @@ -296,7 +296,7 @@ AtapiDmaSetup( KdPrint2((PRINT_PREFIX " get Phys(PRD=%x)\n", &(AtaReq->dma_tab) )); dma_base = AtapiVirtToPhysAddr(HwDeviceExtension, NULL, (PUCHAR)&(AtaReq->dma_tab) /*chan->dma_tab*/, &i, &dma_baseu); } - if(dma_baseu) { + if(dma_baseu && i) { KdPrint2((PRINT_PREFIX "AtapiDmaSetup: SRB built-in PRD above 4Gb: %8.8x%8.8x\n", dma_baseu, dma_base)); if(!deviceExtension->Host64) { dma_base = chan->DB_PRD_PhAddr; @@ -312,8 +312,8 @@ AtapiDmaSetup( KdPrint2((PRINT_PREFIX " get Phys(data[0]=%x)\n", data )); dma_base = AtapiVirtToPhysAddr(HwDeviceExtension, Srb, data, &dma_count, &dma_baseu); - if(dma_baseu) { - KdPrint2((PRINT_PREFIX "AtapiDmaSetup: 1st block of buffer above 4Gb: %8.8x%8.8x\n", dma_baseu, dma_base)); + if(dma_baseu && dma_count) { + KdPrint2((PRINT_PREFIX "AtapiDmaSetup: 1st block of buffer above 4Gb: %8.8x%8.8x cnt=%x\n", dma_baseu, dma_base, dma_count)); if(!deviceExtension->Host64) { retry_DB_IO: use_DB_IO = TRUE; @@ -378,8 +378,8 @@ retry_DB_IO: } KdPrint2((PRINT_PREFIX " get Phys(data[n=%d]=%x)\n", i, data )); dma_base = AtapiVirtToPhysAddr(HwDeviceExtension, Srb, data, &dma_count, &dma_baseu); - if(dma_baseu) { - KdPrint2((PRINT_PREFIX "AtapiDmaSetup: block of buffer above 4Gb: %8.8x%8.8x\n", dma_baseu, dma_base)); + if(dma_baseu && dma_count) { + KdPrint2((PRINT_PREFIX "AtapiDmaSetup: block of buffer above 4Gb: %8.8x%8.8x, cnt=%x\n", dma_baseu, dma_base, dma_count)); if(!deviceExtension->Host64) { if(use_DB_IO) { KdPrint2((PRINT_PREFIX "AtapiDmaSetup: *ERROR* special buffer above 4Gb: %8.8x%8.8x\n", dma_baseu, dma_base)); diff --git a/reactos/drivers/storage/ide/uniata/id_init.cpp b/reactos/drivers/storage/ide/uniata/id_init.cpp index e33f1683678..cb07c2915c2 100644 --- a/reactos/drivers/storage/ide/uniata/id_init.cpp +++ b/reactos/drivers/storage/ide/uniata/id_init.cpp @@ -43,6 +43,12 @@ Revision History: #include "stdafx.h" +static BUSMASTER_CONTROLLER_INFORMATION const AtiSouthAdapters[] = { + PCI_DEV_HW_SPEC_BM( 4385, 1002, 0x00, ATA_MODE_NOT_SPEC, "ATI South", 0 ), + PCI_DEV_HW_SPEC_BM( ffff, ffff, 0xff, BMLIST_TERMINATOR, NULL , BMLIST_TERMINATOR ) + }; + + BOOLEAN NTAPI UniataChipDetectChannels( @@ -54,7 +60,7 @@ UniataChipDetectChannels( { PHW_DEVICE_EXTENSION deviceExtension = (PHW_DEVICE_EXTENSION)HwDeviceExtension; //ULONG slotNumber = deviceExtension->slotNumber; - //ULONG SystemIoBusNumber = deviceExtension->SystemIoBusNumber; + ULONG SystemIoBusNumber = deviceExtension->SystemIoBusNumber; ULONG VendorID = deviceExtension->DevID & 0xffff; //ULONG DeviceID = (deviceExtension->DevID >> 16) & 0xffff; //ULONG RevID = deviceExtension->RevID; @@ -97,16 +103,26 @@ UniataChipDetectChannels( if(ChipType != PRMIO) { break; } - deviceExtension->NumberChannels = 4; - KdPrint2((PRINT_PREFIX "Promise 4 chan\n")); + if(!(ChipFlags & UNIATA_SATA)) { + deviceExtension->NumberChannels = 4; + KdPrint2((PRINT_PREFIX "Promise up to 4 chan\n")); + } else + if(ChipFlags & PRCMBO) { + deviceExtension->NumberChannels = 3; + KdPrint2((PRINT_PREFIX "Promise 3 chan\n")); + } else { + deviceExtension->NumberChannels = 4; + KdPrint2((PRINT_PREFIX "Promise 4 chan\n")); + } break; case ATA_MARVELL_ID: KdPrint2((PRINT_PREFIX "Marvell\n")); + /* AHCI part has own DevID-based workaround */ switch(deviceExtension->DevID) { case 0x610111ab: /* 88SX6101 only have 1 PATA channel */ if(BMList[deviceExtension->DevIndex].channel) { - KdPrint2((PRINT_PREFIX "88SX6101 has no 2nd PATA chan\n")); + KdPrint2((PRINT_PREFIX "88SX6101/11 has no 2nd PATA chan\n")); return FALSE; } deviceExtension->NumberChannels = 1; @@ -118,8 +134,8 @@ UniataChipDetectChannels( KdPrint2((PRINT_PREFIX "ATI\n")); switch(deviceExtension->DevID) { case ATA_ATI_IXP600: - case ATA_ATI_IXP700: - /* IXP600 & IXP700 only have 1 PATA channel */ + KdPrint2((PRINT_PREFIX " IXP600\n")); + /* IXP600 only have 1 PATA channel */ if(BMList[deviceExtension->DevIndex].channel) { KdPrint2((PRINT_PREFIX "New ATI no 2nd PATA chan\n")); return FALSE; @@ -127,6 +143,52 @@ UniataChipDetectChannels( deviceExtension->NumberChannels = 1; KdPrint2((PRINT_PREFIX "New ATI PATA 1 chan\n")); break; + + case ATA_ATI_IXP700: { + UCHAR satacfg = 0; + PCI_SLOT_NUMBER slotData; + ULONG i, slotNumber; + + KdPrint2((PRINT_PREFIX " IXP700\n")); + /* + * When "combined mode" is enabled, an additional PATA channel is + * emulated with two SATA ports and appears on this device. + * This mode can only be detected via SMB controller. + */ + i = AtapiFindListedDev((BUSMASTER_CONTROLLER_INFORMATION*)&AtiSouthAdapters[0], -1, HwDeviceExtension, SystemIoBusNumber, PCISLOTNUM_NOT_SPECIFIED, &slotData); + if(i != BMLIST_TERMINATOR) { + slotNumber = slotData.u.AsULONG; + + GetPciConfig1(0xad, satacfg); + KdPrint(("SATA controller %s (%s%s channel)\n", + (satacfg & 0x01) == 0 ? "disabled" : "enabled", + (satacfg & 0x08) == 0 ? "" : "combined mode, ", + (satacfg & 0x10) == 0 ? "primary" : "secondary")); + /* + * If SATA controller is enabled but combined mode is disabled, + * we have only one PATA channel. Ignore a non-existent channel. + */ + if ((satacfg & 0x09) == 0x01) { + if(BMList[deviceExtension->DevIndex].channel) { + KdPrint2((PRINT_PREFIX "New ATI no 2nd PATA chan\n")); + return FALSE; + } + deviceExtension->NumberChannels = 1; + KdPrint2((PRINT_PREFIX "New ATI PATA 1 chan\n")); + break; + } else { + KdPrint2((PRINT_PREFIX "New ATI 2 chan\n")); + deviceExtension->NumberChannels = 2; + /* + if (BMList[deviceExtension->DevIndex].channel != ((satacfg & 0x10) >> 4)) { + ; + } + */ + + } + } + + break; } } /* FALLTHROUGH */ case ATA_SILICON_IMAGE_ID: @@ -241,6 +303,7 @@ UniataChipDetect( ULONG BaseIoAddress2; ULONG BaseIoAddressBM; BOOLEAN MemIo = FALSE; + BOOLEAN IsPata = FALSE; KdPrint2((PRINT_PREFIX "UniataChipDetect:\n" )); KdPrint2((PRINT_PREFIX "HwFlags: %#x\n", deviceExtension->HwFlags)); @@ -292,6 +355,9 @@ unknown_dev: } static BUSMASTER_CONTROLLER_INFORMATION const SiSAdapters[] = { + PCI_DEV_HW_SPEC_BM( 1183, 1039, 0x00, ATA_UDMA6, "SiS 1183" , SIS133NEW), + PCI_DEV_HW_SPEC_BM( 1182, 1039, 0x00, ATA_SA150, "SiS 1182" , SISSATA | UNIATA_SATA), + PCI_DEV_HW_SPEC_BM( 0183, 1039, 0x00, ATA_SA150, "SiS 183" , SISSATA | UNIATA_SATA), PCI_DEV_HW_SPEC_BM( 0182, 1039, 0x00, ATA_SA150, "SiS 182" , SISSATA | UNIATA_SATA), PCI_DEV_HW_SPEC_BM( 0181, 1039, 0x00, ATA_SA150, "SiS 181" , SISSATA | UNIATA_SATA), PCI_DEV_HW_SPEC_BM( 0180, 1039, 0x00, ATA_SA150, "SiS 180" , SISSATA | UNIATA_SATA), @@ -371,6 +437,10 @@ unknown_dev: switch(VendorID) { case ATA_SIS_ID: + /* + We shall get here for all SIS controllers, even unlisted. + Then perform bus scan to find SIS bridge and decide what to do with controller + */ KdPrint2((PRINT_PREFIX "ATA_SIS_ID\n")); DevTypeInfo = (BUSMASTER_CONTROLLER_INFORMATION*)&SiSAdapters[0]; i = AtapiFindListedDev(DevTypeInfo, -1, HwDeviceExtension, SystemIoBusNumber, PCISLOTNUM_NOT_SPECIFIED, NULL); @@ -505,6 +575,7 @@ for_ugly_chips: if(deviceExtension->MaxTransferMode >= ATA_SA150) { deviceExtension->HwFlags |= UNIATA_SATA; } + /* ConfigInfo->MaximumTransferLength = DEV_BSIZE*256; deviceExtension->MaximumDmaTransferLength = ConfigInfo->MaximumTransferLength; @@ -512,6 +583,25 @@ for_ugly_chips: ChipType = deviceExtension->HwFlags & CHIPTYPE_MASK; ChipFlags = deviceExtension->HwFlags & CHIPFLAG_MASK; + /* for even more ugly AHCI-capable chips */ + if(ChipFlags & UNIATA_AHCI) { + /* + Seems, some chips may have inoperable/alternative BAR5 in SATA mode + This can be detected via PCI SubClass + */ + switch(VendorID) { + case ATA_NVIDIA_ID: + case ATA_ATI_ID: + KdPrint2((PRINT_PREFIX "ATA_xxx_ID check AHCI subclass\n")); + if((pciData)->SubClass == PCI_DEV_SUBCLASS_IDE) { + KdPrint2((PRINT_PREFIX "Non-AHCI mode\n")); + ChipFlags &= ~UNIATA_AHCI; + deviceExtension->HwFlags &= ~UNIATA_AHCI; + } + break; + } + } + if(ChipFlags & UNIATA_AHCI) { deviceExtension->NumberChannels = 0; if(!UniataAhciDetect(HwDeviceExtension, pciData, ConfigInfo)) { @@ -527,9 +617,6 @@ for_ugly_chips: return STATUS_UNSUCCESSFUL; } - if(ChipFlags & UNIATA_AHCI) { - } - switch(VendorID) { case ATA_ACER_LABS_ID: if(ChipFlags & UNIATA_SATA) { @@ -571,6 +658,9 @@ for_ugly_chips: BaseMemAddress = AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber, 5, 0, ((ChipFlags & NV4OFF) ? 0x400 : 0) + 0x40*2); KdPrint2((PRINT_PREFIX "BaseMemAddress %x\n", BaseMemAddress)); + if(!BaseMemAddress) { + return STATUS_UNSUCCESSFUL; + } if((*ConfigInfo->AccessRanges)[5].RangeInMemory) { KdPrint2((PRINT_PREFIX "MemIo\n")); MemIo = TRUE; @@ -600,26 +690,57 @@ for_ugly_chips: break; } deviceExtension->AltRegMap = TRUE; // inform generic resource allocator + + /* BAR4 -> res1 */ BaseMemAddress = AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber, 4, 0, 0x4000); - KdPrint2((PRINT_PREFIX "BaseMemAddress %x\n", BaseMemAddress)); + KdPrint2((PRINT_PREFIX "BaseMemAddress[4] %x\n", BaseMemAddress)); + if(!BaseMemAddress) { + return STATUS_UNSUCCESSFUL; + } if((*ConfigInfo->AccessRanges)[4].RangeInMemory) { KdPrint2((PRINT_PREFIX "MemIo\n")); MemIo = TRUE; } + deviceExtension->BaseIoAddressSATA_0.Addr = BaseMemAddress; + deviceExtension->BaseIoAddressSATA_0.MemIo = MemIo; + + /* BAR3 -> res2 */ + BaseMemAddress = AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber, + 3, 0, 0xd0000); + KdPrint2((PRINT_PREFIX "BaseMemAddress[3] %x\n", BaseMemAddress)); + if(!BaseMemAddress) { + return STATUS_UNSUCCESSFUL; + } + if((*ConfigInfo->AccessRanges)[3].RangeInMemory) { + KdPrint2((PRINT_PREFIX "MemIo\n")); + MemIo = TRUE; + } deviceExtension->BaseIoAddressBM_0.Addr = BaseMemAddress; deviceExtension->BaseIoAddressBM_0.MemIo = MemIo; + + if(!(ChipFlags & UNIATA_SATA)) { + UCHAR reg48; + + reg48 = AtapiReadPortEx1(NULL, (ULONGIO_PTR)(&deviceExtension->BaseIoAddressSATA_0),0x48); + deviceExtension->NumberChannels = ((reg48 & 0x01) ? 1 : 0) + + ((reg48 & 0x02) ? 1 : 0) + + 2; + KdPrint2((PRINT_PREFIX "Channels -> %d\n", deviceExtension->NumberChannels)); + } + for(c=0; cNumberChannels; c++) { - ULONG offs12, offs7; + /* res2-based */ + ULONG offs8, offs7; chan = &deviceExtension->chan[c]; - offs12 = c << 12; - offs7 = c << 7; + offs8 = c << 8; + offs7 = c << 7; for (i=0; i<=IDX_IO1_SZ; i++) { - chan->RegTranslation[IDX_IO1+i].Addr = BaseMemAddress + 0x200 + (i << 2) + offs12; + chan->RegTranslation[IDX_IO1+i].Addr = BaseMemAddress + 0x200 + (i << 2) + offs7; chan->RegTranslation[IDX_IO1+i].MemIo = MemIo; } chan->RegTranslation[IDX_IO2_AltStatus].Addr = BaseMemAddress + 0x238 + offs7; @@ -633,11 +754,37 @@ for_ugly_chips: chan->RegTranslation[IDX_BM_PRD_Table].MemIo = MemIo; chan->RegTranslation[IDX_BM_DeviceSpecific0].Addr = BaseMemAddress + (c << 2); chan->RegTranslation[IDX_BM_DeviceSpecific0].MemIo = MemIo; + + if((ChipFlags & PRSATA) || + ((ChipFlags & PRCMBO) && c<2)) { + KdPrint2((PRINT_PREFIX "Promise SATA\n")); + + chan->RegTranslation[IDX_SATA_SStatus].Addr = BaseMemAddress + 0x400 + offs7; + chan->RegTranslation[IDX_SATA_SStatus].MemIo = MemIo; + chan->RegTranslation[IDX_SATA_SError].Addr = BaseMemAddress + 0x404 + offs7; + chan->RegTranslation[IDX_SATA_SError].MemIo = MemIo; + chan->RegTranslation[IDX_SATA_SControl].Addr = BaseMemAddress + 0x408 + offs7; + chan->RegTranslation[IDX_SATA_SControl].MemIo = MemIo; + + chan->ChannelCtrlFlags |= CTRFLAGS_NO_SLAVE; + } else { + KdPrint2((PRINT_PREFIX "Promise PATA\n")); + chan->MaxTransferMode = min(deviceExtension->MaxTransferMode, ATA_UDMA6); + } } break; case ATA_ATI_ID: KdPrint2((PRINT_PREFIX "ATI\n")); + if(ChipType == ATI700) { + KdPrint2((PRINT_PREFIX "ATI700\n")); + if(!(ChipFlags & UNIATA_AHCI)) { + KdPrint2((PRINT_PREFIX "IXP700 PATA\n")); + chan = &deviceExtension->chan[0]; + chan->MaxTransferMode = min(deviceExtension->MaxTransferMode, ATA_UDMA5); + } + break; + } /* FALLTHROUGH */ case ATA_SILICON_IMAGE_ID: { @@ -661,6 +808,9 @@ for_ugly_chips: BaseMemAddress = AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber, 5, 0, 0x800); KdPrint2((PRINT_PREFIX "BaseMemAddress %x\n", BaseMemAddress)); + if(!BaseMemAddress) { + return STATUS_UNSUCCESSFUL; + } if((*ConfigInfo->AccessRanges)[5].RangeInMemory) { KdPrint2((PRINT_PREFIX "MemIo\n")); MemIo = TRUE; @@ -697,6 +847,10 @@ for_ugly_chips: chan->RegTranslation[IDX_BM_DeviceSpecific1].MemIo = MemIo; } + if(chan->MaxTransferMode < ATA_SA150) { + // do nothing for PATA part + KdPrint2((PRINT_PREFIX "No SATA regs for PATA part\n")); + } else if(ChipFlags & UNIATA_SATA) { chan->RegTranslation[IDX_SATA_SStatus].Addr = BaseMemAddress + 0x104 + (unit01 << 7) + (unit10 << 8); chan->RegTranslation[IDX_SATA_SStatus].MemIo = MemIo; @@ -725,6 +879,9 @@ for_ugly_chips: BaseMemAddress = AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber, 5, 0, 0x400); KdPrint2((PRINT_PREFIX "BaseMemAddress %x\n", BaseMemAddress)); + if(!BaseMemAddress) { + return STATUS_UNSUCCESSFUL; + } if((*ConfigInfo->AccessRanges)[5].RangeInMemory) { KdPrint2((PRINT_PREFIX "MemIo\n")); MemIo = TRUE; @@ -802,7 +959,8 @@ for_ugly_chips: //deviceExtension->MaxTransferMode = SiSSouthAdapters[i].MaxTransferMode; if(SiSSouthAdapters[i].RaidFlags & UNIATA_SATA) { deviceExtension->HwFlags |= UNIATA_SATA; - if(SiSSouthAdapters[i].nDeviceId == 0x1182) { + if(SiSSouthAdapters[i].nDeviceId == 0x1182 || + SiSSouthAdapters[i].nDeviceId == 0x1183) { SIS_182 = TRUE; } } @@ -827,25 +985,27 @@ for_ugly_chips: BaseMemAddress = AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber, 5, 0, 0x400); KdPrint2((PRINT_PREFIX "BaseMemAddress %x\n", BaseMemAddress)); - if((*ConfigInfo->AccessRanges)[5].RangeInMemory) { - KdPrint2((PRINT_PREFIX "MemIo\n")); - MemIo = TRUE; - } - deviceExtension->BaseIoAddressSATA_0.Addr = BaseMemAddress; - deviceExtension->BaseIoAddressSATA_0.MemIo = MemIo; + if(BaseMemAddress) { + if((*ConfigInfo->AccessRanges)[5].RangeInMemory) { + KdPrint2((PRINT_PREFIX "MemIo\n")); + MemIo = TRUE; + } + deviceExtension->BaseIoAddressSATA_0.Addr = BaseMemAddress; + deviceExtension->BaseIoAddressSATA_0.MemIo = MemIo; - for(c=0; cNumberChannels; c++) { - ULONG offs = c << (SIS_182 ? 5 : 6); + for(c=0; cNumberChannels; c++) { + ULONG offs = c << (SIS_182 ? 5 : 6); - chan = &deviceExtension->chan[c]; - chan->RegTranslation[IDX_SATA_SStatus].Addr = BaseMemAddress + 0 + offs; - chan->RegTranslation[IDX_SATA_SStatus].MemIo = MemIo; - chan->RegTranslation[IDX_SATA_SError].Addr = BaseMemAddress + 4 + offs; - chan->RegTranslation[IDX_SATA_SError].MemIo = MemIo; - chan->RegTranslation[IDX_SATA_SControl].Addr = BaseMemAddress + 8 + offs; - chan->RegTranslation[IDX_SATA_SControl].MemIo = MemIo; + chan = &deviceExtension->chan[c]; + chan->RegTranslation[IDX_SATA_SStatus].Addr = BaseMemAddress + 0 + offs; + chan->RegTranslation[IDX_SATA_SStatus].MemIo = MemIo; + chan->RegTranslation[IDX_SATA_SError].Addr = BaseMemAddress + 4 + offs; + chan->RegTranslation[IDX_SATA_SError].MemIo = MemIo; + chan->RegTranslation[IDX_SATA_SControl].Addr = BaseMemAddress + 8 + offs; + chan->RegTranslation[IDX_SATA_SControl].MemIo = MemIo; - chan->ChannelCtrlFlags |= CTRFLAGS_NO_SLAVE; + chan->ChannelCtrlFlags |= CTRFLAGS_NO_SLAVE; + } } } } @@ -941,7 +1101,6 @@ for_ugly_chips: break; } case ATA_INTEL_ID: { - BOOLEAN IsPata; if(!(ChipFlags & UNIATA_SATA)) { break; } @@ -953,6 +1112,9 @@ for_ugly_chips: KdPrint2((PRINT_PREFIX "UniataChipDetect: Intel 31244, DPA mode\n")); BaseMemAddress = AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber, 0, 0, 0x0c00); + if(!BaseMemAddress) { + return STATUS_UNSUCCESSFUL; + } if((*ConfigInfo->AccessRanges)[0].RangeInMemory) { KdPrint2((PRINT_PREFIX "MemIo\n")); MemIo = TRUE; @@ -1527,7 +1689,7 @@ UniAtaReadLunConfig( memcpy(LunExt->IdentifyData.FirmwareRevision, ".10", 4); if(!LunExt->IdentifyData.SectorsPerTrack || !LunExt->IdentifyData.NumberOfCylinders || - !LunExt->IdentifyData.SectorsPerTrack) { + !LunExt->IdentifyData.NumberOfHeads) { // ERROR KdPrint2((PRINT_PREFIX "Wrong CHS\n")); LunExt->opt_GeomType = GEOM_AUTO; @@ -2037,8 +2199,13 @@ AtapiChipInit( break; case PRMIO: if(c == CHAN_NOT_SPECIFIED) { - if(ChipFlags & PRSATA) { - AtapiWritePortEx4(NULL, (ULONGIO_PTR)(&deviceExtension->BaseIoAddressBM_0),0x6c, 0x000000ff); + /* clear SATA status and unmask interrupts */ + AtapiWritePortEx4(NULL, (ULONGIO_PTR)(&deviceExtension->BaseIoAddressBM_0), + (ChipFlags & PRG2) ? 0x60 : 0x6c, 0x000000ff); + if(ChipFlags & UNIATA_SATA) { + /* enable "long burst length" on gen2 chips */ + AtapiWritePortEx4(NULL, (ULONGIO_PTR)(&deviceExtension->BaseIoAddressBM_0), 0x44, + AtapiReadPortEx4(NULL, (ULONGIO_PTR)(&deviceExtension->BaseIoAddressBM_0), 0x44) | 0x2000); } } else { chan = &deviceExtension->chan[c]; @@ -2072,6 +2239,7 @@ AtapiChipInit( KdPrint2((PRINT_PREFIX "ATI\n")); break; } + /* FALLTHROUGH */ case ATA_SILICON_IMAGE_ID: /* if(ChipFlags & SIIENINTR) { SetPciConfig1(0x71, 0x01); @@ -2190,7 +2358,15 @@ AtapiChipInit( } break; } - } + case ATI700: + KdPrint2((PRINT_PREFIX "ATI700\n")); + if(c == 0 && !(ChipFlags & UNIATA_AHCI)) { + KdPrint2((PRINT_PREFIX "IXP700 PATA\n")); + chan = &deviceExtension->chan[c]; + chan->MaxTransferMode = min(deviceExtension->MaxTransferMode, ATA_UDMA5); + } + break; + } /* switch(ChipType) */ break; case ATA_SIS_ID: if(c == CHAN_NOT_SPECIFIED) { @@ -2211,6 +2387,7 @@ AtapiChipInit( break; case SISSATA: ChangePciConfig2(0x04, (a & ~0x0400)); + break; } } if(ChipType == SIS133NEW) { diff --git a/reactos/drivers/storage/ide/uniata/id_sata.cpp b/reactos/drivers/storage/ide/uniata/id_sata.cpp index 649b62cea5d..9996852d55c 100644 --- a/reactos/drivers/storage/ide/uniata/id_sata.cpp +++ b/reactos/drivers/storage/ide/uniata/id_sata.cpp @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2008-2012 Alexandr A. Telyatnikov (Alter) +Copyright (c) 2008-2014 Alexandr A. Telyatnikov (Alter) Module Name: id_probe.cpp @@ -649,6 +649,8 @@ UniataAhciInit( ULONG PI; #endif //DBG ULONG CAP; + ULONG CAP2; + ULONG BOHC; ULONG GHC; BOOLEAN MemIo = FALSE; @@ -658,6 +660,37 @@ UniataAhciInit( UniataDumpAhciRegs(deviceExtension); #endif //DBG + CAP2 = UniataAhciReadHostPort4(deviceExtension, IDX_AHCI_CAP2); + if(CAP2 & AHCI_CAP2_BOH) { + BOHC = UniataAhciReadHostPort4(deviceExtension, IDX_AHCI_BOHC); + KdPrint2((PRINT_PREFIX " stage 1 BOHC %#x\n", BOHC)); + UniataAhciWriteHostPort4(deviceExtension, IDX_AHCI_BOHC, + BOHC | AHCI_BOHC_OOS); + for(i=0; i<50; i++) { + AtapiStallExecution(500); + BOHC = UniataAhciReadHostPort4(deviceExtension, IDX_AHCI_BOHC); + KdPrint2((PRINT_PREFIX " BOHC %#x\n", BOHC)); + if(BOHC & AHCI_BOHC_BB) { + break; + } + if(!(BOHC & AHCI_BOHC_BOS)) { + break; + } + } + KdPrint2((PRINT_PREFIX " stage 2 BOHC %#x\n", BOHC)); + if(BOHC & AHCI_BOHC_BB) { + for(i=0; i<2000; i++) { + AtapiStallExecution(1000); + BOHC = UniataAhciReadHostPort4(deviceExtension, IDX_AHCI_BOHC); + KdPrint2((PRINT_PREFIX " BOHC %#x\n", BOHC)); + if(!(BOHC & AHCI_BOHC_BOS)) { + break; + } + } + } + KdPrint2((PRINT_PREFIX " final BOHC %#x\n", BOHC)); + } + /* disable AHCI interrupts, for MSI compatibility issue see http://www.intel.com/Assets/PDF/specupdate/307014.pdf 26. AHCI Reset and MSI Request @@ -729,7 +762,14 @@ UniataAhciInit( PI = UniataAhciReadHostPort4(deviceExtension, IDX_AHCI_PI); KdPrint2((PRINT_PREFIX " AHCI PI %#x\n", PI)); #endif //DBG - + CAP2 = UniataAhciReadHostPort4(deviceExtension, IDX_AHCI_CAP2); + if(CAP2 & AHCI_CAP2_BOH) { + KdPrint2((PRINT_PREFIX " retry BOHC\n")); + BOHC = UniataAhciReadHostPort4(deviceExtension, IDX_AHCI_BOHC); + KdPrint2((PRINT_PREFIX " BOHC %#x\n", BOHC)); + UniataAhciWriteHostPort4(deviceExtension, IDX_AHCI_BOHC, + BOHC | AHCI_BOHC_OOS); + } /* clear interrupts */ UniataAhciWriteHostPort4(deviceExtension, IDX_AHCI_IS, UniataAhciReadHostPort4(deviceExtension, IDX_AHCI_IS)); @@ -1061,6 +1101,7 @@ UniataAhciStatus( } chan->AhciCompleteCI = (chan->AhciPrevCI ^ CI) & chan->AhciPrevCI; // only 1->0 states chan->AhciPrevCI = CI; + chan->AhciLastSError = SError.Reg; KdPrint((" AHCI: complete mask %#x\n", chan->AhciCompleteCI)); chan->AhciLastIS = IS.Reg; if(CI & (1 << tag)) { diff --git a/reactos/drivers/storage/ide/uniata/uniata_ver.h b/reactos/drivers/storage/ide/uniata/uniata_ver.h index 7352f7ba1bb..496c1d7d5d8 100644 --- a/reactos/drivers/storage/ide/uniata/uniata_ver.h +++ b/reactos/drivers/storage/ide/uniata/uniata_ver.h @@ -1,10 +1,10 @@ -#define UNIATA_VER_STR "44b1" -#define UNIATA_VER_DOT 0.44.2.1 +#define UNIATA_VER_STR "45a3" +#define UNIATA_VER_DOT 0.45.1.3 #define UNIATA_VER_MJ 0 -#define UNIATA_VER_MN 44 -#define UNIATA_VER_SUB_MJ 2 -#define UNIATA_VER_SUB_MN 1 -#define UNIATA_VER_DOT_COMMA 0,44,2,1 -#define UNIATA_VER_DOT_STR "0.44.2.1" -#define UNIATA_VER_YEAR 2013 -#define UNIATA_VER_YEAR_STR "2013" +#define UNIATA_VER_MN 45 +#define UNIATA_VER_SUB_MJ 1 +#define UNIATA_VER_SUB_MN 3 +#define UNIATA_VER_DOT_COMMA 0,45,1,3 +#define UNIATA_VER_DOT_STR "0.45.1.3" +#define UNIATA_VER_YEAR 2014 +#define UNIATA_VER_YEAR_STR "2014" From fa3242a619ac28864f02568dd732646db5503300 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Fri, 14 Mar 2014 02:39:18 +0000 Subject: [PATCH 106/113] [Win32k] - Patch by Maxim Andreyanov : CreateWindowEx have to set error when menu handle is invalid. - See CORE-7980. svn path=/trunk/; revision=62494 --- reactos/win32ss/user/ntuser/object.c | 41 ++++++++++++++++++++++++++++ reactos/win32ss/user/ntuser/object.h | 1 + reactos/win32ss/user/ntuser/window.c | 10 +++++++ 3 files changed, 52 insertions(+) diff --git a/reactos/win32ss/user/ntuser/object.c b/reactos/win32ss/user/ntuser/object.c index 363e175a28f..4f7f1da4257 100644 --- a/reactos/win32ss/user/ntuser/object.c +++ b/reactos/win32ss/user/ntuser/object.c @@ -554,6 +554,47 @@ HANDLE FASTCALL ValidateHandleNoErr(HANDLE handle, HANDLE_TYPE type) if (handle) return (PWND)UserGetObjectNoErr(gHandleTable, handle, type); return NULL; } + +PVOID FASTCALL ValidateHandle(HANDLE handle, HANDLE_TYPE type) +{ + PVOID pObj; + DWORD dwError = 0; + if (handle) + { + pObj = UserGetObjectNoErr(gHandleTable, handle, type); + if (!pObj) + { + switch (type) + { + case TYPE_WINDOW: + dwError = ERROR_INVALID_WINDOW_HANDLE; + break; + case TYPE_MENU: + dwError = ERROR_INVALID_MENU_HANDLE; + break; + case TYPE_CURSOR: + dwError = ERROR_INVALID_CURSOR_HANDLE; + break; + case TYPE_SETWINDOWPOS: + dwError = ERROR_INVALID_DWP_HANDLE; + break; + case TYPE_HOOK: + dwError = ERROR_INVALID_HOOK_HANDLE; + break; + case TYPE_ACCELTABLE: + dwError = ERROR_INVALID_ACCEL_HANDLE; + break; + default: + dwError = ERROR_INVALID_HANDLE; + break; + } + EngSetLastError(dwError); + return NULL; + } + return pObj; + } + return NULL; +} /* * NtUserValidateHandleSecure diff --git a/reactos/win32ss/user/ntuser/object.h b/reactos/win32ss/user/ntuser/object.h index bbfbde686d2..f305633dea2 100644 --- a/reactos/win32ss/user/ntuser/object.h +++ b/reactos/win32ss/user/ntuser/object.h @@ -19,6 +19,7 @@ BOOL FASTCALL UserObjectInDestroy(HANDLE); void DbgUserDumpHandleTable(); VOID FASTCALL UserSetObjectOwner(PVOID obj, HANDLE_TYPE type, PVOID owner); HANDLE FASTCALL ValidateHandleNoErr(HANDLE handle, HANDLE_TYPE type); +PVOID FASTCALL ValidateHandle(HANDLE handle, HANDLE_TYPE type); static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry) diff --git a/reactos/win32ss/user/ntuser/window.c b/reactos/win32ss/user/ntuser/window.c index 90382406243..11915109217 100644 --- a/reactos/win32ss/user/ntuser/window.c +++ b/reactos/win32ss/user/ntuser/window.c @@ -2571,6 +2571,16 @@ NtUserCreateWindowEx( ASSERT(plstrWindowName); + if ( (dwStyle & (WS_POPUP|WS_CHILD)) != WS_CHILD) + { + /* check hMenu is valid handle */ + if (hMenu && !ValidateHandle(hMenu, TYPE_MENU)) + { + /* error is set in ValidateHandle */ + return NULL; + } + } + /* Copy the window name to kernel mode */ Status = ProbeAndCaptureLargeString(&lstrWindowName, plstrWindowName); if (!NT_SUCCESS(Status)) From f78a04d72009b059aa92ba1900f8394301f0077f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Fri, 14 Mar 2014 20:59:02 +0000 Subject: [PATCH 107/113] [CARDS]: Code formatting only (tabs --> spaces). svn path=/trunk/; revision=62496 --- reactos/dll/win32/cards/cards.c | 269 ++++++++++++++++---------------- reactos/dll/win32/cards/cards.h | 36 ++--- 2 files changed, 153 insertions(+), 152 deletions(-) diff --git a/reactos/dll/win32/cards/cards.c b/reactos/dll/win32/cards/cards.c index 20de5a754b8..05ff746992a 100644 --- a/reactos/dll/win32/cards/cards.c +++ b/reactos/dll/win32/cards/cards.c @@ -1,7 +1,7 @@ /* - * ReactOS Cards + * ReactOS Cards * - * Copyright (C) 2003 Filip Navara + * Copyright (C) 2003 Filip Navara * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -33,8 +33,8 @@ HINSTANCE g_hModule = 0; */ BOOL WINAPI WEP(DWORD Unknown) { - UNREFERENCED_PARAMETER(Unknown); - return TRUE; + UNREFERENCED_PARAMETER(Unknown); + return TRUE; } /* @@ -45,15 +45,15 @@ BOOL WINAPI cdtInit(INT *Width, INT *Height) DWORD dwIndex; /* Report card width and height to user */ - *Width = CARD_WIDTH; - *Height = CARD_HEIGHT; + *Width = CARD_WIDTH; + *Height = CARD_HEIGHT; - /* Load images */ - for (dwIndex = 0; dwIndex < MAX_CARD_BITMAPS; ++dwIndex) - g_CardBitmaps[dwIndex] = - (HBITMAP)LoadBitmapA(g_hModule, MAKEINTRESOURCEA(dwIndex + 1)); + /* Load images */ + for (dwIndex = 0; dwIndex < MAX_CARD_BITMAPS; ++dwIndex) + g_CardBitmaps[dwIndex] = + (HBITMAP)LoadBitmapA(g_hModule, MAKEINTRESOURCEA(dwIndex + 1)); - return TRUE; + return TRUE; } /* @@ -64,8 +64,8 @@ VOID WINAPI cdtTerm(VOID) DWORD dwIndex; /* Unload images */ - for (dwIndex = 0; dwIndex < MAX_CARD_BITMAPS; dwIndex++) - DeleteObject(g_CardBitmaps[dwIndex]); + for (dwIndex = 0; dwIndex < MAX_CARD_BITMAPS; dwIndex++) + DeleteObject(g_CardBitmaps[dwIndex]); } /* @@ -73,7 +73,7 @@ VOID WINAPI cdtTerm(VOID) */ BOOL WINAPI cdtDraw(HDC hdc, INT x, INT y, INT card, INT type, COLORREF color) { - return cdtDrawExt(hdc, x, y, CARD_WIDTH, CARD_HEIGHT, card, type, color); + return cdtDrawExt(hdc, x, y, CARD_WIDTH, CARD_HEIGHT, card, type, color); } /* @@ -81,30 +81,31 @@ BOOL WINAPI cdtDraw(HDC hdc, INT x, INT y, INT card, INT type, COLORREF color) */ static __inline VOID BltCard(HDC hdc, INT x, INT y, INT dx, INT dy, HDC hdcCard, DWORD dwRasterOp, BOOL bStretch) { - if (bStretch) - { - StretchBlt(hdc, x, y, dx, dy, hdcCard, 0, 0, CARD_WIDTH, CARD_HEIGHT, dwRasterOp); - } else - { - BitBlt(hdc, x, y, dx, dy, hdcCard, 0, 0, dwRasterOp); + if (bStretch) + { + StretchBlt(hdc, x, y, dx, dy, hdcCard, 0, 0, CARD_WIDTH, CARD_HEIGHT, dwRasterOp); + } + else + { + BitBlt(hdc, x, y, dx, dy, hdcCard, 0, 0, dwRasterOp); /* * This is need when using Microsoft images, because they use two-color red/white images for * red cards and thus needs fix-up of the edge to black color. */ #if 0 - if (ISREDCARD(card)) - { - PatBlt(hdc, x, y + 2, 1, dy - 4, BLACKNESS); - PatBlt(hdc, x + dx - 1, y + 2, 1, dy - 4, BLACKNESS); - PatBlt(hdc, x + 2, y, dx - 4, 1, BLACKNESS); - PatBlt(hdc, x + 2, y + dy - 1, dx - 4, 1, BLACKNESS); - SetPixel(hdc, x + 1, y + 1, 0); - SetPixel(hdc, x + dx - 2, y + 1, 0); - SetPixel(hdc, x + 1, y + dy - 2, 0); - SetPixel(hdc, x + dx - 2, y + dy - 2, 0); - } + if (ISREDCARD(card)) + { + PatBlt(hdc, x, y + 2, 1, dy - 4, BLACKNESS); + PatBlt(hdc, x + dx - 1, y + 2, 1, dy - 4, BLACKNESS); + PatBlt(hdc, x + 2, y, dx - 4, 1, BLACKNESS); + PatBlt(hdc, x + 2, y + dy - 1, dx - 4, 1, BLACKNESS); + SetPixel(hdc, x + 1, y + 1, 0); + SetPixel(hdc, x + dx - 2, y + 1, 0); + SetPixel(hdc, x + 1, y + dy - 2, 0); + SetPixel(hdc, x + dx - 2, y + dy - 2, 0); + } #endif - } + } } /* @@ -122,106 +123,106 @@ static __inline VOID BltCard(HDC hdc, INT x, INT y, INT dx, INT dy, HDC hdcCard, */ BOOL WINAPI cdtDrawExt(HDC hdc, INT x, INT y, INT dx, INT dy, INT card, INT type, COLORREF color) { - HDC hdcCard; - DWORD dwRasterOp = SRCCOPY, OldBkColor; - BOOL bSaveEdges = TRUE; - BOOL bStretch = FALSE; + HDC hdcCard; + DWORD dwRasterOp = SRCCOPY, OldBkColor; + BOOL bSaveEdges = TRUE; + BOOL bStretch = FALSE; - if (type & ectSAVEEDGESMASK) - { - type &= ~ectSAVEEDGESMASK; - bSaveEdges = FALSE; - } + if (type & ectSAVEEDGESMASK) + { + type &= ~ectSAVEEDGESMASK; + bSaveEdges = FALSE; + } - if (dx != CARD_WIDTH || dy != CARD_HEIGHT) - { - bStretch = TRUE; - bSaveEdges = FALSE; - } + if (dx != CARD_WIDTH || dy != CARD_HEIGHT) + { + bStretch = TRUE; + bSaveEdges = FALSE; + } - switch (type) - { - case ectINVERTED: - dwRasterOp = NOTSRCCOPY; - case ectFACES: - card = (card % 4) * 13 + (card / 4); - break; - case ectBACKS: - --card; - break; - case ectEMPTYNOBG: - dwRasterOp = SRCAND; - case ectEMPTY: - card = 52; - break; - case ectERASE: - break; - case ectREDX: - card = 66; - break; - case ectGREENO: - card = 67; - break; - default: - return FALSE; - } + switch (type) + { + case ectINVERTED: + dwRasterOp = NOTSRCCOPY; + case ectFACES: + card = (card % 4) * 13 + (card / 4); + break; + case ectBACKS: + --card; + break; + case ectEMPTYNOBG: + dwRasterOp = SRCAND; + case ectEMPTY: + card = 52; + break; + case ectERASE: + break; + case ectREDX: + card = 66; + break; + case ectGREENO: + card = 67; + break; + default: + return FALSE; + } - if (type == ectEMPTY || type == ectERASE) - { - POINT pPoint; - HBRUSH hBrush; + if (type == ectEMPTY || type == ectERASE) + { + POINT pPoint; + HBRUSH hBrush; - hBrush = CreateSolidBrush(color); - GetDCOrgEx(hdc, &pPoint); - SetBrushOrgEx(hdc, pPoint.x, pPoint.y, 0); - SelectObject(hdc, hBrush); - PatBlt(hdc, x, y, dx, dy, PATCOPY); - } - if (type != ectERASE) - { - hdcCard = CreateCompatibleDC(hdc); - SelectObject(hdcCard, g_CardBitmaps[card]); - OldBkColor = SetBkColor(hdc, (type == ectFACES) ? 0xFFFFFF : color); - if (bSaveEdges) - { - COLORREF SavedPixels[12]; - SavedPixels[0] = GetPixel(hdc, x, y); - SavedPixels[1] = GetPixel(hdc, x + 1, y); - SavedPixels[2] = GetPixel(hdc, x, y + 1); - SavedPixels[3] = GetPixel(hdc, x + dx - 1, y); - SavedPixels[4] = GetPixel(hdc, x + dx - 2, y); - SavedPixels[5] = GetPixel(hdc, x + dx - 1, y + 1); - SavedPixels[6] = GetPixel(hdc, x, y + dy - 1); - SavedPixels[7] = GetPixel(hdc, x + 1, y + dy - 1); - SavedPixels[8] = GetPixel(hdc, x, y + dy - 2); - SavedPixels[9] = GetPixel(hdc, x + dx - 1, y + dy - 1); - SavedPixels[10] = GetPixel(hdc, x + dx - 2, y + dy - 1); - SavedPixels[11] = GetPixel(hdc, x + dx - 1, y + dy - 2); + hBrush = CreateSolidBrush(color); + GetDCOrgEx(hdc, &pPoint); + SetBrushOrgEx(hdc, pPoint.x, pPoint.y, 0); + SelectObject(hdc, hBrush); + PatBlt(hdc, x, y, dx, dy, PATCOPY); + } + if (type != ectERASE) + { + hdcCard = CreateCompatibleDC(hdc); + SelectObject(hdcCard, g_CardBitmaps[card]); + OldBkColor = SetBkColor(hdc, (type == ectFACES) ? 0xFFFFFF : color); + if (bSaveEdges) + { + COLORREF SavedPixels[12]; + SavedPixels[0] = GetPixel(hdc, x, y); + SavedPixels[1] = GetPixel(hdc, x + 1, y); + SavedPixels[2] = GetPixel(hdc, x, y + 1); + SavedPixels[3] = GetPixel(hdc, x + dx - 1, y); + SavedPixels[4] = GetPixel(hdc, x + dx - 2, y); + SavedPixels[5] = GetPixel(hdc, x + dx - 1, y + 1); + SavedPixels[6] = GetPixel(hdc, x, y + dy - 1); + SavedPixels[7] = GetPixel(hdc, x + 1, y + dy - 1); + SavedPixels[8] = GetPixel(hdc, x, y + dy - 2); + SavedPixels[9] = GetPixel(hdc, x + dx - 1, y + dy - 1); + SavedPixels[10] = GetPixel(hdc, x + dx - 2, y + dy - 1); + SavedPixels[11] = GetPixel(hdc, x + dx - 1, y + dy - 2); - BltCard(hdc, x, y, dx, dy, hdcCard, dwRasterOp, bStretch); + BltCard(hdc, x, y, dx, dy, hdcCard, dwRasterOp, bStretch); - SetPixel(hdc, x, y, SavedPixels[0]); - SetPixel(hdc, x + 1, y, SavedPixels[1]); - SetPixel(hdc, x, y + 1, SavedPixels[2]); - SetPixel(hdc, x + dx - 1, y, SavedPixels[3]); - SetPixel(hdc, x + dx - 2, y, SavedPixels[4]); - SetPixel(hdc, x + dx - 1, y + 1, SavedPixels[5]); - SetPixel(hdc, x, y + dy - 1, SavedPixels[6]); - SetPixel(hdc, x + 1, y + dy - 1, SavedPixels[7]); - SetPixel(hdc, x, y + dy - 2, SavedPixels[8]); - SetPixel(hdc, x + dx - 1, y + dy - 1, SavedPixels[9]); - SetPixel(hdc, x + dx - 2, y + dy - 1, SavedPixels[10]); - SetPixel(hdc, x + dx - 1, y + dy - 2, SavedPixels[11]); - } - else - { - BltCard(hdc, x, y, dx, dy, hdcCard, dwRasterOp, bStretch); - } - SetBkColor(hdc, OldBkColor); - DeleteDC(hdcCard); - } + SetPixel(hdc, x, y, SavedPixels[0]); + SetPixel(hdc, x + 1, y, SavedPixels[1]); + SetPixel(hdc, x, y + 1, SavedPixels[2]); + SetPixel(hdc, x + dx - 1, y, SavedPixels[3]); + SetPixel(hdc, x + dx - 2, y, SavedPixels[4]); + SetPixel(hdc, x + dx - 1, y + 1, SavedPixels[5]); + SetPixel(hdc, x, y + dy - 1, SavedPixels[6]); + SetPixel(hdc, x + 1, y + dy - 1, SavedPixels[7]); + SetPixel(hdc, x, y + dy - 2, SavedPixels[8]); + SetPixel(hdc, x + dx - 1, y + dy - 1, SavedPixels[9]); + SetPixel(hdc, x + dx - 2, y + dy - 1, SavedPixels[10]); + SetPixel(hdc, x + dx - 1, y + dy - 2, SavedPixels[11]); + } + else + { + BltCard(hdc, x, y, dx, dy, hdcCard, dwRasterOp, bStretch); + } + SetBkColor(hdc, OldBkColor); + DeleteDC(hdcCard); + } - return TRUE; + return TRUE; } @@ -232,19 +233,19 @@ BOOL WINAPI cdtDrawExt(HDC hdc, INT x, INT y, INT dx, INT dy, INT card, INT type */ BOOL WINAPI cdtAnimate(HDC hdc, int cardback, int x, int y, int frame) { - UNREFERENCED_PARAMETER(frame); - UNREFERENCED_PARAMETER(y); - UNREFERENCED_PARAMETER(x); - UNREFERENCED_PARAMETER(cardback); - UNREFERENCED_PARAMETER(hdc); - return TRUE; + UNREFERENCED_PARAMETER(frame); + UNREFERENCED_PARAMETER(y); + UNREFERENCED_PARAMETER(x); + UNREFERENCED_PARAMETER(cardback); + UNREFERENCED_PARAMETER(hdc); + return TRUE; } BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { - UNREFERENCED_PARAMETER(lpvReserved); - if (fdwReason == DLL_PROCESS_ATTACH) - g_hModule = hinstDLL; + UNREFERENCED_PARAMETER(lpvReserved); + if (fdwReason == DLL_PROCESS_ATTACH) + g_hModule = hinstDLL; - return TRUE; + return TRUE; } diff --git a/reactos/dll/win32/cards/cards.h b/reactos/dll/win32/cards/cards.h index 20be102944a..bfbcf98eec1 100644 --- a/reactos/dll/win32/cards/cards.h +++ b/reactos/dll/win32/cards/cards.h @@ -1,7 +1,7 @@ /* - * ReactOS Cards + * ReactOS Cards * - * Copyright (C) 2003 Filip Navara + * Copyright (C) 2003 Filip Navara * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -28,29 +28,29 @@ * FreeCard + * Joker */ -#define MAX_CARD_BITMAPS 68 +#define MAX_CARD_BITMAPS 68 -#define ectFACES 0 -#define ectBACKS 1 -#define ectINVERTED 2 -#define ectEMPTY 3 -#define ectERASE 4 -#define ectEMPTYNOBG 5 -#define ectREDX 6 -#define ectGREENO 7 -#define ectSAVEEDGESMASK 0x80000000 +#define ectFACES 0 +#define ectBACKS 1 +#define ectINVERTED 2 +#define ectEMPTY 3 +#define ectERASE 4 +#define ectEMPTYNOBG 5 +#define ectREDX 6 +#define ectGREENO 7 +#define ectSAVEEDGESMASK 0x80000000 #if defined(CARDSTYLE_DEFAULT) -# define CARD_WIDTH 72 // The original Microsoft cards are 71px wide, but ours are taken from MacSolitaireX -# define CARD_HEIGHT 96 +# define CARD_WIDTH 72 // The original Microsoft cards are 71px wide, but ours are taken from MacSolitaireX +# define CARD_HEIGHT 96 #elif defined(CARDSTYLE_BAVARIAN) -# define CARD_WIDTH 110 -# define CARD_HEIGHT 198 +# define CARD_WIDTH 110 +# define CARD_HEIGHT 198 #else -# error No or unsupported cardstyle defined +# error No or unsupported cardstyle defined #endif -#define ISREDCARD(x) (x >= 13 && x <= 39) +#define ISREDCARD(x) (x >= 13 && x <= 39) BOOL WINAPI cdtInit(int *width, int *height); BOOL WINAPI cdtDraw(HDC hdc, int x, int y, int card, int type, DWORD color); From 4314bf948da0cc912dfbe4f4fd863673c0c696ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Fri, 14 Mar 2014 22:50:03 +0000 Subject: [PATCH 108/113] [CARDS]: "Localize" some variables. svn path=/trunk/; revision=62497 --- reactos/dll/win32/cards/cards.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/reactos/dll/win32/cards/cards.c b/reactos/dll/win32/cards/cards.c index 05ff746992a..b2feb63c5b3 100644 --- a/reactos/dll/win32/cards/cards.c +++ b/reactos/dll/win32/cards/cards.c @@ -123,8 +123,7 @@ static __inline VOID BltCard(HDC hdc, INT x, INT y, INT dx, INT dy, HDC hdcCard, */ BOOL WINAPI cdtDrawExt(HDC hdc, INT x, INT y, INT dx, INT dy, INT card, INT type, COLORREF color) { - HDC hdcCard; - DWORD dwRasterOp = SRCCOPY, OldBkColor; + DWORD dwRasterOp = SRCCOPY; BOOL bSaveEdges = TRUE; BOOL bStretch = FALSE; @@ -180,22 +179,25 @@ BOOL WINAPI cdtDrawExt(HDC hdc, INT x, INT y, INT dx, INT dy, INT card, INT type } if (type != ectERASE) { + HDC hdcCard; + COLORREF OldBkColor; + hdcCard = CreateCompatibleDC(hdc); SelectObject(hdcCard, g_CardBitmaps[card]); OldBkColor = SetBkColor(hdc, (type == ectFACES) ? 0xFFFFFF : color); if (bSaveEdges) { COLORREF SavedPixels[12]; - SavedPixels[0] = GetPixel(hdc, x, y); - SavedPixels[1] = GetPixel(hdc, x + 1, y); - SavedPixels[2] = GetPixel(hdc, x, y + 1); - SavedPixels[3] = GetPixel(hdc, x + dx - 1, y); - SavedPixels[4] = GetPixel(hdc, x + dx - 2, y); - SavedPixels[5] = GetPixel(hdc, x + dx - 1, y + 1); - SavedPixels[6] = GetPixel(hdc, x, y + dy - 1); - SavedPixels[7] = GetPixel(hdc, x + 1, y + dy - 1); - SavedPixels[8] = GetPixel(hdc, x, y + dy - 2); - SavedPixels[9] = GetPixel(hdc, x + dx - 1, y + dy - 1); + SavedPixels[0] = GetPixel(hdc, x, y); + SavedPixels[1] = GetPixel(hdc, x + 1, y); + SavedPixels[2] = GetPixel(hdc, x, y + 1); + SavedPixels[3] = GetPixel(hdc, x + dx - 1, y); + SavedPixels[4] = GetPixel(hdc, x + dx - 2, y); + SavedPixels[5] = GetPixel(hdc, x + dx - 1, y + 1); + SavedPixels[6] = GetPixel(hdc, x, y + dy - 1); + SavedPixels[7] = GetPixel(hdc, x + 1, y + dy - 1); + SavedPixels[8] = GetPixel(hdc, x, y + dy - 2); + SavedPixels[9] = GetPixel(hdc, x + dx - 1, y + dy - 1); SavedPixels[10] = GetPixel(hdc, x + dx - 2, y + dy - 1); SavedPixels[11] = GetPixel(hdc, x + dx - 1, y + dy - 2); @@ -244,6 +246,7 @@ BOOL WINAPI cdtAnimate(HDC hdc, int cardback, int x, int y, int frame) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { UNREFERENCED_PARAMETER(lpvReserved); + if (fdwReason == DLL_PROCESS_ATTACH) g_hModule = hinstDLL; From 7c7bd121c5f913f57188d36f2de0d0c3e13ed99a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Fri, 14 Mar 2014 23:12:10 +0000 Subject: [PATCH 109/113] [CARDS] Fix GDI leak. Patch by mudhead. CORE-7854 #resolve #comment Fixed in revision 62498, thanks ;) svn path=/trunk/; revision=62498 --- reactos/dll/win32/cards/cards.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/reactos/dll/win32/cards/cards.c b/reactos/dll/win32/cards/cards.c index b2feb63c5b3..618c902e680 100644 --- a/reactos/dll/win32/cards/cards.c +++ b/reactos/dll/win32/cards/cards.c @@ -169,13 +169,15 @@ BOOL WINAPI cdtDrawExt(HDC hdc, INT x, INT y, INT dx, INT dy, INT card, INT type if (type == ectEMPTY || type == ectERASE) { POINT pPoint; - HBRUSH hBrush; + HBRUSH hBrush, hOldBrush; hBrush = CreateSolidBrush(color); GetDCOrgEx(hdc, &pPoint); SetBrushOrgEx(hdc, pPoint.x, pPoint.y, 0); - SelectObject(hdc, hBrush); + hOldBrush = SelectObject(hdc, hBrush); PatBlt(hdc, x, y, dx, dy, PATCOPY); + SelectObject(hdc, hOldBrush); + DeleteObject(hBrush); } if (type != ectERASE) { From 92514dc19ed5e9cbf16efd6123f2968aa566aab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sat, 15 Mar 2014 00:47:09 +0000 Subject: [PATCH 110/113] [RAPPS]: Update RosBE to 2.1.1 svn path=/trunk/; revision=62499 --- reactos/base/applications/rapps/rapps/rosbe.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/reactos/base/applications/rapps/rapps/rosbe.txt b/reactos/base/applications/rapps/rapps/rosbe.txt index 2043f96b99e..56098d8d9d6 100644 --- a/reactos/base/applications/rapps/rapps/rosbe.txt +++ b/reactos/base/applications/rapps/rapps/rosbe.txt @@ -2,13 +2,13 @@ [Section] Name = ReactOS Build Environment -Version = 2.1 +Version = 2.1.1 Licence = GPL Description = Allows you to build the ReactOS Source. For more instructions see ReactOS wiki. -Size = 31.6 MB +Size = 28.3 MB Category = 7 URLSite = http://reactos.org/wiki/Build_Environment -URLDownload = http://download.sourceforge.net/project/reactos/RosBE-Windows/i386/2.1/RosBE-2.1.exe +URLDownload = http://downloads.sourceforge.net/reactos/RosBE-2.1.1.exe CDPath = none [Section.0405] @@ -21,8 +21,8 @@ Description = Erlaubt es Ihnen den ReactOS Source Code zu kompilieren. Im ReactO Description = Te permite compilar el código de ReactOS. Para más instrucciones consulta la wiki de ReactOS. [Section.040c] -Description = Vous permet de compiler le code source de ReactOS. Pour plus d'instruction, reportez-vous au wiki ReactOS. -Size = 31,6 Mo +Description = Vous permet de compiler le code source de ReactOS. Pour plus d'instructions, reportez-vous au wiki ReactOS. +Size = 28,3 Mo [Section.0410] Description = Permette di compilare i sorgenti di ReactOS. Per maggiori informazioni consultare il Wiki di ReactOS. @@ -35,12 +35,12 @@ Description = Pozwala zbudować obraz płyty ReactOS ze źródeł. Więcej infor [Section.0418] Description = Permite compilarea surselor ReactOS. Pentru instrucțiuni, consultați wiki ReactOS. -Size = 31,6 Mo +Size = 28,3 Mo [Section.041f] Name = ReactOS Derleme Ortamı Description = ReactOS Kaynak Kodları'nı derlettirir. Daha çok açıklama için ReactOS Wiki'ye bakınız. -Size = 31,6 MB +Size = 28,3 MB [Section.0422] Description = Дозволяє зібрати ReactOS з вихідних кодів. За детальною інформацією дивіться в ReactOS Вікі. From 8959204c82a5847e9884a38d36e01deef9b2848f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sat, 15 Mar 2014 02:04:54 +0000 Subject: [PATCH 111/113] [CONSRV]: Silence some DPRINTs. svn path=/trunk/; revision=62500 --- .../win32ss/user/winsrv/consrv/frontends/gui/guiterm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c b/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c index bffeeca0926..acc870b40eb 100644 --- a/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c +++ b/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c @@ -231,7 +231,7 @@ GuiSendMenuEvent(PCONSOLE Console, UINT CmdId) er.EventType = MENU_EVENT; er.Event.MenuEvent.dwCommandId = CmdId; - DPRINT1("Menu item ID: %d\n", CmdId); + DPRINT("Menu item ID: %d\n", CmdId); ConioProcessInputEvent(Console, &er); } @@ -1713,7 +1713,7 @@ GuiConsoleWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { PCONSOLE_SCREEN_BUFFER ActiveBuffer = GuiData->ActiveBuffer; - DPRINT1("WM_PALETTECHANGED called\n"); + DPRINT("WM_PALETTECHANGED called\n"); /* * Protects against infinite loops: @@ -1730,12 +1730,12 @@ GuiConsoleWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) */ if ((HWND)wParam == hWnd) break; - DPRINT1("WM_PALETTECHANGED ok\n"); + DPRINT("WM_PALETTECHANGED ok\n"); // if (GetType(ActiveBuffer) == GRAPHICS_BUFFER) if (ActiveBuffer->PaletteHandle) { - DPRINT1("WM_PALETTECHANGED changing palette\n"); + DPRINT("WM_PALETTECHANGED changing palette\n"); /* Specify the use of the system palette for the framebuffer */ SetSystemPaletteUse(GuiData->hMemDC, ActiveBuffer->PaletteUsage); @@ -1744,7 +1744,7 @@ GuiConsoleWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) RealizePalette(GuiData->hMemDC); } - DPRINT1("WM_PALETTECHANGED quit\n"); + DPRINT("WM_PALETTECHANGED quit\n"); break; } From 3643e3e2b9ed7d4ffebf1b99c65e136c01c33405 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 15 Mar 2014 13:46:33 +0000 Subject: [PATCH 112/113] [MSGINA] Update russian translation. Patch by jperm. Thanks a lot! CORE-7974 #resolve svn path=/trunk/; revision=62501 --- reactos/dll/win32/msgina/lang/ru-RU.rc | 64 +++++++++++++------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/reactos/dll/win32/msgina/lang/ru-RU.rc b/reactos/dll/win32/msgina/lang/ru-RU.rc index 398ce06d5e7..1061218abb7 100644 --- a/reactos/dll/win32/msgina/lang/ru-RU.rc +++ b/reactos/dll/win32/msgina/lang/ru-RU.rc @@ -51,7 +51,7 @@ BEGIN PUSHBUTTON "Заблокировать", IDC_LOCK, 7, 135, 86, 14 PUSHBUTTON "Завершение сеанса", IDC_LOGOFF, 102, 135, 86, 14 PUSHBUTTON "Выключение", IDC_SHUTDOWN, 198, 135, 70, 14 - PUSHBUTTON "Change Password", IDC_CHANGEPWD, 10, 154, 76, 14 + PUSHBUTTON "Изменение пароля", IDC_CHANGEPWD, 7, 155, 86, 14 PUSHBUTTON "Диспетчер задач", IDC_TASKMGR, 102, 154, 86, 14 PUSHBUTTON "Отмена", IDCANCEL, 198, 154, 70, 14 END @@ -77,9 +77,9 @@ BEGIN ICON IDI_LOCKICON, -1, 7, 59, 20, 20 LTEXT "Этот компьютер используется и заблокирован.", IDC_STATIC, 36, 61, 232, 8 LTEXT "Сообщение", IDC_LOCKMSG, 36, 75, 232, 26 - LTEXT "По&льзователь:", IDC_STATIC, 36, 107, 40, 8 + LTEXT "По&льзователь:", IDC_STATIC, 36, 107, 51, 8 EDITTEXT IDC_USERNAME, 84, 104, 119, 14, ES_AUTOHSCROLL - LTEXT "&Пароль:", IDC_STATIC, 36, 125, 42, 8 + LTEXT "&Пароль:", IDC_STATIC, 33, 125, 42, 8 EDITTEXT IDC_PASSWORD, 84, 123, 119, 14, ES_AUTOHSCROLL | ES_PASSWORD PUSHBUTTON "OK", IDOK, 80, 154, 50, 14, BS_DEFPUSHBUTTON PUSHBUTTON "Отмена", IDCANCEL, 144, 154, 50, 14 @@ -87,33 +87,33 @@ END IDD_CHANGE_PASSWORD DIALOGEX 0, 0, 275, 166 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP -CAPTION "Change Password" +CAPTION "Изменение пароля" FONT 8, "MS Shell Dlg", 400, 0, 1 BEGIN CONTROL IDI_ROSLOGO, IDC_ROSLOGO, "Static", SS_BITMAP, 0, 0, 275, 54 - LTEXT "User name:", IDC_STATIC, 7, 61, 78, 8 + LTEXT "Имя:", IDC_STATIC, 7, 61, 78, 8 EDITTEXT IDC_CHANGEPWD_USERNAME, 90, 59, 127, 12, ES_AUTOHSCROLL - LTEXT "Log on to:", IDC_STATIC, 7, 78, 78, 8 + LTEXT "Войти на:", IDC_STATIC, 7, 78, 78, 8 COMBOBOX IDC_CHANGEPWD_DOMAIN, 90, 75, 127, 144, CBS_DROPDOWNLIST | CBS_SORT - LTEXT "Old Password:", IDC_STATIC, 7, 95, 78, 8 + LTEXT "Старый пароль:", IDC_STATIC, 7, 95, 78, 8 EDITTEXT IDC_CHANGEPWD_OLDPWD, 90, 92, 127, 12, ES_AUTOHSCROLL | ES_PASSWORD - LTEXT "New Password:", IDC_STATIC, 7, 111, 78, 8 + LTEXT "Новый пароль:", IDC_STATIC, 7, 111, 78, 8 EDITTEXT IDC_CHANGEPWD_NEWPWD1, 90, 109, 127, 12, ES_AUTOHSCROLL | ES_PASSWORD - LTEXT "Confirm new Password:", IDC_STATIC, 7, 127, 78, 8 + LTEXT "Подтвердите пароль:", IDC_STATIC, 7, 127, 78, 20 EDITTEXT IDC_CHANGEPWD_NEWPWD2, 90, 125, 127, 12, ES_AUTOHSCROLL | ES_PASSWORD PUSHBUTTON "OK", IDOK, 164, 145, 50, 14, BS_DEFPUSHBUTTON - PUSHBUTTON "Cancel", IDCANCEL, 218, 145, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, 218, 145, 50, 14 END IDD_LOGOFF_DLG DIALOGEX 0, 0, 188, 60 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_SYSMENU | WS_POPUP -CAPTION "Log Off ReactOS" +CAPTION "Выход из ReactOS" FONT 8, "MS Shell Dlg", 400, 0, 1 BEGIN ICON IDI_LOCKICON, -1, 7, 7, 20, 20 - LTEXT "Are you sure you want to log off?", IDC_STATIC, 35, 16, 146, 8 - PUSHBUTTON "Yes", IDYES, 41, 39, 50, 14, BS_DEFPUSHBUTTON - PUSHBUTTON "No", IDNO, 95, 39, 50, 14 + LTEXT "Вы уверены, что хотите выйти?", IDC_STATIC, 35, 16, 146, 8 + PUSHBUTTON "Да", IDYES, 41, 39, 50, 14, BS_DEFPUSHBUTTON + PUSHBUTTON "Нет", IDNO, 95, 39, 50, 14 END IDD_SHUTDOWN_DLG DIALOGEX 0, 0, 275, 146 @@ -139,31 +139,31 @@ BEGIN IDS_ASKFORPASSWORD "Пароль: " IDS_FORCELOGOFF "При регистрации нового пользователя все несохраненные данные будут утеряны. Продолжить?" IDS_LOCKMSG "Только %s или Администратор могут разблокировать этот компьютер." - IDS_LOGONMSG "You are logged on as %s." + IDS_LOGONMSG "Вы вошли в систему как %s." IDS_LOGONDATE "Дата входа: %s %s" - IDS_COMPUTERLOCKED "Computer locked" - IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." + IDS_COMPUTERLOCKED "Компьютер заблокирован" + IDS_LOCKEDWRONGPASSWORD "Неверный пароль. Пожалуйста, введите пароль еще раз. Символы в Пароли вводятся с учетом регистра." IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." - IDS_CHANGEPWDTITLE "Change Password" - IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes." - IDS_PASSWORDCHANGED "Your password has been changed." + IDS_CHANGEPWDTITLE "Изменить пароль" + IDS_NONMATCHINGPASSWORDS "Введенные пароли несовпадают. Введите пароль в оба поля" + IDS_PASSWORDCHANGED "Ваш пароль был изменен." IDS_LOGONTITLE "Logon Message" - IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." - IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_LOGONWRONGUSERORPWD "Системе не удается войти в. Убедитесь в том, ваше имя пользователя и домен верны, то введите пароль еще раз. Символы в Пароли вводятся с учетом регистра" + IDS_LOGONUSERDISABLED "Ваш аккаунт был отключен. Пожалуйста, обратитесь к системному администратору." END /* Shutdown Dialog Strings */ STRINGTABLE BEGIN - IDS_SHUTDOWN_LOGOFF "Log off ""%s""" - IDS_SHUTDOWN_SHUTDOWN "Shut down" - IDS_SHUTDOWN_RESTART "Restart" - IDS_SHUTDOWN_SLEEP "Sleep" - IDS_SHUTDOWN_HIBERNATE "Hibernate" + IDS_SHUTDOWN_LOGOFF "Выйти ""%s""" + IDS_SHUTDOWN_SHUTDOWN "Завершение работы" + IDS_SHUTDOWN_RESTART "Перезагрузка" + IDS_SHUTDOWN_SLEEP "Спящий режим" + IDS_SHUTDOWN_HIBERNATE "Гибернация" /* Shut down descriptions */ - IDS_SHUTDOWN_LOGOFF_DESC "Ends your current session and allows other users to log on to the system." - IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." - IDS_SHUTDOWN_RESTART_DESC "Ends your current session and reboots the system." - IDS_SHUTDOWN_SLEEP_DESC "Puts the system in sleep mode." - IDS_SHUTDOWN_HIBERNATE_DESC "Saves the current session and shuts down the computer." + IDS_SHUTDOWN_LOGOFF_DESC "Завершает текущий сеанс и позволяет другим пользователям войти в систему." + IDS_SHUTDOWN_SHUTDOWN_DESC "Завершает текущий сеанс и отключает систему так что можно спокойно выключить питание." + IDS_SHUTDOWN_RESTART_DESC "Завершает текущий сеанс и перезагружает систему." + IDS_SHUTDOWN_SLEEP_DESC "Переводит систему в режим ожидания." + IDS_SHUTDOWN_HIBERNATE_DESC "Сохраняет текущий сеанс и выключит компьютер." END From 4f523a3000b121d00f2ec5c2201410230a5444d8 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 15 Mar 2014 13:59:22 +0000 Subject: [PATCH 113/113] [SHELL32] * Implement support for file formats' drop target shell extensions. * Implement a shell extension for executable files. * Implement a shell extension for lnk files. * Change the shell notifications for moving files and folders, as they were all conflated with renaming files. * Fix up SHChangeNotification so the desktop receives notifications when files are added to common or user desktop directories. * Fix up SHChangeNotification such that folder pidls are not incorrectly assumed to be file pidls and displayed incorrectly. * Implement a drop target for My Documents. * Fix up the desktop's drop target resolution so files can be dropped on the recycle bin and my documents etc properly. * Stub IDragSourceHelper in CLSID_DragDropHelper. * Add a few additional shell change notifications. * Silence a few FIXMEs to TRACEs. * Some code clean up. * Brought to you by Huw Campbell. CORE-3760 svn path=/trunk/; revision=62502 --- reactos/boot/bootdata/hivecls.inf | 2 + reactos/dll/win32/shell32/CMakeLists.txt | 1 + reactos/dll/win32/shell32/changenotify.cpp | 58 +++- reactos/dll/win32/shell32/defcontextmenu.cpp | 35 ++- reactos/dll/win32/shell32/dragdrophelper.cpp | 12 + reactos/dll/win32/shell32/dragdrophelper.h | 6 +- .../shell32/droptargets/CexeDropHandler.cpp | 138 +++++++++ .../shell32/droptargets/CexeDropHandler.h | 66 +++++ reactos/dll/win32/shell32/folders/desktop.cpp | 53 +++- reactos/dll/win32/shell32/folders/desktop.h | 1 + reactos/dll/win32/shell32/folders/fs.cpp | 119 +++++++- reactos/dll/win32/shell32/folders/fs.h | 4 + .../dll/win32/shell32/folders/mydocuments.cpp | 51 +++- .../dll/win32/shell32/folders/mydocuments.h | 11 +- .../dll/win32/shell32/folders/recyclebin.cpp | 4 +- reactos/dll/win32/shell32/precomp.h | 1 + .../win32/shell32/res/rgs/exedrophandler.rgs | 13 + reactos/dll/win32/shell32/rgs_res.rc | 1 + reactos/dll/win32/shell32/shell32_main.cpp | 1 + reactos/dll/win32/shell32/shelllink.cpp | 62 +++++ reactos/dll/win32/shell32/shelllink.h | 261 +++++++++--------- reactos/dll/win32/shell32/shfldr.h | 14 +- reactos/dll/win32/shell32/shlfileop.cpp | 19 +- reactos/dll/win32/shell32/shlview.cpp | 12 +- reactos/dll/win32/shell32/shresdef.h | 1 + reactos/include/psdk/shlguid_undoc.h | 2 + 26 files changed, 783 insertions(+), 165 deletions(-) create mode 100644 reactos/dll/win32/shell32/droptargets/CexeDropHandler.cpp create mode 100644 reactos/dll/win32/shell32/droptargets/CexeDropHandler.h create mode 100644 reactos/dll/win32/shell32/res/rgs/exedrophandler.rgs diff --git a/reactos/boot/bootdata/hivecls.inf b/reactos/boot/bootdata/hivecls.inf index 98071809b98..10db21badfd 100644 --- a/reactos/boot/bootdata/hivecls.inf +++ b/reactos/boot/bootdata/hivecls.inf @@ -100,6 +100,7 @@ HKCR,"exefile","FriendlyTypeName",0x00020000,"@%SystemRoot%\system32\shell32.dll HKCR,"exefile\Defaulticon","",0x00000000,"%1" HKCR,"exefile\shell\open\command","",0x00000000,"""%1"" %*" HKCR,"exefile\shell\runas\command","",0x00020000,"""%1"" %*" +HKCR,"exefile\shellex\DropHandler","",0x00020000,"{86C86720-42A0-1069-A2E8-08002B30309D}" ; Fonts HKCR,".fon","",0x00000000,"fonfile" @@ -191,6 +192,7 @@ HKCR,"lnkfile","NeverShowExt",0x00000000,"" HKCR,"lnkfile","IsShortcut",0x00000000,"yes" HKCR,"lnkfile\CLSID","",0x00000000,"{00021401-0000-0000-C000-000000000046}" HKCR,"lnkfile\shellex\IconHandler","",0x00000000,"{00021401-0000-0000-C000-000000000046}" +HKCR,"lnkfile\shellex\DropHandler","",0x00000000,"{00021401-0000-0000-C000-000000000046}" HKCR,"lnkfile\shellex\ContextMenuHandlers\{00021401-0000-0000-C000-000000000046}","",0x00000000,"" HKCR,"lnkfile\shellex\PropertySheetHandlers\Shellink Property Page", "", 0x00000000, "{00021401-0000-0000-C000-000000000046}" diff --git a/reactos/dll/win32/shell32/CMakeLists.txt b/reactos/dll/win32/shell32/CMakeLists.txt index 89c5417e74c..b59b679eb28 100644 --- a/reactos/dll/win32/shell32/CMakeLists.txt +++ b/reactos/dll/win32/shell32/CMakeLists.txt @@ -54,6 +54,7 @@ list(APPEND SOURCE folders/fonts.cpp folders/cpanel.cpp folders/recyclebin.cpp + droptargets/CexeDropHandler.cpp shlexec.cpp shlfileop.cpp shlfolder.cpp diff --git a/reactos/dll/win32/shell32/changenotify.cpp b/reactos/dll/win32/shell32/changenotify.cpp index e776158e3b2..71eee583fc8 100644 --- a/reactos/dll/win32/shell32/changenotify.cpp +++ b/reactos/dll/win32/shell32/changenotify.cpp @@ -264,6 +264,25 @@ static BOOL should_notify( LPCITEMIDLIST changed, LPCITEMIDLIST watched, BOOL su return TRUE; if( sub && ILIsParent( watched, changed, TRUE ) ) return TRUE; + if (sub && _ILIsDesktop(watched)) { + WCHAR wszPath[MAX_PATH]; + SHGetSpecialFolderPathW(0, wszPath, CSIDL_DESKTOPDIRECTORY, FALSE); + LPITEMIDLIST deskpidl = SHSimpleIDListFromPathW(wszPath); + if (ILIsParent(deskpidl, changed, TRUE)) + { + ILFree(deskpidl); + return TRUE; + } + ILFree(deskpidl); + SHGetSpecialFolderPathW(0, wszPath, CSIDL_COMMON_DESKTOPDIRECTORY, FALSE); + deskpidl = SHSimpleIDListFromPathW(wszPath); + if (ILIsParent(deskpidl, changed, TRUE)) + { + ILFree(deskpidl); + return TRUE; + } + ILFree(deskpidl); + } return FALSE; } @@ -272,7 +291,7 @@ static BOOL should_notify( LPCITEMIDLIST changed, LPCITEMIDLIST watched, BOOL su */ void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2) { - LPCITEMIDLIST Pidls[2]; + LPITEMIDLIST Pidls[2]; LPNOTIFICATIONLIST ptr; UINT typeFlag = uFlags & SHCNF_TYPE; @@ -316,10 +335,43 @@ void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID case SHCNF_PATHW: if (dwItem1) Pidls[0] = SHSimpleIDListFromPathW((LPCWSTR)dwItem1); if (dwItem2) Pidls[1] = SHSimpleIDListFromPathW((LPCWSTR)dwItem2); + if (wEventId & (SHCNE_MKDIR | SHCNE_RMDIR | SHCNE_UPDATEDIR | SHCNE_RENAMEFOLDER)) + { + /* + * The last items in the ID are currently files. So we chop off the last + * entry, and create a new one using a find data struct. + */ + if (dwItem1 && Pidls[0]){ + ILRemoveLastID(Pidls[0]); + WIN32_FIND_DATAW wfd; + LPWSTR p = PathFindFileNameW((LPCWSTR)dwItem1); + lstrcpynW(&wfd.cFileName[0], p, MAX_PATH); + wfd.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY; + LPITEMIDLIST newpidl = _ILCreateFromFindDataW(&wfd); + LPITEMIDLIST oldpidl = ILClone(Pidls[0]); + ILFree(Pidls[0]); + Pidls[0] = ILCombine(oldpidl, newpidl); + ILFree(newpidl); + ILFree(oldpidl); + } + if (dwItem2 && Pidls[1]){ + ILRemoveLastID(Pidls[1]); + WIN32_FIND_DATAW wfd; + LPWSTR p = PathFindFileNameW((LPCWSTR)dwItem2); + lstrcpynW(&wfd.cFileName[0], p, MAX_PATH); + wfd.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY; + LPITEMIDLIST newpidl = _ILCreateFromFindDataW(&wfd); + LPITEMIDLIST oldpidl = ILClone(Pidls[0]); + ILFree(Pidls[1]); + Pidls[1] = ILCombine(oldpidl, newpidl); + ILFree(newpidl); + ILFree(oldpidl); + } + } break; case SHCNF_IDLIST: - Pidls[0] = (LPCITEMIDLIST)dwItem1; - Pidls[1] = (LPCITEMIDLIST)dwItem2; + Pidls[0] = (LPITEMIDLIST)dwItem1; + Pidls[1] = (LPITEMIDLIST)dwItem2; break; case SHCNF_PRINTERA: case SHCNF_PRINTERW: diff --git a/reactos/dll/win32/shell32/defcontextmenu.cpp b/reactos/dll/win32/shell32/defcontextmenu.cpp index 72988d120aa..6c5b2b84bee 100644 --- a/reactos/dll/win32/shell32/defcontextmenu.cpp +++ b/reactos/dll/win32/shell32/defcontextmenu.cpp @@ -61,6 +61,7 @@ class CDefaultContextMenu : HRESULT DoPaste(LPCMINVOKECOMMANDINFO lpcmi, BOOL bLink); HRESULT DoOpenOrExplore(LPCMINVOKECOMMANDINFO lpcmi); HRESULT DoCreateLink(LPCMINVOKECOMMANDINFO lpcmi); + HRESULT DoRefresh(LPCMINVOKECOMMANDINFO lpcmi); HRESULT DoDelete(LPCMINVOKECOMMANDINFO lpcmi); HRESULT DoCopyOrCut(LPCMINVOKECOMMANDINFO lpcmi, BOOL bCopy); HRESULT DoRename(LPCMINVOKECOMMANDINFO lpcmi); @@ -931,19 +932,34 @@ NotifyShellViewWindow(LPCMINVOKECOMMANDINFO lpcmi, BOOL bRefresh) if (FAILED(lpSB->QueryActiveShellView(&lpSV))) return E_FAIL; - if (LOWORD(lpcmi->lpVerb) == FCIDM_SHVIEW_REFRESH || bRefresh) - lpSV->Refresh(); - else - { - HWND hwndSV = NULL; - if (SUCCEEDED(lpSV->GetWindow(&hwndSV))) - SendMessageW(hwndSV, WM_COMMAND, MAKEWPARAM(LOWORD(lpcmi->lpVerb), 0), 0); - } + HWND hwndSV = NULL; + if (SUCCEEDED(lpSV->GetWindow(&hwndSV))) + SendMessageW(hwndSV, WM_COMMAND, MAKEWPARAM(LOWORD(lpcmi->lpVerb), 0), 0); lpSV->Release(); return S_OK; } +HRESULT +CDefaultContextMenu::DoRefresh( + LPCMINVOKECOMMANDINFO lpcmi) +{ + CComPtr ppf2 = NULL; + LPITEMIDLIST pidl; + HRESULT hr = m_Dcm.psf->QueryInterface(IID_PPV_ARG(IPersistFolder2, &ppf2)); + if (SUCCEEDED(hr)) + { + hr = ppf2->GetCurFolder(&pidl); + if (SUCCEEDED(hr)) + { + SHChangeNotify(SHCNE_UPDATEDIR, SHCNF_IDLIST, pidl, NULL); + ILFree(pidl); + } + ppf2->Release(); + } + return hr; +} + HRESULT CDefaultContextMenu::DoPaste( LPCMINVOKECOMMANDINFO lpcmi, BOOL bLink) @@ -1512,8 +1528,9 @@ CDefaultContextMenu::InvokeCommand( case 0x33: case FCIDM_SHVIEW_AUTOARRANGE: case FCIDM_SHVIEW_SNAPTOGRID: - case FCIDM_SHVIEW_REFRESH: return NotifyShellViewWindow(lpcmi, FALSE); + case FCIDM_SHVIEW_REFRESH: + return DoRefresh(lpcmi); case FCIDM_SHVIEW_INSERT: return DoPaste(lpcmi, FALSE); case FCIDM_SHVIEW_INSERTLINK: diff --git a/reactos/dll/win32/shell32/dragdrophelper.cpp b/reactos/dll/win32/shell32/dragdrophelper.cpp index 51a46dd1d2a..b042f2df068 100644 --- a/reactos/dll/win32/shell32/dragdrophelper.cpp +++ b/reactos/dll/win32/shell32/dragdrophelper.cpp @@ -36,6 +36,18 @@ CDropTargetHelper::~CDropTargetHelper() { } +HRESULT WINAPI CDropTargetHelper::InitializeFromBitmap(LPSHDRAGIMAGE pshdi, IDataObject *pDataObject) +{ + FIXME ("(%p)->()\n", this); + return E_NOTIMPL; +} +HRESULT WINAPI CDropTargetHelper::InitializeFromWindow(HWND hwnd, POINT *ppt, IDataObject *pDataObject) +{ + FIXME ("(%p)->()\n", this); + return E_NOTIMPL; +} + + HRESULT WINAPI CDropTargetHelper::DragEnter (HWND hwndTarget, IDataObject* pDataObject, POINT* ppt, DWORD dwEffect) { FIXME ("(%p)->(%p %p %p 0x%08x)\n", this, hwndTarget, pDataObject, ppt, dwEffect); diff --git a/reactos/dll/win32/shell32/dragdrophelper.h b/reactos/dll/win32/shell32/dragdrophelper.h index a520ed655f0..5cc7de9b8a3 100644 --- a/reactos/dll/win32/shell32/dragdrophelper.h +++ b/reactos/dll/win32/shell32/dragdrophelper.h @@ -26,6 +26,7 @@ class CDropTargetHelper : public CComCoClass, public CComObjectRootEx, + public IDragSourceHelper, public IDropTargetHelper { private: @@ -33,7 +34,9 @@ public: CDropTargetHelper(); ~CDropTargetHelper(); - //////// + virtual HRESULT WINAPI InitializeFromBitmap(LPSHDRAGIMAGE pshdi, IDataObject *pDataObject); + virtual HRESULT WINAPI InitializeFromWindow(HWND hwnd, POINT *ppt, IDataObject *pDataObject); + virtual HRESULT WINAPI DragEnter (HWND hwndTarget, IDataObject* pDataObject, POINT* ppt, DWORD dwEffect); virtual HRESULT WINAPI DragLeave(); virtual HRESULT WINAPI DragOver(POINT *ppt, DWORD dwEffect); @@ -46,6 +49,7 @@ DECLARE_NOT_AGGREGATABLE(CDropTargetHelper) DECLARE_PROTECT_FINAL_CONSTRUCT() BEGIN_COM_MAP(CDropTargetHelper) + COM_INTERFACE_ENTRY_IID(IID_IDragSourceHelper, IDragSourceHelper) COM_INTERFACE_ENTRY_IID(IID_IDropTargetHelper, IDropTargetHelper) END_COM_MAP() }; diff --git a/reactos/dll/win32/shell32/droptargets/CexeDropHandler.cpp b/reactos/dll/win32/shell32/droptargets/CexeDropHandler.cpp new file mode 100644 index 00000000000..06052fca503 --- /dev/null +++ b/reactos/dll/win32/shell32/droptargets/CexeDropHandler.cpp @@ -0,0 +1,138 @@ +/* + * executable drop target handler + * + * Copyright 2014 Huw Campbell + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +WINE_DEFAULT_DEBUG_CHANNEL (shell); + +CExeDropHandler::CExeDropHandler() +{ + pclsid = (CLSID *)&CLSID_ExeDropHandler; +} + +CExeDropHandler::~CExeDropHandler() +{ + +} + +// IDropTarget +HRESULT WINAPI CExeDropHandler::DragEnter(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) +{ + TRACE ("(%p)\n", this); + *pdwEffect = DROPEFFECT_COPY; + return S_OK; +} + +HRESULT WINAPI CExeDropHandler::DragOver(DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) +{ + TRACE ("(%p)\n", this); + *pdwEffect = DROPEFFECT_COPY; + return S_OK; +} + +HRESULT WINAPI CExeDropHandler::DragLeave() +{ + TRACE ("(%p)\n", this); + return S_OK; +} + +HRESULT WINAPI CExeDropHandler::Drop(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) +{ + TRACE ("(%p)\n", this); + FORMATETC fmt; + STGMEDIUM medium; + LPWSTR pszSrcList; + InitFormatEtc (fmt, CF_HDROP, TYMED_HGLOBAL); + WCHAR wszBuf[MAX_PATH * 2 + 8], *pszEnd = wszBuf; + size_t cchRemaining = _countof(wszBuf); + + if (SUCCEEDED(pDataObject->GetData(&fmt, &medium)) /* && SUCCEEDED(pDataObject->GetData(&fmt2, &medium))*/) + { + LPDROPFILES lpdf = (LPDROPFILES) GlobalLock(medium.hGlobal); + if (!lpdf) + { + ERR("Error locking global\n"); + return E_FAIL; + } + pszSrcList = (LPWSTR) (((byte*) lpdf) + lpdf->pFiles); + while (*pszSrcList) + { + if (StrChrW(pszSrcList, L' ') && cchRemaining > 3) + StringCchPrintfExW(pszEnd, cchRemaining, &pszEnd, &cchRemaining, 0, L"\"%ls\" ", pszSrcList); + else + StringCchPrintfExW(pszEnd, cchRemaining, &pszEnd, &cchRemaining, 0, L"%ls ", pszSrcList); + + pszSrcList += wcslen(pszSrcList) + 1; + } + } + + ShellExecute(NULL, L"open", sPathTarget, wszBuf, NULL,SW_SHOWNORMAL); + + return S_OK; +} + + +// IPersistFile +HRESULT WINAPI CExeDropHandler::GetCurFile(LPOLESTR *ppszFileName) +{ + FIXME ("(%p)\n", this); + return E_NOTIMPL; +} + +HRESULT WINAPI CExeDropHandler::IsDirty() +{ + FIXME ("(%p)\n", this); + return E_NOTIMPL; +} + +HRESULT WINAPI CExeDropHandler::Load(LPCOLESTR pszFileName, DWORD dwMode) +{ + UINT len = strlenW(pszFileName); + sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR)); + memcpy(sPathTarget, pszFileName, (len + 1) * sizeof(WCHAR)); + return S_OK; +} + +HRESULT WINAPI CExeDropHandler::Save(LPCOLESTR pszFileName, BOOL fRemember) +{ + FIXME ("(%p)\n", this); + return E_NOTIMPL; +} + +HRESULT WINAPI CExeDropHandler::SaveCompleted(LPCOLESTR pszFileName) +{ + FIXME ("(%p)\n", this); + return E_NOTIMPL; +} + +/************************************************************************ + * CFSFolder::GetClassID + */ +HRESULT WINAPI CExeDropHandler::GetClassID(CLSID * lpClassId) +{ + TRACE ("(%p)\n", this); + + if (!lpClassId) + return E_POINTER; + + *lpClassId = *pclsid; + + return S_OK; +} \ No newline at end of file diff --git a/reactos/dll/win32/shell32/droptargets/CexeDropHandler.h b/reactos/dll/win32/shell32/droptargets/CexeDropHandler.h new file mode 100644 index 00000000000..7a79f94aca3 --- /dev/null +++ b/reactos/dll/win32/shell32/droptargets/CexeDropHandler.h @@ -0,0 +1,66 @@ +/* + * executable drop target handler + * + * Copyright 2014 Huw Campbell + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef _CEXEDROPHANDLER_H_ +#define _CEXEDROPHANDLER_H_ + +class CExeDropHandler : + public CComCoClass, + public CComObjectRootEx, + public IDropTarget, + public IPersistFile +{ +private: + CLSID *pclsid; + LPWSTR sPathTarget; +public: + CExeDropHandler(); + ~CExeDropHandler(); + + // IDropTarget + virtual HRESULT WINAPI DragEnter(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect); + virtual HRESULT WINAPI DragOver(DWORD dwKeyState, POINTL pt, DWORD *pdwEffect); + virtual HRESULT WINAPI DragLeave(); + virtual HRESULT WINAPI Drop(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect); + + // IPersist + virtual HRESULT WINAPI GetClassID(CLSID *lpClassId); + + //////// IPersistFile + virtual HRESULT WINAPI GetCurFile(LPOLESTR *ppszFileName); + virtual HRESULT WINAPI IsDirty(); + virtual HRESULT WINAPI Load(LPCOLESTR pszFileName, DWORD dwMode); + virtual HRESULT WINAPI Save(LPCOLESTR pszFileName, BOOL fRemember); + virtual HRESULT WINAPI SaveCompleted(LPCOLESTR pszFileName); + + +DECLARE_REGISTRY_RESOURCEID(IDR_EXEDROPHANDLER) +DECLARE_NOT_AGGREGATABLE(CExeDropHandler) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CExeDropHandler) + COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist) + COM_INTERFACE_ENTRY_IID(IID_IPersistFile, IPersistFile) + COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget) +END_COM_MAP() +}; + +#endif /* _CEXEDROPHANDLER_H_ */ diff --git a/reactos/dll/win32/shell32/folders/desktop.cpp b/reactos/dll/win32/shell32/folders/desktop.cpp index 968bc35aa29..4f5ca9fe0c7 100644 --- a/reactos/dll/win32/shell32/folders/desktop.cpp +++ b/reactos/dll/win32/shell32/folders/desktop.cpp @@ -651,7 +651,7 @@ HRESULT WINAPI CDesktopFolder::GetUIObjectOf( else if (IsEqualIID (riid, IID_IDropTarget)) { /* only interested in attempting to bind to shell folders, not files, semicolon intentionate */ - if (cidl == 1 && SUCCEEDED(this->BindToObject(apidl[0], NULL, IID_IDropTarget, (LPVOID*)&pObj))); + if (cidl == 1 && SUCCEEDED(hr = this->_GetDropTarget(apidl[0], (LPVOID*)&pObj))); else hr = this->QueryInterface(IID_IDropTarget, (LPVOID*)&pObj); } @@ -1451,7 +1451,7 @@ HRESULT WINAPI CDesktopFolder::Drop(IDataObject *pDataObject, else { InitFormatEtc (formatetc, CF_HDROP, TYMED_HGLOBAL); - if SUCCEEDED(pDataObject->QueryGetData(&formatetc)); + if (SUCCEEDED(pDataObject->QueryGetData(&formatetc))) { passthroughtofs = TRUE; } @@ -1488,4 +1488,53 @@ HRESULT WINAPI CDesktopFolder::Drop(IDataObject *pDataObject, /* Todo, rewrite the registry such that the icons are well placed. Blocked by no bags implementation. */ return hr; +} + +HRESULT WINAPI CDesktopFolder::_GetDropTarget(LPCITEMIDLIST pidl, LPVOID *ppvOut) { + HRESULT hr; + + TRACE("CFSFolder::_GetDropTarget entered\n"); + + if (_ILGetGUIDPointer (pidl) || _ILIsFolder (pidl)) + return this->BindToObject(pidl, NULL, IID_IDropTarget, ppvOut); + + LPITEMIDLIST pidlNext = NULL; + + STRRET strFile; + hr = this->GetDisplayNameOf(pidl, SHGDN_FORPARSING, &strFile); + if (SUCCEEDED(hr)) + { + WCHAR wszPath[MAX_PATH]; + hr = StrRetToBufW(&strFile, pidl, wszPath, _countof(wszPath)); + + if (SUCCEEDED(hr)) + { + PathRemoveFileSpecW (wszPath); + hr = this->ParseDisplayName(NULL, NULL, wszPath, NULL, &pidlNext, NULL); + + if (SUCCEEDED(hr)) + { + IShellFolder *psf; + hr = this->BindToObject(pidlNext, NULL, IID_IShellFolder, (LPVOID*)&psf); + CoTaskMemFree(pidlNext); + if (SUCCEEDED(hr)) + { + hr = psf->GetUIObjectOf(NULL, 1, &pidl, IID_IDropTarget, NULL, ppvOut); + psf->Release(); + if (FAILED(hr)) + ERR("FS GetUIObjectOf failed: %x\n", hr); + } + else + ERR("BindToObject failed: %x\n", hr); + } + else + ERR("ParseDisplayName failed: %x\n", hr); + } + else + ERR("StrRetToBufW failed: %x\n", hr); + } + else + ERR("GetDisplayNameOf failed: %x\n", hr); + + return hr; } \ No newline at end of file diff --git a/reactos/dll/win32/shell32/folders/desktop.h b/reactos/dll/win32/shell32/folders/desktop.h index 6f4c723d06a..be62108ff10 100644 --- a/reactos/dll/win32/shell32/folders/desktop.h +++ b/reactos/dll/win32/shell32/folders/desktop.h @@ -40,6 +40,7 @@ class CDesktopFolder : BOOL fAcceptFmt; /* flag for pending Drop */ BOOL QueryDrop (DWORD dwKeyState, LPDWORD pdwEffect); void SF_RegisterClipFmt(); + virtual HRESULT WINAPI _GetDropTarget(LPCITEMIDLIST pidl, LPVOID *ppvOut); public: CDesktopFolder(); diff --git a/reactos/dll/win32/shell32/folders/fs.cpp b/reactos/dll/win32/shell32/folders/fs.cpp index 5e61e7196f9..76e19a00543 100644 --- a/reactos/dll/win32/shell32/folders/fs.cpp +++ b/reactos/dll/win32/shell32/folders/fs.cpp @@ -81,6 +81,7 @@ CFSFolder::CFSFolder() cfShellIDList = 0; SF_RegisterClipFmt(); fAcceptFmt = FALSE; + m_bGroupPolicyActive = 0; } CFSFolder::~CFSFolder() @@ -502,7 +503,7 @@ HRESULT WINAPI CFSFolder::GetUIObjectOf(HWND hwndOwner, else if (IsEqualIID (riid, IID_IDropTarget)) { /* only interested in attempting to bind to shell folders, not files (except exe), so if we fail, rebind to root */ - if (cidl == 1 && SUCCEEDED(hr = this->BindToObject(apidl[0], NULL, IID_IDropTarget, (LPVOID*)&pObj))); + if (cidl == 1 && SUCCEEDED(hr = this->_GetDropTarget(apidl[0], (LPVOID*)&pObj))); else hr = this->QueryInterface(IID_IDropTarget, (LPVOID*)&pObj); } @@ -1617,6 +1618,9 @@ HRESULT WINAPI CFSFolder::_DoDrop(IDataObject *pDataObject, } hr = ppf->Save(wszTarget, FALSE); + if (FAILED(hr)) + break; + SHChangeNotify(SHCNE_CREATE, SHCNF_PATHW, wszTarget, NULL); } else { @@ -1653,6 +1657,9 @@ HRESULT WINAPI CFSFolder::_DoDrop(IDataObject *pDataObject, break; hr = ppf->Save(wszTarget, TRUE); + if (FAILED(hr)) + break; + SHChangeNotify(SHCNE_CREATE, SHCNF_PATHW, wszTarget, NULL); } } } @@ -1748,4 +1755,114 @@ DWORD WINAPI CFSFolder::_DoDropThreadProc(LPVOID lpParameter) { //Release the parameter from the heap. HeapFree(GetProcessHeap(), 0, data); return 0; +} + +HRESULT WINAPI CFSFolder::_GetDropTarget(LPCITEMIDLIST pidl, LPVOID *ppvOut) { + HKEY hKey; + HRESULT hr; + + TRACE("CFSFolder::_GetDropTarget entered\n"); + + if (_ILGetGUIDPointer (pidl) || _ILIsFolder (pidl)) + return this->BindToObject(pidl, NULL, IID_IDropTarget, ppvOut); + + STRRET strFile; + hr = this->GetDisplayNameOf(pidl, SHGDN_FORPARSING, &strFile); + if (hr == S_OK) + { + WCHAR wszPath[MAX_PATH]; + hr = StrRetToBufW(&strFile, pidl, wszPath, _countof(wszPath)); + + if (hr == S_OK) + { + LPCWSTR pwszExt = PathFindExtensionW(wszPath); + if (pwszExt[0]) + { + /* enumerate dynamic/static for a given file class */ + if (RegOpenKeyExW(HKEY_CLASSES_ROOT, pwszExt, 0, KEY_READ, &hKey) == ERROR_SUCCESS) + { + /* load dynamic extensions from file extension key, for example .jpg */ + _LoadDynamicDropTargetHandlerForKey(hKey, wszPath, ppvOut); + RegCloseKey(hKey); + } + + WCHAR wszTemp[40]; + DWORD dwSize = sizeof(wszTemp); + if (RegGetValueW(HKEY_CLASSES_ROOT, pwszExt, NULL, RRF_RT_REG_SZ, NULL, wszTemp, &dwSize) == ERROR_SUCCESS) + { + if (RegOpenKeyExW(HKEY_CLASSES_ROOT, wszTemp, 0, KEY_READ, &hKey) == ERROR_SUCCESS) + { + /* load dynamic extensions from progid key, for example jpegfile */ + _LoadDynamicDropTargetHandlerForKey(hKey, wszPath, ppvOut); + RegCloseKey(hKey); + } + } + } + } + } + else + ERR("GetDisplayNameOf failed: %x\n", hr); + + return hr; +} + +HRESULT WINAPI CFSFolder::_LoadDynamicDropTargetHandlerForKey(HKEY hRootKey, LPCWSTR pwcsname, LPVOID *ppvOut) +{ + TRACE("CFSFolder::_LoadDynamicDropTargetHandlerForKey entered\n"); + + WCHAR wszName[MAX_PATH], *pwszClsid; + DWORD dwSize = sizeof(wszName); + HRESULT hr; + + if (RegGetValueW(hRootKey, L"shellex\\DropHandler", NULL, RRF_RT_REG_SZ, NULL, wszName, &dwSize) == ERROR_SUCCESS) + { + CLSID clsid; + hr = CLSIDFromString(wszName, &clsid); + if (hr == S_OK) + pwszClsid = wszName; + + if (m_bGroupPolicyActive) + { + if (RegGetValueW(HKEY_LOCAL_MACHINE, + L"Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", + pwszClsid, + RRF_RT_REG_SZ, + NULL, + NULL, + NULL) == ERROR_SUCCESS) + { + hr = _LoadDynamicDropTargetHandler(&clsid, pwcsname, ppvOut); + } + } + else + { + hr = _LoadDynamicDropTargetHandler(&clsid, pwcsname, ppvOut); + } + } + else + return E_FAIL; + return hr; +} + +HRESULT WINAPI CFSFolder::_LoadDynamicDropTargetHandler(const CLSID *pclsid, LPCWSTR pwcsname, LPVOID *ppvOut) +{ + TRACE("CFSFolder::_LoadDynamicDropTargetHandler entered\n"); + HRESULT hr; + + IPersistFile *pp; + hr = SHCoCreateInstance(NULL, pclsid, NULL, IID_PPV_ARG(IPersistFile, &pp)); + if (hr != S_OK) + { + ERR("SHCoCreateInstance failed %x\n", GetLastError()); + } + pp->Load(pwcsname, 0); + + hr = pp->QueryInterface(IID_PPV_ARG(IDropTarget, (IDropTarget**) ppvOut)); + if (hr != S_OK) + { + ERR("Failed to query for interface IID_IShellExtInit hr %x pclsid %s\n", hr, wine_dbgstr_guid(pclsid)); + return hr; + } + pp->Release(); + return hr; } \ No newline at end of file diff --git a/reactos/dll/win32/shell32/folders/fs.h b/reactos/dll/win32/shell32/folders/fs.h index e32ab2b7aa8..95ca362ccfe 100644 --- a/reactos/dll/win32/shell32/folders/fs.h +++ b/reactos/dll/win32/shell32/folders/fs.h @@ -44,10 +44,14 @@ class CFSFolder : UINT cfShellIDList; /* clipboardformat for IDropTarget */ BOOL fAcceptFmt; /* flag for pending Drop */ BOOL QueryDrop (DWORD dwKeyState, LPDWORD pdwEffect); + DWORD m_bGroupPolicyActive; void SF_RegisterClipFmt(); BOOL GetUniqueFileName(LPWSTR pwszBasePath, LPCWSTR pwszExt, LPWSTR pwszTarget, BOOL bShortcut); static DWORD WINAPI _DoDropThreadProc(LPVOID lpParameter); virtual HRESULT WINAPI _DoDrop(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect); + virtual HRESULT WINAPI _GetDropTarget(LPCITEMIDLIST pidl, LPVOID *ppvOut); + virtual HRESULT WINAPI _LoadDynamicDropTargetHandlerForKey(HKEY hRootKey, LPCWSTR pwcsname, LPVOID *ppvOut); + virtual HRESULT WINAPI _LoadDynamicDropTargetHandler(const CLSID *pclsid, LPCWSTR pwcsname, LPVOID *ppvOut); public: CFSFolder(); diff --git a/reactos/dll/win32/shell32/folders/mydocuments.cpp b/reactos/dll/win32/shell32/folders/mydocuments.cpp index 7c1cbd93e0d..f1a0238f936 100644 --- a/reactos/dll/win32/shell32/folders/mydocuments.cpp +++ b/reactos/dll/win32/shell32/folders/mydocuments.cpp @@ -78,6 +78,7 @@ CMyDocsFolder::CMyDocsFolder() { pidlRoot = NULL; sPathTarget = NULL; + mFSDropTarget = NULL; } CMyDocsFolder::~CMyDocsFolder() @@ -85,6 +86,7 @@ CMyDocsFolder::~CMyDocsFolder() TRACE ("-- destroying IShellFolder(%p)\n", this); SHFree(pidlRoot); HeapFree(GetProcessHeap(), 0, sPathTarget); + mFSDropTarget->Release(); } HRESULT WINAPI CMyDocsFolder::FinalConstruct() @@ -98,6 +100,29 @@ HRESULT WINAPI CMyDocsFolder::FinalConstruct() sPathTarget = (LPWSTR)SHAlloc((wcslen(szMyPath) + 1) * sizeof(WCHAR)); wcscpy(sPathTarget, szMyPath); + LPITEMIDLIST pidl = NULL; + + WCHAR szPath[MAX_PATH]; + lstrcpynW(szPath, sPathTarget, MAX_PATH); + PathAddBackslashW(szPath); + CComPtr psfDesktop = NULL; + + HRESULT hr = SHGetDesktopFolder(&psfDesktop); + if (SUCCEEDED(hr)) + hr = psfDesktop->ParseDisplayName(NULL, NULL, szPath, NULL, &pidl, NULL); + else + ERR("Error getting desktop folder\n"); + + if (SUCCEEDED(hr)) + { + hr = psfDesktop->BindToObject(pidl, NULL, IID_IDropTarget, (LPVOID*) &mFSDropTarget); + CoTaskMemFree(pidl); + if (FAILED(hr)) + ERR("Error Binding"); + } + else + ERR("Error creating from %s\n", debugstr_w(szPath)); + return S_OK; } @@ -271,8 +296,7 @@ HRESULT WINAPI CMyDocsFolder::CreateViewObject(HWND hwndOwner, REFIID riid, LPVO if (IsEqualIID (riid, IID_IDropTarget)) { - WARN ("IDropTarget not implemented\n"); - hr = E_NOTIMPL; + hr = this->QueryInterface (IID_IDropTarget, ppvOut); } else if (IsEqualIID (riid, IID_IContextMenu)) { @@ -679,3 +703,26 @@ HRESULT WINAPI CMyDocsFolder::GetCurFolder(LPITEMIDLIST *pidl) *pidl = ILClone (pidlRoot); return S_OK; } + +HRESULT WINAPI CMyDocsFolder::DragEnter(IDataObject *pDataObject, + DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) +{ + return mFSDropTarget->DragEnter(pDataObject, dwKeyState, pt, pdwEffect); +} + +HRESULT WINAPI CMyDocsFolder::DragOver(DWORD dwKeyState, POINTL pt, + DWORD *pdwEffect) +{ + return mFSDropTarget->DragOver(dwKeyState, pt, pdwEffect); +} + +HRESULT WINAPI CMyDocsFolder::DragLeave() +{ + return mFSDropTarget->DragLeave(); +} + +HRESULT WINAPI CMyDocsFolder::Drop(IDataObject *pDataObject, + DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) +{ + return mFSDropTarget->Drop(pDataObject, dwKeyState, pt, pdwEffect); +} \ No newline at end of file diff --git a/reactos/dll/win32/shell32/folders/mydocuments.h b/reactos/dll/win32/shell32/folders/mydocuments.h index c52ffe5346f..3a70e8c3d26 100644 --- a/reactos/dll/win32/shell32/folders/mydocuments.h +++ b/reactos/dll/win32/shell32/folders/mydocuments.h @@ -26,12 +26,14 @@ class CMyDocsFolder : public CComCoClass, public CComObjectRootEx, public IShellFolder2, - public IPersistFolder2 + public IPersistFolder2, + public IDropTarget { private: /* both paths are parsible from the MyDocuments */ LPWSTR sPathTarget; /* complete path to target used for enumeration and ChangeNotify */ LPITEMIDLIST pidlRoot; /* absolute pidl */ + IDropTarget *mFSDropTarget; public: CMyDocsFolder(); ~CMyDocsFolder(); @@ -67,6 +69,12 @@ class CMyDocsFolder : // IPersistFolder2 virtual HRESULT WINAPI GetCurFolder(LPITEMIDLIST * pidl); + // IDropTarget + virtual HRESULT WINAPI DragEnter(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect); + virtual HRESULT WINAPI DragOver(DWORD dwKeyState, POINTL pt, DWORD *pdwEffect); + virtual HRESULT WINAPI DragLeave(); + virtual HRESULT WINAPI Drop(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect); + DECLARE_REGISTRY_RESOURCEID(IDR_MYDOCUMENTS) DECLARE_NOT_AGGREGATABLE(CMyDocsFolder) @@ -78,6 +86,7 @@ class CMyDocsFolder : COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder) COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2) COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist) + COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget) END_COM_MAP() }; diff --git a/reactos/dll/win32/shell32/folders/recyclebin.cpp b/reactos/dll/win32/shell32/folders/recyclebin.cpp index 733873a807b..648debf6a47 100644 --- a/reactos/dll/win32/shell32/folders/recyclebin.cpp +++ b/reactos/dll/win32/shell32/folders/recyclebin.cpp @@ -1416,7 +1416,7 @@ BOOL CRecycleBin::QueryDrop(DWORD dwKeyState, LPDWORD pdwEffect) HRESULT WINAPI CRecycleBin::DragEnter(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) { - FIXME("Recycle bin drag over (%p)\n", this); + TRACE("Recycle bin drag over (%p)\n", this); /* The recycle bin accepts pretty much everything, and sets a CSIDL flag. */ fAcceptFmt = TRUE; @@ -1449,7 +1449,7 @@ HRESULT WINAPI CRecycleBin::DragLeave() HRESULT WINAPI CRecycleBin::Drop(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) { - FIXME("(%p) object dropped on recycle bin, effect %u\n", this, *pdwEffect); + TRACE("(%p) object dropped on recycle bin, effect %u\n", this, *pdwEffect); /* TODO: pdwEffect should be read and make the drop object be permanently deleted in the move case (shift held) */ diff --git a/reactos/dll/win32/shell32/precomp.h b/reactos/dll/win32/shell32/precomp.h index f464d095bcf..a2a648ba3de 100644 --- a/reactos/dll/win32/shell32/precomp.h +++ b/reactos/dll/win32/shell32/precomp.h @@ -55,6 +55,7 @@ #include "folders/printers.h" #include "folders/admintools.h" #include "folders/recyclebin.h" +#include "droptargets/CexeDropHandler.h" #include "openwithmenu.h" #include "newmenu.h" #include "startmenu.h" diff --git a/reactos/dll/win32/shell32/res/rgs/exedrophandler.rgs b/reactos/dll/win32/shell32/res/rgs/exedrophandler.rgs new file mode 100644 index 00000000000..7e239c975aa --- /dev/null +++ b/reactos/dll/win32/shell32/res/rgs/exedrophandler.rgs @@ -0,0 +1,13 @@ +HKCR +{ + NoRemove CLSID + { + ForceRemove {86C86720-42A0-1069-A2E8-08002B30309D} = s 'Executable Drag and Drop target' + { + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + } + } +} diff --git a/reactos/dll/win32/shell32/rgs_res.rc b/reactos/dll/win32/shell32/rgs_res.rc index 4ded01df5eb..7cab2161e66 100644 --- a/reactos/dll/win32/shell32/rgs_res.rc +++ b/reactos/dll/win32/shell32/rgs_res.rc @@ -23,3 +23,4 @@ IDR_STARTMENU REGISTRY "res/rgs/startmenu.rgs" IDR_OPENWITHMENU REGISTRY "res/rgs/openwithmenu.rgs" IDR_FILEDEFEXT REGISTRY "res/rgs/shellfiledefext.rgs" IDR_DRVDEFEXT REGISTRY "res/rgs/shelldrvdefext.rgs" +IDR_EXEDROPHANDLER REGISTRY "res/rgs/exedrophandler.rgs" \ No newline at end of file diff --git a/reactos/dll/win32/shell32/shell32_main.cpp b/reactos/dll/win32/shell32/shell32_main.cpp index 21ccb1aa81d..beeff9dc152 100644 --- a/reactos/dll/win32/shell32/shell32_main.cpp +++ b/reactos/dll/win32/shell32/shell32_main.cpp @@ -1371,6 +1371,7 @@ BEGIN_OBJECT_MAP(ObjectMap) OBJECT_ENTRY(CLSID_MenuBandSite, CMenuBandSite) OBJECT_ENTRY(CLSID_MenuBand, CMenuBand) OBJECT_ENTRY(CLSID_MenuDeskBar, CMenuDeskBar) + OBJECT_ENTRY(CLSID_ExeDropHandler, CExeDropHandler) END_OBJECT_MAP() CShell32Module gModule; diff --git a/reactos/dll/win32/shell32/shelllink.cpp b/reactos/dll/win32/shell32/shelllink.cpp index fd54ee719fe..4982f7da306 100644 --- a/reactos/dll/win32/shell32/shelllink.cpp +++ b/reactos/dll/win32/shell32/shelllink.cpp @@ -2168,6 +2168,68 @@ HRESULT WINAPI CShellLink::GetSite(REFIID iid, void ** ppvSite) return site->QueryInterface(iid, ppvSite); } +HRESULT WINAPI CShellLink::DragEnter(IDataObject *pDataObject, + DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) +{ + TRACE("(%p)->(DataObject=%p)\n", this, pDataObject); + LPCITEMIDLIST pidlLast; + IShellFolder *psf; + + HRESULT hr = SHBindToParent(pPidl, IID_PPV_ARG(IShellFolder, &psf), &pidlLast); + + if (SUCCEEDED(hr)) + { + hr = psf->GetUIObjectOf(0, 1, &pidlLast, IID_IDropTarget, NULL, (LPVOID*)&mDropTarget); + + if (SUCCEEDED(hr)) + hr = mDropTarget->DragEnter(pDataObject, dwKeyState, pt, pdwEffect); + else + *pdwEffect = DROPEFFECT_NONE; + + psf->Release(); + } + else + *pdwEffect = DROPEFFECT_NONE; + + return S_OK; +} + + + +HRESULT WINAPI CShellLink::DragOver(DWORD dwKeyState, POINTL pt, + DWORD *pdwEffect) +{ + TRACE("(%p)\n", this); + HRESULT hr = S_OK; + if (mDropTarget) + hr = mDropTarget->DragOver(dwKeyState, pt, pdwEffect); + return hr; +} + +HRESULT WINAPI CShellLink::DragLeave() +{ + TRACE("(%p)\n", this); + HRESULT hr = S_OK; + if (mDropTarget) + { + hr = mDropTarget->DragLeave(); + mDropTarget->Release(); + } + + return hr; +} + +HRESULT WINAPI CShellLink::Drop(IDataObject *pDataObject, + DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) +{ + TRACE("(%p)\n", this); + HRESULT hr = S_OK; + if (mDropTarget) + hr = mDropTarget->Drop(pDataObject, dwKeyState, pt, pdwEffect); + + return hr; +} + /************************************************************************** * IShellLink_ConstructFromFile */ diff --git a/reactos/dll/win32/shell32/shelllink.h b/reactos/dll/win32/shell32/shelllink.h index 47cb0fa8abb..3ccfd3df61a 100644 --- a/reactos/dll/win32/shell32/shelllink.h +++ b/reactos/dll/win32/shell32/shelllink.h @@ -25,140 +25,148 @@ #define _SHELLLINK_H_ class CShellLink : - public CComCoClass, - public CComObjectRootEx, - public IShellLinkA, - public IShellLinkW, - public IPersistFile, - public IPersistStream, - public IShellLinkDataList, - public IShellExtInit, - public IContextMenu, - public IObjectWithSite, - public IShellPropSheetExt + public CComCoClass, + public CComObjectRootEx, + public IShellLinkA, + public IShellLinkW, + public IPersistFile, + public IPersistStream, + public IShellLinkDataList, + public IShellExtInit, + public IContextMenu, + public IDropTarget, + public IObjectWithSite, + public IShellPropSheetExt { public: - /* link file formats */ + /* link file formats */ - #include "pshpack1.h" + #include "pshpack1.h" - struct volume_info - { - DWORD type; - DWORD serial; - WCHAR label[12]; /* assume 8.3 */ - }; + struct volume_info + { + DWORD type; + DWORD serial; + WCHAR label[12]; /* assume 8.3 */ + }; - #include "poppack.h" + #include "poppack.h" private: - /* data structures according to the information in the link */ - LPITEMIDLIST pPidl; - WORD wHotKey; - SYSTEMTIME time1; - SYSTEMTIME time2; - SYSTEMTIME time3; + /* data structures according to the information in the link */ + LPITEMIDLIST pPidl; + WORD wHotKey; + SYSTEMTIME time1; + SYSTEMTIME time2; + SYSTEMTIME time3; - DWORD iShowCmd; - LPWSTR sIcoPath; - INT iIcoNdx; - LPWSTR sPath; - LPWSTR sArgs; - LPWSTR sWorkDir; - LPWSTR sDescription; - LPWSTR sPathRel; - LPWSTR sProduct; - LPWSTR sComponent; - volume_info volume; - LPWSTR sLinkPath; - BOOL bRunAs; - BOOL bDirty; - INT iIdOpen; /* id of the "Open" entry in the context menu */ - CComPtr site; + DWORD iShowCmd; + LPWSTR sIcoPath; + INT iIcoNdx; + LPWSTR sPath; + LPWSTR sArgs; + LPWSTR sWorkDir; + LPWSTR sDescription; + LPWSTR sPathRel; + LPWSTR sProduct; + LPWSTR sComponent; + volume_info volume; + LPWSTR sLinkPath; + BOOL bRunAs; + BOOL bDirty; + INT iIdOpen; /* id of the "Open" entry in the context menu */ + CComPtr site; + IDropTarget *mDropTarget; public: - CShellLink(); - ~CShellLink(); - LPWSTR ShellLink_GetAdvertisedArg(LPCWSTR str); - HRESULT ShellLink_SetAdvertiseInfo(LPCWSTR str); - static INT_PTR CALLBACK SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); + CShellLink(); + ~CShellLink(); + LPWSTR ShellLink_GetAdvertisedArg(LPCWSTR str); + HRESULT ShellLink_SetAdvertiseInfo(LPCWSTR str); + static INT_PTR CALLBACK SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); - // IPersistFile - virtual HRESULT WINAPI GetClassID(CLSID *pclsid); - virtual HRESULT WINAPI IsDirty(); - virtual HRESULT WINAPI Load(LPCOLESTR pszFileName, DWORD dwMode); - virtual HRESULT WINAPI Save(LPCOLESTR pszFileName, BOOL fRemember); - virtual HRESULT WINAPI SaveCompleted(LPCOLESTR pszFileName); - virtual HRESULT WINAPI GetCurFile(LPOLESTR *ppszFileName); + // IPersistFile + virtual HRESULT WINAPI GetClassID(CLSID *pclsid); + virtual HRESULT WINAPI IsDirty(); + virtual HRESULT WINAPI Load(LPCOLESTR pszFileName, DWORD dwMode); + virtual HRESULT WINAPI Save(LPCOLESTR pszFileName, BOOL fRemember); + virtual HRESULT WINAPI SaveCompleted(LPCOLESTR pszFileName); + virtual HRESULT WINAPI GetCurFile(LPOLESTR *ppszFileName); - // IPersistStream -// virtual WINAPI HRESULT GetClassID(CLSID *pclsid); -// virtual HRESULT WINAPI IsDirty(); - virtual HRESULT WINAPI Load(IStream *stm); - virtual HRESULT WINAPI Save(IStream *stm, BOOL fClearDirty); - virtual HRESULT WINAPI GetSizeMax(ULARGE_INTEGER *pcbSize); + // IPersistStream + // virtual WINAPI HRESULT GetClassID(CLSID *pclsid); + // virtual HRESULT WINAPI IsDirty(); + virtual HRESULT WINAPI Load(IStream *stm); + virtual HRESULT WINAPI Save(IStream *stm, BOOL fClearDirty); + virtual HRESULT WINAPI GetSizeMax(ULARGE_INTEGER *pcbSize); - // IShellLinkA - virtual HRESULT WINAPI GetPath(LPSTR pszFile, INT cchMaxPath, WIN32_FIND_DATAA *pfd, DWORD fFlags); - virtual HRESULT WINAPI GetIDList(LPITEMIDLIST * ppidl); - virtual HRESULT WINAPI SetIDList(LPCITEMIDLIST pidl); - virtual HRESULT WINAPI GetDescription(LPSTR pszName,INT cchMaxName); - virtual HRESULT WINAPI SetDescription(LPCSTR pszName); - virtual HRESULT WINAPI GetWorkingDirectory(LPSTR pszDir,INT cchMaxPath); - virtual HRESULT WINAPI SetWorkingDirectory(LPCSTR pszDir); - virtual HRESULT WINAPI GetArguments(LPSTR pszArgs,INT cchMaxPath); - virtual HRESULT WINAPI SetArguments(LPCSTR pszArgs); - virtual HRESULT WINAPI GetHotkey(WORD *pwHotkey); - virtual HRESULT WINAPI SetHotkey(WORD wHotkey); - virtual HRESULT WINAPI GetShowCmd(INT *piShowCmd); - virtual HRESULT WINAPI SetShowCmd(INT iShowCmd); - virtual HRESULT WINAPI GetIconLocation(LPSTR pszIconPath,INT cchIconPath,INT *piIcon); - virtual HRESULT WINAPI SetIconLocation(LPCSTR pszIconPath,INT iIcon); - virtual HRESULT WINAPI SetRelativePath(LPCSTR pszPathRel, DWORD dwReserved); - virtual HRESULT WINAPI Resolve(HWND hwnd, DWORD fFlags); - virtual HRESULT WINAPI SetPath(LPCSTR pszFile); + // IShellLinkA + virtual HRESULT WINAPI GetPath(LPSTR pszFile, INT cchMaxPath, WIN32_FIND_DATAA *pfd, DWORD fFlags); + virtual HRESULT WINAPI GetIDList(LPITEMIDLIST * ppidl); + virtual HRESULT WINAPI SetIDList(LPCITEMIDLIST pidl); + virtual HRESULT WINAPI GetDescription(LPSTR pszName,INT cchMaxName); + virtual HRESULT WINAPI SetDescription(LPCSTR pszName); + virtual HRESULT WINAPI GetWorkingDirectory(LPSTR pszDir,INT cchMaxPath); + virtual HRESULT WINAPI SetWorkingDirectory(LPCSTR pszDir); + virtual HRESULT WINAPI GetArguments(LPSTR pszArgs,INT cchMaxPath); + virtual HRESULT WINAPI SetArguments(LPCSTR pszArgs); + virtual HRESULT WINAPI GetHotkey(WORD *pwHotkey); + virtual HRESULT WINAPI SetHotkey(WORD wHotkey); + virtual HRESULT WINAPI GetShowCmd(INT *piShowCmd); + virtual HRESULT WINAPI SetShowCmd(INT iShowCmd); + virtual HRESULT WINAPI GetIconLocation(LPSTR pszIconPath,INT cchIconPath,INT *piIcon); + virtual HRESULT WINAPI SetIconLocation(LPCSTR pszIconPath,INT iIcon); + virtual HRESULT WINAPI SetRelativePath(LPCSTR pszPathRel, DWORD dwReserved); + virtual HRESULT WINAPI Resolve(HWND hwnd, DWORD fFlags); + virtual HRESULT WINAPI SetPath(LPCSTR pszFile); - // IShellLinkW - virtual HRESULT WINAPI GetPath(LPWSTR pszFile, INT cchMaxPath, WIN32_FIND_DATAW *pfd, DWORD fFlags); -// virtual HRESULT WINAPI GetIDList(LPITEMIDLIST *ppidl); -// virtual HRESULT WINAPI SetIDList(LPCITEMIDLIST pidl); - virtual HRESULT WINAPI GetDescription(LPWSTR pszName, INT cchMaxName); - virtual HRESULT WINAPI SetDescription(LPCWSTR pszName); - virtual HRESULT WINAPI GetWorkingDirectory(LPWSTR pszDir, INT cchMaxPath); - virtual HRESULT WINAPI SetWorkingDirectory(LPCWSTR pszDir); - virtual HRESULT WINAPI GetArguments(LPWSTR pszArgs,INT cchMaxPath); - virtual HRESULT WINAPI SetArguments(LPCWSTR pszArgs); -// virtual HRESULT WINAPI GetHotkey(WORD *pwHotkey); -// virtual HRESULT WINAPI SetHotkey(WORD wHotkey); -// virtual HRESULT WINAPI GetShowCmd(INT *piShowCmd); -// virtual HRESULT WINAPI SetShowCmd(INT iShowCmd); - virtual HRESULT WINAPI GetIconLocation(LPWSTR pszIconPath,INT cchIconPath,INT *piIcon); - virtual HRESULT WINAPI SetIconLocation(LPCWSTR pszIconPath,INT iIcon); - virtual HRESULT WINAPI SetRelativePath(LPCWSTR pszPathRel, DWORD dwReserved); -// virtual HRESULT WINAPI Resolve(HWND hwnd, DWORD fFlags); - virtual HRESULT WINAPI SetPath(LPCWSTR pszFile); + // IShellLinkW + virtual HRESULT WINAPI GetPath(LPWSTR pszFile, INT cchMaxPath, WIN32_FIND_DATAW *pfd, DWORD fFlags); + // virtual HRESULT WINAPI GetIDList(LPITEMIDLIST *ppidl); + // virtual HRESULT WINAPI SetIDList(LPCITEMIDLIST pidl); + virtual HRESULT WINAPI GetDescription(LPWSTR pszName, INT cchMaxName); + virtual HRESULT WINAPI SetDescription(LPCWSTR pszName); + virtual HRESULT WINAPI GetWorkingDirectory(LPWSTR pszDir, INT cchMaxPath); + virtual HRESULT WINAPI SetWorkingDirectory(LPCWSTR pszDir); + virtual HRESULT WINAPI GetArguments(LPWSTR pszArgs,INT cchMaxPath); + virtual HRESULT WINAPI SetArguments(LPCWSTR pszArgs); + // virtual HRESULT WINAPI GetHotkey(WORD *pwHotkey); + // virtual HRESULT WINAPI SetHotkey(WORD wHotkey); + // virtual HRESULT WINAPI GetShowCmd(INT *piShowCmd); + // virtual HRESULT WINAPI SetShowCmd(INT iShowCmd); + virtual HRESULT WINAPI GetIconLocation(LPWSTR pszIconPath,INT cchIconPath,INT *piIcon); + virtual HRESULT WINAPI SetIconLocation(LPCWSTR pszIconPath,INT iIcon); + virtual HRESULT WINAPI SetRelativePath(LPCWSTR pszPathRel, DWORD dwReserved); + // virtual HRESULT WINAPI Resolve(HWND hwnd, DWORD fFlags); + virtual HRESULT WINAPI SetPath(LPCWSTR pszFile); - // IShellLinkDataList - virtual HRESULT WINAPI AddDataBlock(void *pDataBlock); - virtual HRESULT WINAPI CopyDataBlock(DWORD dwSig, void **ppDataBlock); - virtual HRESULT WINAPI RemoveDataBlock(DWORD dwSig); - virtual HRESULT WINAPI GetFlags(DWORD *pdwFlags); - virtual HRESULT WINAPI SetFlags(DWORD dwFlags); + // IShellLinkDataList + virtual HRESULT WINAPI AddDataBlock(void *pDataBlock); + virtual HRESULT WINAPI CopyDataBlock(DWORD dwSig, void **ppDataBlock); + virtual HRESULT WINAPI RemoveDataBlock(DWORD dwSig); + virtual HRESULT WINAPI GetFlags(DWORD *pdwFlags); + virtual HRESULT WINAPI SetFlags(DWORD dwFlags); - // IShellExtInit - virtual HRESULT WINAPI Initialize(LPCITEMIDLIST pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID); + // IShellExtInit + virtual HRESULT WINAPI Initialize(LPCITEMIDLIST pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID); - // IContextMenu - virtual HRESULT WINAPI QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags); - virtual HRESULT WINAPI InvokeCommand(LPCMINVOKECOMMANDINFO lpici); - virtual HRESULT WINAPI GetCommandString(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax); + // IContextMenu + virtual HRESULT WINAPI QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags); + virtual HRESULT WINAPI InvokeCommand(LPCMINVOKECOMMANDINFO lpici); + virtual HRESULT WINAPI GetCommandString(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax); - // IShellPropSheetExt - virtual HRESULT WINAPI AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam); - virtual HRESULT WINAPI ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam); + // IShellPropSheetExt + virtual HRESULT WINAPI AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam); + virtual HRESULT WINAPI ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam); - // IObjectWithSite - virtual HRESULT WINAPI SetSite(IUnknown *punk); - virtual HRESULT WINAPI GetSite(REFIID iid, void **ppvSite); + // IObjectWithSite + virtual HRESULT WINAPI SetSite(IUnknown *punk); + virtual HRESULT WINAPI GetSite(REFIID iid, void **ppvSite); + + // IDropTarget + virtual HRESULT WINAPI DragEnter(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect); + virtual HRESULT WINAPI DragOver(DWORD dwKeyState, POINTL pt, DWORD *pdwEffect); + virtual HRESULT WINAPI DragLeave(); + virtual HRESULT WINAPI Drop(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect); DECLARE_REGISTRY_RESOURCEID(IDR_SHELLLINK) DECLARE_NOT_AGGREGATABLE(CShellLink) @@ -166,16 +174,17 @@ DECLARE_NOT_AGGREGATABLE(CShellLink) DECLARE_PROTECT_FINAL_CONSTRUCT() BEGIN_COM_MAP(CShellLink) - COM_INTERFACE_ENTRY2_IID(IID_IPersist, IPersist, IPersistFile) - COM_INTERFACE_ENTRY_IID(IID_IPersistFile, IPersistFile) - COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream) - COM_INTERFACE_ENTRY_IID(IID_IShellLinkA, IShellLinkA) - COM_INTERFACE_ENTRY_IID(IID_IShellLinkW, IShellLinkW) - COM_INTERFACE_ENTRY_IID(IID_IShellLinkDataList, IShellLinkDataList) - COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit) - COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu) - COM_INTERFACE_ENTRY_IID(IID_IShellPropSheetExt, IShellPropSheetExt) - COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) + COM_INTERFACE_ENTRY2_IID(IID_IPersist, IPersist, IPersistFile) + COM_INTERFACE_ENTRY_IID(IID_IPersistFile, IPersistFile) + COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream) + COM_INTERFACE_ENTRY_IID(IID_IShellLinkA, IShellLinkA) + COM_INTERFACE_ENTRY_IID(IID_IShellLinkW, IShellLinkW) + COM_INTERFACE_ENTRY_IID(IID_IShellLinkDataList, IShellLinkDataList) + COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit) + COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu) + COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget) + COM_INTERFACE_ENTRY_IID(IID_IShellPropSheetExt, IShellPropSheetExt) + COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) END_COM_MAP() }; diff --git a/reactos/dll/win32/shell32/shfldr.h b/reactos/dll/win32/shell32/shfldr.h index 8a194ce17d5..81111ce4999 100644 --- a/reactos/dll/win32/shell32/shfldr.h +++ b/reactos/dll/win32/shell32/shfldr.h @@ -1,10 +1,10 @@ /* - * Virtual Folder - * common definitions + * Virtual Folder + * common definitions * - * Copyright 1997 Marcus Meissner - * Copyright 1998, 1999, 2002 Juergen Schmied + * Copyright 1997 Marcus Meissner + * Copyright 1998, 1999, 2002 Juergen Schmied * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -40,13 +40,13 @@ BOOL SHELL32_GetCustomFolderAttribute (LPCITEMIDLIST pidl, LPCWSTR pwszHeading, LPCWSTR GetNextElementW (LPCWSTR pszNext, LPWSTR pszOut, DWORD dwOut); HRESULT SHELL32_ParseNextElement (IShellFolder2 * psf, HWND hwndOwner, LPBC pbc, LPITEMIDLIST * pidlInOut, - LPOLESTR szNext, DWORD * pEaten, DWORD * pdwAttributes); + LPOLESTR szNext, DWORD * pEaten, DWORD * pdwAttributes); HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWORD pdwAttributes); HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPWSTR szOut, - DWORD dwOutLen); + DWORD dwOutLen); HRESULT SHELL32_BindToChild (LPCITEMIDLIST pidlRoot, - LPCWSTR pathRoot, LPCITEMIDLIST pidlComplete, REFIID riid, LPVOID * ppvOut); + LPCWSTR pathRoot, LPCITEMIDLIST pidlComplete, REFIID riid, LPVOID * ppvOut); HRESULT SHELL32_CompareIDs (IShellFolder * iface, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2); LPITEMIDLIST SHELL32_CreatePidlFromBindCtx(IBindCtx *pbc, LPCWSTR path); diff --git a/reactos/dll/win32/shell32/shlfileop.cpp b/reactos/dll/win32/shell32/shlfileop.cpp index 1135afc258a..8fe73ffb51b 100644 --- a/reactos/dll/win32/shell32/shlfileop.cpp +++ b/reactos/dll/win32/shell32/shlfileop.cpp @@ -42,7 +42,7 @@ static const WCHAR wWildcardChars[] = {'*','?',0}; static DWORD SHNotifyCreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec); static DWORD SHNotifyRemoveDirectoryW(LPCWSTR path); static DWORD SHNotifyDeleteFileW(LPCWSTR path); -static DWORD SHNotifyMoveFileW(LPCWSTR src, LPCWSTR dest); +static DWORD SHNotifyMoveFileW(LPCWSTR src, LPCWSTR dest, BOOL isdir); static DWORD SHNotifyCopyFileW(LPCWSTR src, LPCWSTR dest, BOOL bFailIfExists); static DWORD SHFindAttrW(LPCWSTR pName, BOOL fileOnly); @@ -531,7 +531,7 @@ EXTERN_C DWORD WINAPI Win32DeleteFileW(LPCWSTR path) * RETURNS * ERORR_SUCCESS if successful */ -static DWORD SHNotifyMoveFileW(LPCWSTR src, LPCWSTR dest) +static DWORD SHNotifyMoveFileW(LPCWSTR src, LPCWSTR dest, BOOL isdir) { BOOL ret; @@ -559,7 +559,8 @@ static DWORD SHNotifyMoveFileW(LPCWSTR src, LPCWSTR dest) } if (ret) { - SHChangeNotify(SHCNE_RENAMEITEM, SHCNF_PATHW, src, dest); + SHChangeNotify(isdir ? SHCNE_MKDIR : SHCNE_CREATE, SHCNF_PATHW, dest, NULL); + SHChangeNotify(isdir ? SHCNE_RMDIR : SHCNE_DELETE, SHCNF_PATHW, src, NULL); return ERROR_SUCCESS; } return GetLastError(); @@ -1474,7 +1475,10 @@ static HRESULT delete_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom) { BOOL bDelete; if (TRASH_TrashFile(fileEntry->szFullPath)) + { + SHChangeNotify(SHCNE_DELETE, SHCNF_PATHW, fileEntry->szFullPath, NULL); continue; + } /* Note: Windows silently deletes the file in such a situation, we show a dialog */ if (!(lpFileOp->fFlags & FOF_NOCONFIRMATION) || (lpFileOp->fFlags & FOF_WANTNUKEWARNING)) @@ -1491,7 +1495,10 @@ static HRESULT delete_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom) /* delete the file or directory */ if (IsAttribFile(fileEntry->attributes)) + { bPathExists = DeleteFileW(fileEntry->szFullPath); + SHChangeNotify(SHCNE_DELETE, SHCNF_PATHW, fileEntry->szFullPath, NULL); + } else bPathExists = SHELL_DeleteDirectoryW(lpFileOp->hwnd, fileEntry->szFullPath, FALSE); @@ -1548,7 +1555,7 @@ static void move_to_dir(LPSHFILEOPSTRUCTW lpFileOp, const FILE_ENTRY *feFrom, co PathCombineW(szDestPath, feTo->szFullPath, feFrom->szFilename); if (IsAttribFile(feFrom->attributes)) - SHNotifyMoveFileW(feFrom->szFullPath, szDestPath); + SHNotifyMoveFileW(feFrom->szFullPath, szDestPath, FALSE); else if (!(lpFileOp->fFlags & FOF_FILESONLY && feFrom->bFromWildcard)) move_dir_to_dir(lpFileOp, feFrom, szDestPath); } @@ -1599,7 +1606,7 @@ static HRESULT move_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, c if (fileDest->bExists && IsAttribDir(fileDest->attributes)) move_to_dir(lpFileOp, entryToMove, fileDest); else - SHNotifyMoveFileW(entryToMove->szFullPath, fileDest->szFullPath); + SHNotifyMoveFileW(entryToMove->szFullPath, fileDest->szFullPath, IsAttribDir(entryToMove->attributes)); } return ERROR_SUCCESS; @@ -1628,7 +1635,7 @@ static HRESULT rename_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, if (feTo->bExists) return ERROR_ALREADY_EXISTS; - return SHNotifyMoveFileW(feFrom->szFullPath, feTo->szFullPath); + return SHNotifyMoveFileW(feFrom->szFullPath, feTo->szFullPath, IsAttribDir(feFrom->attributes)); } /* alert the user if an unsupported flag is used */ diff --git a/reactos/dll/win32/shell32/shlview.cpp b/reactos/dll/win32/shell32/shlview.cpp index 5cf59f3a64a..5afc0e85fe5 100644 --- a/reactos/dll/win32/shell32/shlview.cpp +++ b/reactos/dll/win32/shell32/shlview.cpp @@ -1807,9 +1807,13 @@ LRESULT CDefView::OnChangeNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & break; case SHCNE_UPDATEITEM: + LV_RenameItem(Pidls[0], Pidls[0]); + break; + + case SHCNE_UPDATEDIR: + Refresh(); break; } - return TRUE; } @@ -2493,12 +2497,10 @@ HRESULT WINAPI CDefView::Drop(IDataObject* pDataObject, DWORD grfKeyState, POINT { m_pCurDropTarget->Drop(pDataObject, grfKeyState, pt, pdwEffect); m_pCurDropTarget.Release(); - - this->Refresh(); } - m_pCurDataObject.Release(); m_iDragOverItem = 0; - + m_pCurDataObject.Release(); + m_iDragOverItem = 0; return S_OK; } diff --git a/reactos/dll/win32/shell32/shresdef.h b/reactos/dll/win32/shell32/shresdef.h index deebecb8839..607a42f01fe 100644 --- a/reactos/dll/win32/shell32/shresdef.h +++ b/reactos/dll/win32/shell32/shresdef.h @@ -523,3 +523,4 @@ #define IDR_DRVDEFEXT 148 #define IDR_MENUBAND 149 #define IDR_MENUDESKBAR 150 +#define IDR_EXEDROPHANDLER 151 diff --git a/reactos/include/psdk/shlguid_undoc.h b/reactos/include/psdk/shlguid_undoc.h index 24880ed8fdb..09eb3236f42 100644 --- a/reactos/include/psdk/shlguid_undoc.h +++ b/reactos/include/psdk/shlguid_undoc.h @@ -105,6 +105,8 @@ DEFINE_GUID(CLSID_ShellFileDefExt, 0x21B22460, 0x3AEA, 0x1069, 0xA2, 0xD DEFINE_GUID(CLSID_ShellDrvDefExt, 0x5F5295E0, 0x429F, 0x1069, 0xA2, 0xE2, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D); DEFINE_GUID(CLSID_ShellNetDefExt, 0x86422020, 0x42A0, 0x1069, 0xA2, 0xE5, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D); +DEFINE_GUID(CLSID_ExeDropHandler, 0x86C86720, 0x42A0, 0x1069, 0xA2, 0xE8, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D); + #define CGID_IExplorerToolbar IID_IExplorerToolbar #define SID_IExplorerToolbar IID_IExplorerToolbar #define SID_ITargetFrame2 IID_ITargetFrame2